Writing ·

How to evaluate context compression for a tool-using AI agent in 2026

Compare a compressed run with a matched full-context baseline, then measure accepted completion, retrieval and execution work, latency, and cost separately before widening the policy.

By Youssef Hemimy · agent evaluation · agent reliability · AgentOps

Evaluate context compression against a matched full-context baseline, measuring completion, retrieval work, execution work, latency, and cost separately. If compressed runs complete at the same rate but repeatedly re-fetch omitted state, the policy has moved work rather than proved it removed cost.

24
turns in the cited planning environment
3
models in the bounded experiment
2
task regimes compared
6
model-regime retrieval comparisons

Treat compression as a policy change, not a token setting

A shorter context is not an operating result. The release question is whether the agent still finishes acceptable work within its budget—and whether it paid for that result by re-acquiring state it previously had. Hold the task suite, acceptance rule, tool permissions, model configuration, and budget policy steady across the comparison.

The cited paper varied compression severity, compared dropping and fact-preserving operators, used restoration interventions, and separated retrieval calls from execution calls. It reported retrieval-call increases in all six model-regime comparisons, even where its completion comparison did not detect a significant change. That is evidence for what to measure, not proof that every compressed agent will behave the same way.

A matched baseline separates acceptance from the work required to achieve it; a restoration control can test whether omitted state explains extra retrieval.

Measure the work completion can conceal

MeasureDecision it supports
Accepted completion and failure modeDid the workflow still deliver the intended result?
Retrieval or re-acquisition operationsIs missing state causing extra search, lookup, or inspection work?
Execution callsDid task work change, rather than only the path used to find context?
End-to-end latency and deadline missesDid an apparently successful run become too slow for its service contract?
Token and tool costDid the policy reduce total cost or shift it between model and tool layers?

The preprint’s sharpest example is deliberately narrow: at its prespecified 5× comparison point, its GPT-5.5 condition changed from 80% to 85% completion while retrieval increased from 21.0 to 63.9 calls. The result is not a forecast for another model or workflow. It does show why a stable completion figure cannot, by itself, rule out a material process-cost difference.

Use restoration to test the suspected missing state

If a compressed run makes extra retrieval calls, ask whether it needed information the policy discarded or whether another part of the workflow changed. Where it is safe and feasible, restore a candidate piece of omitted state for a controlled run. If the extra retrieval falls while task configuration remains matched, the team has stronger evidence that the state was load-bearing.

The paper’s intervention supports this diagnostic framing: replacing retained execution-relevant state with semantically irrelevant content raised retrieval by 57% without a significant completion change in its controlled environment. That is not a mandate to retain every detail. It is a reason to test whether material omitted by your policy is needed later.

Instrument retrieval and execution as distinct events

The exact event names depend on the runtime. The important part is that the distinction survives aggregation by release, policy version, task class, and outcome. The OpenAI Agents SDK, for example, documents tracing for LLM generations, tool calls, handoffs, guardrails, and custom events; it also notes that generation and function spans can capture potentially sensitive inputs and outputs.

run_id, release, compression_policy, task_class, outcome
event_kind: retrieve | execute | fallback | escalate
source_of_state, latency_ms, token_cost, tool_cost
context_revision, policy_decision

This is a pattern, not a prescribed schema. Keep payloads out of broad metrics where they do not belong, and decide trace retention deliberately. The evaluation needs enough linkage to explain a result; it does not need an indiscriminate transcript of everything the agent saw.

Make the rollout decision on two axes

OutcomeRelease decision
Completion stable; retrieval, latency, and cost stay within the declared envelopeCandidate for a limited rollout.
Completion stable; retrieval or cost rises materiallyHold rollout; inspect omitted state and add a restoration or alternate-policy comparison.
Completion drops or escalation risesReject or narrow the policy until the failure mode is explained.
Results differ by task classScope the policy to the evaluated class; do not generalize it system-wide.

The last row matters: the paper’s separate ALFWorld probe did not show the same retrieval surge. A compression policy should earn a wider scope through representative evaluation, not through a neat aggregate average.

What to build next

Start with a matched report for one compression policy and one high-value task class. Use agent reliability SLOs to define the accepted-output, deadline, and cost envelope, and an agent observability dashboard to keep retrieval, execution, retries, and cost visible together.

Keep runtime compression distinct from the governed lifecycle in agent experience memory. Then apply the independent release check in agent verify–repair stopping rules before treating a policy result as a rollout decision.

Sources

FAQ

Is task completion enough to validate context compression?

No. Completion establishes whether the intended result was accepted; it does not show the retrieval, latency, or cost required to get there. Compare those process measures with a matched full-context baseline.

Does every compression policy increase retrieval cost?

No. The cited arXiv preprint reports an environment-dependent result: its separate ALFWorld probe did not show the same retrieval surge. Evaluate the policy in the workflow and task classes you actually operate.

What is a restoration control?

It is a controlled run that makes a candidate piece of omitted state available again while holding the rest of the comparison steady. It helps test whether that omission plausibly caused observed re-acquisition work.

Should traces include all agent context to evaluate compression?

Not necessarily. Record the policy, event relationships, costs, and outcome needed to explain the decision, then set payload capture and retention deliberately. The OpenAI Agents SDK documentation notes that generation and function spans can capture potentially sensitive data.

Building something that has to hold up?

We do this work for teams — agent reliability hardening, custom MCP servers, and full-stack AI systems built to survive production.