NVIDIA study tests letting AI agents decide when to compress their own context
An NVIDIA study tests giving coding agents a tool to summarize their own conversation history, with the model choosing what to compress and when.
NVIDIA researchers tested whether a coding agent could decide for itself when to shorten its conversation history, instead of leaving that call to the runtime. In the study, the model gets a tool that summarizes its own history and picks which messages to compress and when. On OfficeQA Pro v2, a document-research benchmark, GPT-6.1 Sol's score rose from 21% to 56% with a 32K context budget. The study reports the largest gains when context was tight.
The problem comes from how agents accumulate text. Every file an agent reads and every command it runs adds to the next model request. Usually the agent runtime watches for the conversation nearing the context limit, then summarizes older messages so the agent can keep going. The timing and range of that summary are set by the runtime's code, not by the model. The example here is a test suite that prints hundreds of lines of output. The agent needs only a short record of that failed run, but without compaction the full log stays in every later request.
The change happens inside the agent loop. Alongside tools for reading files and running commands, the model gets a tool that replaces older history with a summary. In NVIDIA's NOOA harness, replaced messages are archived rather than deleted, so the agent can retrieve the full output if the summary leaves out something it needs. The summary in the example reads, "The first test run failed in test_login because the session expired." The next request carries that line in place of the log, leaving more room for the current code and the latest test results.
The researchers compared two versions of the process. In automatic compaction, the runtime summarizes when usage reaches a threshold and chooses the range to compress. In model-driven compaction, the model calls NOOA's context API, chooses the events to summarize, receives the resulting summary, and can still retrieve archived originals. The tests covered document research and machine-learning engineering tasks, with context budgets from 8K to 512K tokens. As the budget grew, the gap between the two strategies narrowed. The description of the study available here gives no scores for the machine-learning engineering tasks, so only the document-research result has figures attached.
Giving the model control does not ensure it will use that control well. Claude Opus 5.5 used the context API in only 4% of tasks. The study also found that some models summarized earlier than necessary when the researchers removed timing guidance from their instructions, so the surrounding prompt shaped how often models compacted.
For anyone building this into an agent, the tool is only one part. The model needs to know how much context remains, which messages it may replace, and how to recover the originals. The runtime must also apply the edit to the next request, since saving a summary to a notes file does not reduce context if the code keeps sending the full conversation. A practical test is to run the same model and budget with automatic and model-selected compaction, then check each run after every summary. The questions: did the summary keep the latest findings and unfinished work? Did the agent repeat a failed approach because the earlier result was gone? Could it retrieve an exact error or source passage when needed? Did the task finish correctly?
Why it matters
Teams running long agent tasks could recover accuracy within the same context budget, but only if the runtime applies the model's summaries to later requests and keeps originals retrievable.
What you can do
Compare automatic and model-selected compaction on one long-running agent task with the same model and context budget before changing your runtime.
Original source
We have no link to the original source for this story yet.
Where we saw it
AI Engineering
AI wrote this summary from the sources listed, and nobody reviewed it individually before publication. Check the original source before you rely on it. How it works