stream_graph_to_events(
graph_stream: AsyncIterator[Any],
stream: ResponseEventStream,
*,
cancellation_signal: asyncio.Event| Name | Type | Description |
|---|---|---|
graph_stream* | AsyncIterator[Any] | The |
stream* | ResponseEventStream | The :class: |
cancellation_signal* | asyncio.Event | Set by the responses host when the request is cancelled; iteration stops on set. |
shutdown_signal | asyncio.Event | None | Default: None |
usage | UsageAccumulator | None | Default: None |
Iterate the graph stream and yield Responses API events.
Each invocation handles one Responses turn by consuming the complete stream from one LangGraph execution. A graph run may contain multiple supersteps and checkpoint events, all of which are processed by this invocation.
The caller is responsible for emitting response.created /
response.in_progress before invoking this generator and
response.completed (or response.failed /
response.cancelled) after it returns.
Set when the host is draining. Iteration stops on set so the caller can defer resilient work to the next lifetime.
Optional accumulator for LangChain AI message usage metadata.