Jakeh BradleyBack

Apr 2026

Why your agent keeps hallucinating in production.

When an agent produces bad output in production, the first instinct is to blame the model. Swap to a smarter one, tune the temperature, rewrite the prompt. Sometimes that helps. Usually it does not, because the problem was never the model.

Hallucination in production is almost always a context problem.

The model is doing exactly what it was designed to do: generating the most plausible completion given the information it has. When that information is incomplete, ambiguous, or wrong, the output reflects that. The model fills the gap with something that sounds right. That is what hallucination is.

The three context failures

In most production deployments I have seen, hallucination traces back to one of three things.

Missing context. The agent is making a decision it does not have enough information to make correctly. It has the question but not the relevant history, the task but not the constraints, the input but not the schema of what valid output looks like. So it infers. And inference at scale produces inconsistency.

Stale context. The agent has information, but it is out of date. A retrieval system pulling from an index that has not been updated. A memory layer that cached state from three interactions ago. The model reasons correctly from incorrect premises.

Conflicting context. The agent receives signals that point in different directions. Instructions in the system prompt that contradict the data it retrieved. Two documents that disagree on a fact. Without a mechanism for resolving the conflict, the model makes a choice. Sometimes it chooses wrong.

What actually fixes it

The fix is not a smarter model. It is a better-designed context layer.

That means being precise about what information the agent needs to do its job, and building the retrieval and memory systems to reliably surface it. It means designing schemas for what valid output looks like so the model has a target. It means building evaluation harnesses that catch when outputs drift from acceptable ranges before they reach users.

It also means being honest about what the agent should not be doing. If a task requires judgment that is genuinely ambiguous, an agent escalating to a human is not a failure. It is the correct behavior. Designing for graceful escalation prevents the model from confabulating its way through something it should not be handling alone.

The teams that have the most reliable agents in production are not the ones using the most powerful models. They are the ones who spent the most time on context architecture. What goes into the window, when, in what format, with what instructions for resolving conflicts.

That is unglamorous work. It does not make for a good demo. But it is the difference between a system that works once and a system that works every time.

Back to jakehbradley.com