IN THIS BREAKDOWN · 10 SECTIONS
You can read 20% of this breakdown.
The paper in one minute
An agent working through a long task keeps every action and tool output in its context. On AppWorld, a benchmark of everyday app tasks that average over 40 API calls each, that context grows until it is expensive to process and full of stale detail. The obvious fixes are crude: keep only the last few steps, or ask a model to summarize. Both lose things like a file path or an account ID that a later step needs.
ACON (Agent Context Optimization) compresses two things: the history, when it passes a token threshold, and individual observations, when a tool returns something long. A compressor LLM does both, following a natural-language guideline.
The contribution is how the guideline is improved. ACON runs the agent on training tasks with and without compression and collects the tasks that succeed only without it. For each, a strong model (o3) compares the full and compressed contexts and writes feedback about what was lost: a variable, a precondition, a fact. That feedback is aggregated into a rewritten guideline, and several candidates are scored on the same tasks. This is the utility step. A second compression step looks at tasks that succeed with compression and asks what information was actually used, producing a shorter guideline.
Finally, the expensive compressor is distilled: a small model (Qwen3-14B, Qwen3-8B or Phi-4) is fine-tuned on the teacher's compressions, cutting the compressor's cost per example from $0.045 to $0.0004.
On AppWorld with gpt-4.1, ACON matched the uncompressed accuracy at 26% fewer peak tokens; on multi-objective QA, peak tokens fell 54%.
Research notes: the problem, approach and results
AppWorld accuracy with ACON history compression against no compression, at 26% lower peak tokens
compression cost per example with a distilled Qwen3-14B, against $0.045 with gpt-4.1
median AppWorld latency per task without compression and with history compression
Long-horizon agents accumulate history and verbose tool outputs until the context is expensive and the model is distracted by stale details. Generic summarization or keeping the last few steps loses the one file path or ID a later step needs, and fine-tuning the agent to compress is impossible with API models.
Compress history past a token threshold and long observations past another, with an LLM following a written guideline. Optimize the guideline in natural language: collect tasks that succeed uncompressed but fail compressed, have a strong model contrast the two contexts and rewrite the guideline (utility step), then shorten it using what successful compressed runs actually used (compression step). Distill the result into a small compressor.
On AppWorld with gpt-4.1, history compression matched uncompressed accuracy (56.5% vs 56.0%) at 26% lower peak tokens, beating naive summarization (43.5%). Peak-token savings reached 54% on multi-objective QA. Distilled compressors kept over 95% of the teacher's accuracy, and small agents improved 20% to 46%. Steps per task rose 41% and latency 20%.
Why it matters to an FDE
Every long-running agent you deploy will eventually hit its context limit or its budget. ACON is a practical template for compressing context without retraining the agent, and it works with API models.
Learn the guideline from failures. The useful part is the procedure, not a particular prompt: run tasks with and without compression, look at the ones compression broke, and write down what the compressor dropped. For a customer's workflow that might be "always keep ticket IDs, the customer's plan tier and any error code". Two or three rounds of this beat a generic "summarize the conversation".
Compress observations, not just history. Tool outputs are often the bulk: a 3,000-token API response where the agent needs four fields. Extracting what matters at arrival keeps the context small from the start.
Use a small compressor. A distilled 14B model did the job at about a hundredth of the cost of gpt-4.1, keeping over 95% of its accuracy.
Know the price. Compression saved money per task ($0.331 to $0.285 on AppWorld) but the agent took more steps (16.1 to 22.8) and longer (73 to 88 seconds median), because every compression is an extra model call and rewriting history invalidates the cached prefix. For latency-sensitive tasks, compress observations and leave history alone; for cost-sensitive batch work, compress both.
Understand the mechanism. Try it on a real problem.
Unlock this breakdown and 149 more papers.
Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.
6 months · One payment · No auto-renewal
- ◇1 architecture diagram
- </>1 runnable code experiment
- ▦2 results tables
- ?5 interview questions with answers
- 03Key takeaways
The thresholds, the two optimization steps, distillation, the results and three misreadings
Free account - 04How it works
The compression calls, the optimization loop, the objective and the distillation step
Premium - 05The numbers that matter
Results on three benchmarks, distillation, small agents, cost, latency and thresholds
Premium - 06Try it yourself
Recompute the trade-offs, run the optimization loop in miniature, and watch summaries compound
Premium - 07Where it breaks
Steps and latency, cache invalidation, GPT-centric evaluation, distillation gaps and slips
Premium - 08Using it on a deployment
Building a compression guideline for a customer's agent from its own failures
Premium - 09Interview angles
Five questions this paper prepares you for, with answer hints
Premium - 10Read next
Where to go from here on this site
Premium
