A session pins its configuration when it is created (agent definition, model, environment, memory) and keeps an append-only event log. You drive it by sending events and observe it by reading events.

Session status

Status is computed per session; sibling sessions of the same agent never leak into it.

Sending events

POST /v1/sessions with Idempotency-Key is replay-safe: the same key returns the same session.

Events you receive

Streaming and resuming

GET /v1/sessions/{id}/events/stream is a server-sent event stream.
  • Without Last-Event-ID, the stream delivers events emitted after it opens. Open it before you send, or rely on BMA’s rule that a stream opened during a running turn starts at that turn’s input.
  • Every durable event carries bma_sequence. Store the last value you processed and reconnect with Last-Event-ID: <bma_sequence>. A browser EventSource sends back the opaque SSE id automatically; BMA accepts both. Last-Event-ID: 0 replays the whole session.
  • History: GET /v1/sessions/{id}/events pages with limit/page and filters by types[]. If the last page ends with an open permission request, BMA appends the same requires_action idle event the stream announced, so a restarted worker knows it must answer.

Turns and the native API

In the native API (/api/v1) a session is an agent session under an agent (/agents/{agentID}/sessions/{sessionID}). Inputs are POST /agents/{agentID}/inputs?session_id=…, events are GET …/events and …/events/stream with session_id, and turns can be listed with GET …/turns. The native stream uses its own frame types (agent_event, tool_call_update, model_output_delta, error); bma-sdk parses them.