What BMA does, in order
- Compact older history into a summary checkpoint when the estimated input exceeds the budget left after the output and safety reserves.
- Clear the content of older tool results (the call, its input and its outcome stay).
- Drop the oldest assistant steps.
context_window_tokens from the model configuration (overridable per agent config) together with default_max_output_tokens. A long research task on the hosted deployment compacted several times and finished normally; compaction is not visible as an event on the /v1 stream.
When it still does not fit
The turn ends cleanly instead of failing silently:- On the
/v1stream: anagent.messagewith a short readable notice, asession.errorwitherror.code = "context_too_large"(error.typeanderror.messageare the usual Anthropic values), thensession.status_idle.
Scope
Compaction is a feature of the BMA server harness. External brains connected through the agent capability manage their own context;context_too_large is only produced by the server harness.