How do you evaluate context use in production AI agents? | Scorable

Updated: 2026-03-24
By: Ari Heljakka

Short answer

Production agents that look healthy in demos and fail in production almost always fail at the context layer, not at the model layer. Upgrading the model rarely helps; the system needs the right facts in the right place at the right time. Context evaluation is the discipline of measuring three things independently: retrieval quality (did the system pull the right context), context window usage (was the retrieved context placed where the model could attend to it), and context-utilization (did the model's response actually use the supplied context faithfully). All three score 0 to 1; all three are orthogonal; none of them is the model's job.

Key facts

Key takeaways

Definition

Context in a production agent is the union of: retrieved documents or rows, structured tool responses, conversation memory, system instructions, and any other state the model needs to produce a correct answer. Context is supplied to the model; it is not generated by the model.

Context evaluation is the disciplined scoring of the context layer on three orthogonal dimensions:

The three dimensions are measured separately so that a failure in one is not hidden by a success in another.

When this matters

Context evaluation matters most when at least two of these hold:

If the agent does not consume retrieved or supplied context (a pure-generation use case with no grounding), context evaluation does not apply.

How it works

The discipline has three dimensions, one architecture pattern, and one feedback loop.

Dimension 1, retrieval quality

The first place an agent can fail. Retrieval quality scores whether the system pulled the right things from the corpus, independently of what the model did with them.

Sub-dimensions, each scored 0 to 1:

The signal lives in the gap. A retrieval system with 0.9 precision and 0.4 recall is leaving facts on the table; the agent has no way to answer correctly because the data never arrived.

Dimension 2, window composition

The second place an agent can fail. The right context retrieved badly is worse than less context retrieved well. Window composition scores the structure of the prompt that finally arrives at the model.

Sub-dimensions:

Window composition is a prompt-engineering discipline that is invisible to a model-centric evaluation framework. Scoring it surfaces a class of failures that retrieval-quality and end-to-end metrics both miss.

Dimension 3, context utilization

The third place an agent can fail. Even with right retrieval and right composition, the model can ignore supplied context and answer from its training instead.

Sub-dimensions:

Context utilization is the dimension most prone to "the model answered the question you wish you asked". A confident, fluent, fully-attended-to wrong answer scores high on plain-text quality and low on faithfulness; the gap is the signal.

Architecture: separate retrieval from reasoning

A reliable agent architecturally separates the retrieval step from the reasoning step. Retrieval pulls structured payloads; reasoning consumes them. The seam between the two is where context evaluation lives.

The separation has two consequences:

A monolithic agent in which retrieval and reasoning are entangled cannot be evaluated this way. Refactoring for separation is often the first concrete engineering action a team takes after context-evaluation results surface a gap.

The feedback loop

Context-evaluation scores feed two things:

The loop is what keeps the system honest as the corpus, the prompts, and the model change.

Example

A team operates a supply-chain decision agent across manufacturing, logistics, and retail. The baseline:

The team stands up context evaluation:

The 12-point gain came from the context layer. The team did not change the model.

Limitations

Caveats worth flagging up front:

Evidence and sources

FAQ

Why not just measure end-to-end task success?
End-to-end metrics tell you something is wrong; they do not tell you where. A drop in task success could be retrieval, window composition, utilization, the model, or the prompt. Per-dimension context evaluation pinpoints the layer.

Should retrieval be evaluated by an LLM judge or by classical IR metrics?
Both. Classical metrics (recall, precision, MRR) score the retrieval system. An LLM judge can score the relevance of each retrieved chunk to the query when ground-truth relevance labels are sparse. Use the classical metric where you can; use the judge where the labels are not feasible.

How do I know if my context window is saturated?
Two signals: the proportion of the model's effective attention budget the prompt is consuming, and the degradation of the model's performance as more context is added. A small adversarial test (same query, more padding) surfaces the saturation point empirically.

What does "refusal under insufficient context" actually measure?
Of the cases where the supplied context does not support a correct answer, the fraction in which the model declines or signals uncertainty rather than fabricates. A score below 0.5 is a strong signal that the model is filling gaps from training data.

How does this relate to RAG evaluation?
Context evaluation is the broader practice; RAG evaluation is the special case where the context comes from a retrieval-augmented pipeline. Tool responses, conversation memory, and system instructions are all context too. The dimensions are the same.