Logs & Streaming
Stream Task Logs
Stream task execution logs in real-time using Server-Sent Events (SSE). Live runs stream from the in-memory buffer; completed runs replay from persisted message parts.
GET
This endpoint provides a real-time SSE stream of task execution events. For live tasks it subscribes to the in-memory event buffer and pushes events as they arrive. For completed tasks it replays all persisted events in a single burst and closes the stream.
The event
type values are the same regardless of agent runtime — Claude and Codex tasks emit an identical contract (session-init, text-delta, tool-call-start, tool-input-available, tool-output-available, result, …). 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_b41b647ffbfed27f616560Path Parameters
The unique run identifier returned when the task was created.Example:
a1b2c3d4-e5f6-7890-abcd-ef1234567890Query Parameters
Whether to include
text-delta events (individual text chunks). Set to false for a cleaner stream with only structural events.Default: trueResponse Format
The endpoint returnsContent-Type: text/event-stream. Each event is a JSON object on a data: line:
Event Types
Beginning of a new text block from the agent.Fields:
id — message identifierIncremental text chunk from the agent.Fields:
id, delta — text chunk stringAgent started a tool call.Fields:
toolCallId, toolNameTool call input is ready.Fields:
toolCallId, toolName, input — tool input objectTool call result is available.Fields:
toolCallId, toolName, output — tool output objectFiles produced by the task.Fields:
files — array of file objectsTask completed (stream closes after this).Fields:
runId, statusTask failed (stream closes after this).Fields:
errorTextError Codes
| Status Code | Error | Description |
|---|---|---|
| 200 | Success | SSE stream established |
| 401 | Unauthorized | Invalid or missing API key |
| 403 | Forbidden | Task belongs to a different user |
| 404 | Not Found | Task not found |
| 409 | Conflict | No logs available to stream |
| 500 | Internal Server Error | Failed to start stream |