BMA serves the Anthropic Managed Agents API under /v1: agents, environments, sessions and events, with the same paths, request headers and event stream as the official SDKs. This guide uses plain curl, or the official Anthropic SDK for Python or TypeScript with base_url pointed at BMA. You create an agent and an environment, start a session, read what the agent does as a stream of events, and send a second message.

Before you start

You need the values from the introduction:
and the name of a model configured in your project. The examples use deepseek-flash; ask the BMA team which names are configured.
1

Install the SDK

The examples were run against the official anthropic 2.6.0 (Python) and @anthropic-ai/sdk 1.6.0 (TypeScript). The TypeScript examples are ES modules: run them with a TypeScript runner such as tsx.
2

Create a client

The SDK sends the key as x-api-key, adds anthropic-version and the Managed Agents anthropic-beta header, and appends /v1 to the base URL. x-bma-project-id selects the project; it is optional when the key sees only one.
3

Create an agent and an environment

An agent is the model, the instructions and the tools. An environment describes the machines its sessions run on. Neither starts anything: a machine is created when a session first needs one. See Agents and Environments.
4

Start a session

A session is one conversation of an agent in an environment. Its event log is durable: it survives machine loss and reconnects. See Sessions & events.
5

Send a message and stream the reply

Every step of the agent is an event: agent.message carries the model’s text, agent.tool_use and agent.tool_result the tool calls, and session.status_idle ends the turn. The stream delivers events emitted after it opens, so open it first, then send.
The agent’s machine is created on its first tool call, so the first turn waits for the sandbox to start. Machines are described in Machines.If the connection drops, reconnect with the Last-Event-ID header. Every durable event carries bma_sequence; send the last one you processed (Last-Event-ID: 3), or the id of the last SSE frame, and the stream continues after it. Last-Event-ID: 0 replays the whole session.
6

Send a follow-up

The session keeps the conversation: send another message the same way.
7

Read the history and clean up

The event log is durable: list it any time. Archiving the session ends it and releases its machine; its history stays readable. Archive the agent and the environment when you are done.

Next steps

Sessions & events

Event types, listing, resuming a stream

Machines

When machines start, pause, and get rebuilt

Desktop & computer use

Watch a desktop, take over, attach a terminal

SDKs

The official SDKs, the BMA extensions and when you need bma-executor-sdk