Methods that bind BMA sessions to an executor or brain, drive natural-language agent turns (turn.start, turn.input, turn.cancel), stream durable events and previews (session.event, session.event_delta), read/append the working log, compact context and refresh short-lived model or platform-tools tokens.

Methods overview

session.assign

Direction: Platform → Executor · Kind: request · Since: bma.executor.v1 Harness to executor request. The executor rejects a session that exceeds its capability or resource limits with -32009. metadata.source “harness” marks a long-lived harness session; any other source is one-shot and ends after its tool call.

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

session.ready

Direction: Executor → Platform · Kind: request · Since: bma.executor.v1 Executor to harness request after session.assign is accepted.

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

session.event

Direction: Executor → Platform · Kind: request · Since: bma.executor.v1 · Idempotent by: jsonrpc_id Executor to harness request for durable session events. A tool executor’s event is idempotent by its JSON-RPC id. An agent executor (capability agent) also sends turn_id, event_id and sequence; the harness deduplicates by (session_id, event_id), accepts a sequence at or below acked_sequence as a duplicate, and rejects a gap with -32013 conflict (data.expected_sequence). An agent event matches schemas/agent.json AgentEvent. The JSON-RPC response is the ACK; the executor keeps every unacked event and resends them in sequence order after reconnect, before any new event. Contract 1.7.0 clarifies two rules that keep a session from stalling. A failure on the harness side that resending can fix (storage conflict or outage) is answered with data.retryable true and the executor resends the same event; only a rejection of the event itself (invalid params) is permanent, and it ends the turn; the executor sends session.error (bma_error_code event_rejected) and session.status_idle for the turn in place of the rejected event, renumbers from data.expected_sequence only so that this session.error is accepted, and never continues the turn.

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

session.status

Direction: Executor → Platform · Kind: notification · Since: bma.executor.v1 Executor to harness notification. detail carries free-form context such as tool_running or mcp_unavailable.

Parameters (Input)

Result (Output)

Notification — no JSON-RPC response frame.

Errors

Wire frame & SDK usage

session.stop

Direction: Platform → Executor · Kind: request · Since: bma.executor.v1 Harness to executor request. The executor terminates every process and MCP server of the session (SIGTERM, then SIGKILL) and then sends session.ended.

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

session.ended

Direction: Executor → Platform · Kind: request · Since: bma.executor.v1 Executor to harness request, sent after every process of the session is gone. Retried until accepted.

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

turn.start

Direction: Platform → Executor · Kind: request · Since: bma.executor.v1.1 · Capability: agent · Idempotent by: turn_id Harness to executor request (capability agent). Opens the agent session on first use (no session.assign) or continues it; executor_session_ref from an earlier TurnStartResult lets the executor resume its local conversation after a restart. The executor answers as soon as the turn is accepted and reports progress with session.event. Idempotent by turn_id. A session with a running turn answers -32013 conflict (use turn.input); a turn.start while max_sessions turns are running answers -32009 (an idle session holds no slot). A request that would serialize to more than 48 KiB carries a single input_ref block as its input (contract 1.7.0, only to an executor that declared agent.input_by_reference).

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

turn.input

Direction: Platform → Executor · Kind: request · Since: bma.executor.v1.1 · Capability: agent · Idempotent by: input_id Harness to executor request (capability agent). The local agent consumes the input at its next step (contract 1.25.0, agent.steering - at the running turn’s next step boundary, before its next model request; without it after the running prompt ends). Idempotent by input_id. When turn_id is not the running turn the executor answers -32013 conflict and the harness starts a new turn instead. A request that would serialize to more than 48 KiB carries a single input_ref block as its input (contract 1.7.0, only to an executor that declared agent.input_by_reference).

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

turn.cancel

Direction: Platform → Executor · Kind: request · Since: bma.executor.v1.1 · Capability: agent Harness to executor request (capability agent). The executor stops the agent loop, cancels its local tool calls, withdraws open interactions (interaction.cancel turn_canceled), and ends the turn with session.status_idle turn_outcome=canceled. The session stays open for the next turn.start. Unlike tool.cancel (one harness-dispatched tool call) and session.stop (a hand session and its processes), it targets only the agent turn.

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

session.compact

Direction: Platform → Executor · Kind: request · Since: bma.executor.v1.1 · Capability: agent.context_maintenance · Idempotent by: operation_id Explicit idle-session maintenance. The platform reserves the session against new inputs, pending decisions and automatic continuations before calling. The executor independently rejects an active turn, pending interactions or another maintenance operation. It keeps the original transcript, compacts an isolated durable context and atomically publishes its pointer and immutable receipt only after success. Failed or cancelled preparation preserves the old context. Unknown publication is reconciled with the same operation_id and expected version, never a fresh id. Metadata contains maintenance-only platform credentials, not a historical turn token. No tool may run during summarization. Older handlers explicitly refuse this method.

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

session.compact_cancel

Direction: Platform → Executor · Kind: request · Since: bma.executor.v1.1 · Capability: agent.context_maintenance Durably fences publication of the exact operation or returns its already-applied receipt. It never closes the conversation or cancels an ordinary turn. canceled=true means the operation cannot publish, including a late retry; settled=false means its SDK reservation still belongs to work that has not settled. The platform retains its admission barrier until settled=true, and reconciles uncertain replies by repeating this exact cancel request.

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

session.close

Direction: Platform → Executor · Kind: request · Since: bma.executor.v1.1 · Capability: agent Harness to executor request (capability agent). The executor cancels a running turn as turn.cancel does, waits until its events are acknowledged, releases the local conversation, and then sends session.ended. closed=false for an unknown session. A later turn.start with the same session_id starts a new local conversation.

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

session.event_delta

Direction: Executor → Platform · Kind: notification · Since: bma.executor.v1.1 · Capability: agent Executor to harness notification (capability agent). Transient and lossy; never acknowledged or resent. event_id is the event_id of the durable session.event that finalizes the preview. The harness relays it to subscribers as Anthropic event_start and event_delta.

Parameters (Input)

Result (Output)

Notification — no JSON-RPC response frame.

Errors

Wire frame & SDK usage

session.history

Direction: Executor → Platform · Kind: request · Since: bma.executor.v1.1 · Capability: agent Executor to harness request (capability agent, contract 1.15.0). The executor that is the session’s brain (the target the session’s turns are dispatched to) reads the session’s conversation as the platform’s event log keeps it, the single source of truth of a session: the durable events before the opening input of the given running turn, a page at a time in log order (has_more says more follow). Only the conversation travels: user.message, agent.message, agent.tool_use, agent.tool_result, agent.custom_tool_use, user.custom_tool_result, agent.mcp_tool_use and agent.mcp_tool_result, each with its bma_sequence, id, type and official body. To an executor that declared agent.input_by_reference a user.message whose body is over 48 KiB carries its content as a single input_ref block (contract 1.7.0) whose input_id is the event’s id: the inputs endpoint answers the message’s content blocks. A brain calls it when it opens a session it holds no local state for although the session has a past, for example a session whose earlier turns ran on another brain (data migration from another stack) or whose state was lost; it rebuilds its context from the events, replaying messages, tool calls and their results in its model’s format under its usual context limits, and answers the turn.start with context_rebuilt true. Only the session’s brain may read it: any other connection gets forbidden (-32001), before any turn of the session was dispatched not_dispatched (-32013, retryable); a turn that is not open is session_not_active (-32007); an unknown or deleted session is session_not_found (-32002). A harness without the method answers -32601; the brain then has no history to rebuild from.

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

model_token.refresh

Direction: Executor → Platform · Kind: request · Since: bma.executor.v1.1 · Capability: agent Executor to harness request (capability agent). A brain started by turn.start with a model credential (metadata model_token, valid 1 hour) calls it before the token expires (the reference executors do so when less than 10 minutes remain) and joins model_base_url with the new model_token for its next model calls; the old token stays valid until it expires. The platform signs a new token only while the turn is active (pending, running or rescheduling) and the turn belongs to a session routed to this executor’s machine, so a turn that ended, was canceled or failed gets no further tokens: this is how the platform revokes model access per turn (a token already issued runs out its own expiry). Each call returns a new token; calls are not idempotent and a repeat is harmless. Errors carry data.reason: turn_inactive (-32007: the turn is not active), forbidden (-32001: the session or turn is unknown, belongs to another executor, or this executor is not entitled to platform credentials), model_token_unavailable (-32012: the platform issues no such token). A harness without the method answers -32601; the executor then keeps the token it has.

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

tools_token.refresh

Direction: Executor → Platform · Kind: request · Since: bma.executor.v1.1 · Capability: agent Executor to harness request (capability agent, contract 1.4.0). A brain started by turn.start with a platform tools credential (metadata tools_mcp_token, valid 1 hour, handed over only when the session’s brain machine and hands machine differ) calls it before the token expires (the reference executors do so when less than 10 minutes remain) and uses the new tools_mcp_token with tools_mcp_url for its next tool calls; the old token stays valid until it expires or its epoch is superseded. The shape and rules are those of model_token.refresh: the platform signs a new token only while the turn is active (pending, running or rescheduling), the turn belongs to a session routed to this executor’s machine as the brain machine, and the call comes from the turn’s current epoch, so a turn that ended, was canceled or failed, or was started again in a newer epoch gets no further token for the old epoch. Each call returns a new token; calls are not idempotent and a repeat is harmless. Errors carry data.reason: turn_inactive (-32007: the turn is not active), forbidden (-32001: the session or turn is unknown, belongs to another executor, or this executor is not entitled to brain_tools), tools_token_unavailable (-32012: the platform issues no such token for this turn, for example brain and hands are one machine and the turn has no platform tools). A brain started with platform_tools_mcp_* (contract 2.4.0) refreshes that credential the same way: the result’s tools_mcp_url and tools_mcp_token are its new platform_tools_mcp_url and platform_tools_mcp_token. A harness without the method answers -32601; the executor then keeps the token it has.

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

working_log.read

Direction: Executor → Platform · Kind: request · Since: bma.executor.v1.1 · Capability: agent Executor to harness request (capability agent, contract 1.22.0, ADR-0083). The executor that is the session’s brain (the target the session’s turns are dispatched to) reads the working log it keeps on the platform: its entries after the given sequence, in order, a page at a time (has_more says that more follow), and the highest local sequence the platform has acknowledged. An executor reads it when it opens a session it holds no copy of, for example after another instance of its brain fleet ran the session’s earlier turns. Only the session’s brain may read it: any other connection gets forbidden (-32001), and before any turn of the session was dispatched not_dispatched (-32013, retryable). An unknown or deleted session is session_not_found (-32002).

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

working_log.append

Direction: Executor → Platform · Kind: request · Since: bma.executor.v1.1 · Capability: agent Executor to harness request (capability agent, contract 1.22.0, ADR-0083). The session’s brain appends entries to the working log it keeps on the platform; the answer means they are stored. An entry whose key the log already has is skipped, so a repeated append is harmless; the entries of one call are stored together or not at all, at most 500 per call. acked_sequence moves the platform’s record of the highest acknowledged local sequence up (never down, never beyond the log). The same refusals as working_log.read apply; a refused append means the executor is no longer the session’s brain and must stop the session’s turn. Invalid entries (no type, a payload that is not an object, too many) and an acked_sequence beyond the log are invalid_params with data.reason invalid_entry, batch_too_large or acked_beyond_log.

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage