Claude API adds on-demand context compaction to the Messages API
Anthropic has added on-demand context compaction to the Claude Messages API, letting developers shrink a long conversation into a signed summary block without losing the ability to keep recent turns intact.
What's new
The feature ships in beta behind the compact-2026-09-04 beta header. Developers send a top-level compaction parameter, and the API returns a signed compaction block that summarizes the messages sent so far. On later requests, that block is sent first, in place of the original messages, effectively replacing a long history with a compressed stand-in. Anthropic says the compaction call can run in the background, developers choose when to trigger it rather than having it happen automatically, and recent turns can be preserved word-for-word after the summary point rather than being folded into it. For models that support preserved thinking, the thinking blocks inside those preserved recent turns remain valid after compaction.
This shipped alongside a separate update to Claude Managed Agents on September 10: permission policies now support an auto mode where the server itself evaluates each agent or MCP tool call and decides to run it, deny it, or pause for approval, with the evaluation outcome reported back in agent.tool_use and agent.mcp_tool_use events. The ant CLI also picked up ant beta:sessions connect, which attaches a terminal to a live Managed Agents session so a developer can watch it run, send messages, and approve or deny paused tool calls, including a --web flag to serve the Console's session viewer locally.
Context
Context-window management has become one of the practical bottlenecks in long-running agentic workflows — the kind of extended, tool-heavy sessions Claude Code and Claude Managed Agents are built around. Anthropic's own September blog post on scaling its CI systems described Claude-driven code volume growing 25x in six months, the same order of workload that makes long-running conversations expensive to keep verbatim in context. Signed, developer-triggered compaction is a direct response to that: it gives applications a way to compress history without silently losing information the way naive truncation would.
The feature also lands as Anthropic keeps building out operator-facing controls for Managed Agents — permission auto-evaluation and live session attachment both point toward the same goal of letting a human supervise a fleet of long-running agents without babysitting every tool call individually.
Why it matters
For teams building on Claude, unbounded context growth is a real cost and reliability problem in production agents — every additional turn adds latency and token spend, and blunt truncation risks losing decisions or constraints made earlier in a session. A signed compaction primitive that the developer controls, rather than an opaque server-side summarization, gives builders a predictable lever to manage that tradeoff. Paired with the auto permission mode and live session attachment, it signals Anthropic is treating long-horizon, semi-autonomous agent sessions as a first-class API use case rather than an edge case bolted onto a chat interface.
Corroborating sources
- Platform.claude
https://platform.claude.com/docs/en/release-notes/api
“The Messages API can now compact a conversation on demand on the Claude API, in beta with the `compact-2026-09-04` beta header.”