Streaming API Events and Client Handling
The inference API can stream an answer while the workflow runs. Parse complete events, update the displayed answer, and check the final run state. A closed stream does not by itself mean that the workflow succeeded.

Use the project’s generated legacy-inference input contract in input.json. With delta=false, replace displayed output with each full snapshot. Inspect the final state and error; a closed connection alone is not success.
Before you begin
A client that supports the endpoint’s documented streaming format.
Streaming concepts
Streaming
Delivery of incremental events or text while work is running. Updates are not the same as a completed answer.
Full output snapshot
With delta=false, a frame carries the latest complete output values. Replace the displayed value rather than appending it.
Completion marker
A frame with metadata.done=true marks the end of the stream. Its state and error determine the outcome; its message alone does not establish success.
Terminal state
Legacy inference uses COMPLETED, FAILED, or CANCELLED for finished runs. PAUSED needs a human response and can end the current stream without finishing the run.
Timeout
A limit on how long a particular client or operation waits. It does not always establish that execution or an external write stopped.
Consume streaming API events
Call
/inference/v0/run/{org_id}/{flow_id}from your backend withAccept: text/event-stream. Useprefix=truefor standard SSEdata:frames,verbose=truefor run metadata, anddelta=falsefor full output snapshots.Buffer incomplete frames and parse their
dataJSON. Save therun_idand display values from the project’s output IDs. Keep the API key on your backend.For full snapshots, replace the prior displayed output. Do not append it. Ignore the
outputs.type=stream_completecontrol marker when rendering the answer.Read the completion frame’s
stateanderror. ACOMPLETEDstate means success;FAILEDorCANCELLEDmeans the answer did not complete normally. ForPAUSED, store the pause payload securely and obtain the person’s response before using the resume endpoint.If the connection drops, read
/inference/v0/runs/{org_id}/{run_id}to inspect that execution. Do not automatically start another run to recover the connection.
The client displays progress without losing the distinction between partial and completed output.
Behavior and limitations
Network chunks do not necessarily align with event boundaries. Keep incomplete data until a full event arrives. A dropped connection does not guarantee cancellation. The inference API does not document replay from an SSE Last-Event-ID. Legacy streaming and v2 run polling use different response shapes and status names; v2 success is succeeded, while inference success is COMPLETED. Keep resume tokens out of browser events and logs.
Related resources
API Versions and Compatibility
Was this helpful?

