Logs & Streaming
Agent SSE Stream
Subscribe to the raw SSE event stream for a specific agent run by runId. Replays buffered events and streams new ones in real-time.
GET
This endpoint provides the raw SSE stream for a specific agent run. It replays all buffered events from the start of the run and then streams new events as they arrive. The stream closes automatically when the run finishes or the client disconnects.
Events are emitted with the same
type contract for both agent runtimes (Claude and Codex). See the full event table.Authentication
To use this API, you need a BLACKBOX API Key. Follow these steps to get your API key:- Go to app.blackbox.ai/agent-api and click Get an API Key (requires a Pro subscription)
- Once provisioning completes, you will be redirected to your Dashboard
- From the Dashboard, create an API key to use with all Agent API requests
sk-xxxxxxxxxxxxxxxxxxxxxx
Headers
API Key of the form
Bearer <api_key>.Example: Bearer sk_b41b647ffbfed27f616560Query Parameters
The unique run identifier returned when the task was created.Example:
runId=a1b2c3d4-e5f6-7890-abcd-ef1234567890Response Format
ReturnsContent-Type: text/event-stream. Each event is a JSON object on a data: line:
Event Types
Sent immediately on connection. Confirms the stream is live.Fields:
type, runIdSent when the agent run begins executing.Fields:
type, runId, startedAtBeginning of a new text block.Fields:
type, idIncremental text chunk from the agent.Fields:
type, id, deltaAgent started a tool call.Fields:
type, toolCallId, toolNameTool call input is ready.Fields:
type, toolCallId, toolName, inputTool call result is available.Fields:
type, toolCallId, toolName, outputFiles produced by the task.Fields:
type, filesRun completed. Stream closes after this event.Fields:
type, runId, statusRun failed. Stream closes after this event.Fields:
type, errorTextError Codes
| Status Code | Error | Description |
|---|---|---|
| 200 | Success | SSE stream established |
| 400 | Bad Request | Missing runId query parameter |
| 401 | Unauthorized | Invalid or missing API key |
| 409 | Conflict | Run is not in a streamable state (not found or no buffer) |