Long tasks outgrow the model’s context window. The BMA server harness manages this for you; the stored event log is never changed, only the context sent to the model.

What BMA does, in order

  1. Compact older history into a summary checkpoint when the estimated input exceeds the budget left after the output and safety reserves.
  2. Clear the content of older tool results (the call, its input and its outcome stay).
  3. Drop the oldest assistant steps.
The budget is the model’s 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 /v1 stream: an agent.message with a short readable notice, a session.error with error.code = "context_too_large" (error.type and error.message are the usual Anthropic values), then session.status_idle.
  • In the native API: a model output with stop_reason: "error" whose error block carries metadata.bma_error_code = "context_too_large" and metadata.bma_user_notice.
The session stays usable: reply “continue” and the next turn runs on the cleaned-up context. Everything produced before the failure stays in the timeline.

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.