An agent that runs for a long time accumulates history, and every token of that history is re-sent on each model call. Cost per turn rises with the length of the conversation instead of the difficulty of the question.
Compaction decides what the agent carries forward. Recent turns stay verbatim and older material is summarised, with the detail behind the summary still retrievable from the journal.
A model call is priced on the tokens it receives. An agent that appends every turn to its context sends the whole conversation again on each call, so the tenth turn costs several times the first even when the question is simpler.
The naive fixes both lose something. Truncating the oldest turns discards facts the agent needs later. Raising the context window pays for the growth instead of stopping it, and the growth continues.
Short interactions hide this entirely. A three-turn exchange never accumulates enough history for the growth to show, which is why the problem appears after a prototype becomes a product.
An agent that holds a customer relationship over weeks needs its cost per turn to stay flat. Compaction plus durable state keeps the recall while the token count stops tracking the length of the history.
Facts extracted into durable state stay available without being re-sent. The agent reads them from state, and the model receives them only when they matter to the current turn.
A summary carries less than the original, which is why recent turns stay verbatim and the full record stays in the journal. What the model receives is a working set, and the evidence record is complete.
The journal holds every event, so the detail behind a summary is retrievable when the agent or a person needs it.
The saving scales with conversation length. Swiggy reduced token consumption by 22% alongside its latency work, and the figure depends on how much history a given agent carries.