Stream Run (SSE)
Track
Stream Run
Opens a Server-Sent Events (SSE) stream for real-time execution progress.
This is an alternative to polling GET /v1/runs/{runId} — use
whichever fits your architecture better.
Connection: The stream uses standard SSE (text/event-stream). Most HTTP
clients and all modern browsers support this natively.
Event types:
| Event | When | Data payload |
|---|---|---|
progress | Execution status changes (e.g. queued -> running) | Full ExecutionStatus object |
complete | All outputs are ready | Full ExecutionStatus with final values |
error | Execution failed or was cancelled | Full ExecutionStatus with error details |
timeout | Stream exceeded 10-minute limit | { "message": "Stream timeout after 10 minutes" } |
ping | Keepalive every ~15 seconds | Unix timestamp |
Terminal behavior:
- If the execution is already in a terminal state (
completed,failed,cancelled) when you connect, the stream sends a singlecompleteorerrorevent and closes. - Otherwise, the stream stays open and polls internally every 2 seconds.
- The stream automatically closes after 10 minutes with a
timeoutevent.
Agent usage pattern:
const es = new EventSource('/v1/runs/{id}/stream', {
headers: { 'x-api-key': 'lma_...' }
});
es.addEventListener('complete', (e) => {
const result = JSON.parse(e.data);
// result.outputs contains final values
es.close();
});
es.addEventListener('error', (e) => {
const result = JSON.parse(e.data);
console.error(result.errorMessage);
es.close();
});
GET
Stream Run (SSE)
Opens a Server-Sent Events (SSE) stream for real-time execution progress.
Use this instead of polling when you need instant updates — for example, to drive a progress bar, stream partial outputs to a UI, or feed status changes into an agent loop. The connection stays open until the execution reaches
completed or failed.
Each SSE event contains the current execution state, including per-node output status. The final event carries the full completed (or failed) execution payload, after which the server closes the stream.Authorizations
Workspace API key. Prefix: lma_. Example: lma_abc123...
Path Parameters
The run ID returned from the Run App or Content Create endpoint
Response
SSE event stream. Each event is a data: line followed by two newlines.
The response is of type string.