An executor that runs its own model loop serves the agent capability: BMA sends natural-language turns (turn.start, turn.input, turn.cancel), the executor streams Managed Agents events back and can ask for approvals (interaction.request). The SDK owns the wire: event ids and sequences, acknowledgement and resend after a reconnect, and the session.status_running / session.status_idle events that frame each turn. The harness end has typed methods for the same messages.
Generated from bma-executor-sdk 1.3.0 and its contract (contracts/bma/executor, protocol bma.executor.v1.1). Install, credentials and quick starts are on the bma-executor-sdk overview; the protocol itself is described in Executor Protocol.

serveAgent

Advertises the agent capability (models, thinking levels, permission modes) and routes turn.*, session.close and interaction.response to your handler; call it before start.

AgentHandler

Your agent: openTurn accepts or rejects turn.start, runTurn runs the model loop with the turn handle, closeSession releases a conversation.

Turn identity

The session id, turn id and turn.start params of the running turn.

inputs

Delivers turn.input messages in arrival order while the turn runs.

emit

Queues one durable event and returns its event id; delivery is asynchronous, ordered and at-least-once, and the platform deduplicates by event id.

delta

Streams a transient preview (session.event_delta) of a durable event; best-effort, dropped while disconnected and never resent.

flush

Waits until every event emitted so far is acknowledged.

requestInteraction

Sends interaction.request (an approval or a question) and waits for interaction.response; it flushes first, and on expiry it withdraws the interaction and returns outcome expired, which the agent must treat as a deny.

cancelInteraction

Withdraws an open interaction with interaction.cancel, for example after the user answered it in a local UI.

requestCustomTool

Emits agent.custom_tool_use for a tool the user’s application runs (capability custom_tools) and waits for agent.custom_tool_result; returns the call’s event id (the tool_use_id) with the result. The turn stays open while it waits. When the wait is canceled first, a later result answers accepted=false; to give up on a call, emit a failed agent.tool_result naming the id.

RefreshModelToken (turn)

Fresh model credential for this turn (Client.RefreshModelToken with the turn’s session and turn id).

agentCapability (harness)

The agent capability an executor advertised, or none.

startTurn (harness)

Sends turn.start; safe to repeat with the same turn_id after a timeout or reconnect.

sendTurnInput (harness)

Sends turn.input; a conflict means the turn is over and the input belongs in a new turn.start.

cancelTurn (harness)

Sends turn.cancel; the turn’s end is still reported by its session.status_idle event.

respondInteraction (harness)

Delivers the platform’s answer with interaction.response; accepted=false means the executor no longer waits for it.

respondCustomToolResult (harness)

Delivers the user’s result for an agent.custom_tool_use; accepted=false means the executor no longer waits for it (unknown id, answered already, timed out or canceled with its turn): mark the platform’s copy stale and do not send it again.

closeAgentSession (harness)

Sends session.close for an agent conversation.

AgentPlatform (harness)

The platform half of the agent capability, where a harness stores durable agent events, previews and interactions; BMA implements it on its session event log.