/v1) with the official Anthropic SDKs. If you already use Claude Managed Agents, change the base URL, the API key and the project header; BMA serves a subset of that API, listed on the compatibility page.
Before you start
You need the three values from the introduction:deepseek-flash; replace it with yours.
1
Install the SDK
anthropic 2.4.0 (Python), @anthropic-ai/sdk 1.4.0 (TypeScript) and anthropic-sdk-go v1.84.0.2
Create a client
Point the client at your BMA origin and select the project with the
x-bma-project-id header. anthropic-version and anthropic-beta headers are accepted but not required.3
Create an agent
An agent is a reusable definition: model, system prompt and tools. This one may run
bash without asking for approval.4
Create an environment
An environment describes where the agent’s machines come from. BMA creates it as a machine pool; no machine starts until a session needs one.
5
Start a session
A session is one conversation with the agent, running in the environment.
6
Send a message and stream the events
Open the event stream first, then send the message, and read until the session goes idle. The first tool call that needs a machine creates it, so expect a short wait before the first You will see
bash result.session.status_running, an agent.tool_use for bash, its agent.tool_result, the agent.message with the answer, and session.status_idle.7
Read the history and clean up
The event log is durable: list it any time, and send another Archiving an agent in BMA deletes its definition: a later
user.message to continue the same conversation.GET /v1/agents/{id} returns 404. See compatibility.Next steps
Sessions & events
Event types, resuming a stream, idle and
requires_actionApprovals & questions
Use
always_ask and answer tool confirmationsMachines
When machines start, pause, and get rebuilt
SDKs
When you need bma-sdk or bma-executor-sdk