Skip to main content
GET
Join Thread Stream

Headers

Last-Event-ID
string

The ID of the last event received. Used to resume streaming from a specific point. Pass '-' to resume from the beginning. A gap event is sent, first on a resume or mid-stream, when events the client should receive may be missing. Its reason is expired when they may have aged out of the stream's history; unknown_id when the ID is later than any event the thread streamed, and the stream starts over from the beginning; or too_large when an event was over the size limit, with that event's stream mode in mode. expired errs on the safe side: once the stream's history has expired, a resume gets it unless its ID is the thread's last streamed event, which is kept for an hour after that.

Path Parameters

thread_id
string<uuid>
required

The ID of the thread.

Query Parameters

stream_modes
default:["run_modes"]

Stream modes to control which events are returned. 'lifecycle' returns only run start/end events, interrupts events (the interrupts a run answers) and run_status events, 'run_modes' returns all run events and run_status events (default behavior), 'state_update' returns only state update events. A run_status event ({"run_id": ..., "status": ...}) reports each change to the status of any run on the thread, including runs that haven't started yet. status is the run's status after the change, as the runs API returns it (pending, running, success, error, timeout or interrupted), or deleted once the run is deleted. Runs removed with their thread, when the thread is deleted or expires, get no event. Ignore statuses you don't recognize: later versions may add more. A run's run_status events arrive in the order its status changed. They are best-effort: a client that misses one sees the change on its next read of the thread's runs. A stream resumed with Last-Event-ID replays them for as long as the resumable stream TTL keeps events (120 seconds by default), whatever the run's stream_resumable.

Available options:
lifecycle,
run_modes,
state_update
stream_mode

Alias of stream_modes, the name the SDKs send. Ignored when stream_modes is set.

Available options:
lifecycle,
run_modes,
state_update

Response

Success

The server will send a stream of events in SSE format.

Example event:

id: 1

event: message

data: {}