start.
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.Create a client
Validates the options and returns a disconnected client; the long-lived credential (environment key or machine token) is only sent to the token endpoint.Client options
Base URL, credential, executor identity, capabilities, reconnect and tool-result retry budgets, and the hook that receives a tool result every retry failed to deliver.start
Fetches an executor token, connects, sendsexecutor.register and starts heartbeats. After a failed start the client may be started again.
stop
Sendsexecutor.close, closes the connection and fails pending calls.
Done / Err / waitClosed
Report when the client stops for good (stop,executor.close, a terminal close code such as 4004 replaced, a rejected credential, or exhausted reconnects). In Go, Done closes and Err explains why; in Python and TypeScript, wait_closed() / waitClosed() return after a stop and raise on any other end, so the process can exit and a supervisor restart it.
WaitReady / waitReady / wait_ready
Wait until the executor is registered and the registration stayed open for one heartbeat interval. The state turns ready as soon asexecutor.register returns, which a refused registration also does (a machine-scoped executor that declares neither the process nor the agent capability is closed with 4002 right after), so only this wait separates a usable executor from one about to be refused. It returns the error of a client that ended, and fails on timeout.
state
The current connection state.executorId / connectionId / protocol
The executor id assigned byexecutor.register, the current connection id and the negotiated subprotocol.
activeSessions
The sessions currently assigned to this executor.sessionContext / sessionContextById
Read the session a process or session id belongs to, with its metadata, over the machine token of a machine-scoped executor (no environment id). Answers are cached per session; a missing session and a client that is not machine-scoped are distinct errors.RefreshModelToken
Asks the platform for a fresh model credential for a running turn (model_token.refresh): call it before the turn.start model_token expires. One attempt, the caller owns retry and backoff; an ended turn answers turn_inactive, a platform that issues this machine no model token answers forbidden or model_token_unavailable.
onSessionAssign
Registers thesession.assign handler, which prepares the workspace and MCP servers of a new session.
onSessionStop
Registers thesession.stop handler; stop the session’s processes and MCP servers before answering.
onDrain
Registers theexecutor.drain handler; a draining executor accepts no new sessions.
OnToolCallAccept
Go only: a check run before atool.call is acknowledged; an error answers the request (an *RPCError keeps its code) and the tool does not run.
sessionReady
Reportssession.ready after workspace and MCP setup complete; only your code knows when that is.
sessionEnded
Reportssession.ended once every process and MCP server of the session has stopped; the session then leaves the active sessions.
reportToolResult
Sendstool.result once per tool_call_id, retrying executor_busy, timeout and disconnects with backoff across reconnects. Tool handlers call it for you; use it for results you produce yourself.
UploadArtifact
Go only: uploads an artifact with the current executor token (POST /v1/executors/artifacts, idempotent by session and digest); finish it before a tool.result references the artifact.
openMcpChannel
Opens the MCP channel of one environment-owned MCP server fromsession.assign.mcp_servers; frames are raw MCP JSON-RPC.
updateCapabilities
TypeScript: publishes changed capabilities withexecutor.capabilities.update. Registering a tool handler after start does this in every language.
onRequest
Serves one harness-to-executor capability request (process.*, terminal.*, skill.install, workspace.backup); see Process, terminal & machine.
call / notify
Sends a typed executor-to-harness request or notification (for examplesession.event, tool.progress); see Protocol methods.
sessionEvent / sessionStatus / toolProgress
TypeScript shortcuts forsession.event, session.status and tool.progress; the other languages use call / notify with the method.
serveAgent
Advertises theagent capability and routes the agent methods to your handler; call it before start. See Agent.