AIOpsSRE

Practical AI operations. Reliable systems.

Search articles/
News

Claude adds on-demand compaction for long-running agents

The Messages API can now summarize conversation history when an application chooses. SRE teams should test which operational constraints survive.

Nate Reuck3 min read

References & context
Conceptual still life of a thick paper stack, a compact set of index cards and separately preserved recent pages.
Conceptual editorial illustration.
In this article

Compaction should preserve the state that justifies the next action. The agent execution contract still applies after the conversation becomes shorter: an approval for a particular target and condition cannot expand because the summary omitted the condition. Judge the summary at that boundary before treating context savings as an operational improvement.

Anthropic added on-demand conversation compaction on September 14. The Claude API beta uses the compact-2026-09-04 header and a top-level compaction parameter. It returns a signed summary block that the application can place before subsequent messages, replacing the history it summarizes.

The operational question is what the agent still knows after that substitution. A shorter conversation is useful only if it preserves the constraints needed for the next decision.

Use a constraint-preservation case, including rejected options and conditional approvals, as an acceptance test for compaction in any workflow capable of changing shared state.

Retaining every message indefinitely is neither necessary nor always permissible. Keep the audit evidence your policy requires, and test decision-relevant preservation rather than verbatim recall.

Applications can choose the handoff point

Anthropic’s compaction overview distinguishes application-triggered summarization from compaction triggered inside a request at a token threshold. On-demand compaction can run in the background and retain recent exchanges verbatim. The documentation also makes preserved-thinking behavior conditional; teams should check compatibility for their chosen model and platform.

For an incident workflow, this gives the application a useful scheduling choice. It could request a summary after completing a bounded investigation, when evidence and outstanding questions can be reviewed together. That is an editorial application of the capability, not a built-in incident-management feature.

Keep history, summary and current state distinct: Older conversation, Retain an original record; Signed summary, Replace summarized messages; Recent turns, Keep selected exchanges intact.
Application controls must still enforce permissions and verify external state.

Test the detail that changes the action

Consider a hypothetical approval to restart a worker only after its queue is drained. Compaction retains “restart approved” but drops the drain requirement. The execution layer should reject the restart using current queue state. If conversational memory is the only place the requirement exists, the workflow has converted a summarization error into additional authority.

The pass condition should include retaining the protected replica and the reason for its protection. Fluency, summary length and token reduction cannot establish that. Add a second case in which an earlier diagnosis was disproved: the summary must not restore the rejected hypothesis as an accepted fact.

Keep authorization in application controls as well as conversational context. A summary can inform a proposed action; the execution layer should still check whether the target and operation are permitted. Our guide to operational agent skills develops that separation.

Make the state change recoverable

Before enabling automatic replacement, retain the original conversation according to your data policy and record which history a summary covers. If work continues while summarization runs, the application must avoid discarding newer exchanges when it installs the result. Treat that boundary as a state transition worth inspecting.

A proposed pilot should compare completed investigations, missed constraints and total model usage with compaction enabled and disabled on the same cases. Include the summarization work in cost accounting. Lower active-context size does not by itself establish lower total cost or better decisions; AI token usage explains the surrounding tradeoffs.

If no usable summary arrives, preserve the existing history and follow a defined pause or retry policy. If the summary loses a critical condition, stop the pilot and revise the summarization strategy before expanding it. Restoring conversation history cannot reverse an external action already taken.

This beta gives teams more control over when an agent condenses its working record. The worthwhile acceptance criterion is whether the next action remains justified by the evidence and limits established before compaction.

References & context

External references linked in this article. Inclusion is not independent verification of their claims.

Report an error or outdated detail