Stream output from a run in real-time, until the run is done. Output is not buffered, so any output produced before this call will not be received here.
join_stream(
self,
thread_id: str,
run_id: str,
*,
cancel_on_disconnect: bool = False,
stream_mode: StreamMode | Sequence[StreamMode] | None = None,
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
last_event_id: str | None = None
) -> AsyncIterator[StreamPart]client = get_client(url="http://localhost:2024")
async for part in client.runs.join_stream(
thread_id="thread_id_to_join",
run_id="run_id_to_join",
stream_mode=["values", "debug"]
):
print(part)| Name | Type | Description |
|---|---|---|
thread_id* | str | The thread ID to join. |
run_id* | str | The run ID to join. |
cancel_on_disconnect | bool | Default: FalseWhether to cancel the run when the stream is disconnected. |
stream_mode | StreamMode | Sequence[StreamMode] | None | Default: NoneThe stream mode(s) to use. Must be a subset of the stream modes passed when creating the run. Background runs default to having the union of all stream modes. |
headers | Mapping[str, str] | None | Default: NoneOptional custom headers to include with the request. |
params | QueryParamTypes | None | Default: NoneOptional query parameters to include with the request. |
last_event_id | str | None | Default: NoneThe last event ID to use for the stream. |