Levain LabsLevain Labs
API ReferenceRuns

Stream Run Events

Stream a run's events live as AG-UI events over SSE.

Stream a run's events live as AG-UI events over SSE.

The response is a text/event-stream of AG-UI protocol events (https://docs.ag-ui.com), so AG-UI-compatible front-end toolkits can render the run directly. Every connection is a complete AG-UI stream: it opens with RUN_STARTED (held until the run leaves pending), carries the run's timeline — TEXT_MESSAGE_START / TEXT_MESSAGE_CONTENT / TEXT_MESSAGE_END for agent messages, TOOL_CALL_* for tool activity, and CUSTOM frames for progress events — and closes with RUN_FINISHED on success or RUN_ERROR on failure or cancellation.

Timeline frames carry an SSE id (a per-session sequence number). If the connection drops, reconnect with the standard Last-Event-ID header (sent automatically by EventSource) — or the since query parameter — and the stream resumes after that event instead of replaying the whole run. since takes precedence when both are present.

Connecting to an already-finished run replays its timeline and closes; connections are capped at one hour, after which the client should reconnect and resume. Runs of managed agents stream the same reduced timeline their session surface exposes.

GET
/api/v1/runs/{run_id}/events/stream

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

run_id*Run Id
Formatuuid

Query Parameters

since?integer|null

Header Parameters

Last-Event-ID?string|null
X-API-Key?string|null

Response Body

text/event-stream

application/json

curl -X GET "https://api.levainlabs.com/api/v1/runs/497f6eca-6276-4993-bfeb-53cbbbba6f08/events/stream"
"string"
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}