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 early-access 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. - In the native API: a model output with
stop_reason: "error"whose error block carriesmetadata.bma_error_code = "context_too_large"andmetadata.bma_user_notice.
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.