FetchStreamTransport
FetchStreamTransport is the production transport for LangGraph Platform. It wraps the LangGraph SDK client, creates threads when needed, starts streaming runs, joins queued runs, cancels runs, loads history, and updates thread state for operations such as regenerate rollback.
When you interact with it directly
In most apps you never instantiate FetchStreamTransport directly. When no custom transport is configured, agent() creates one from the resolved apiUrl and onThreadId callback.
You reach for it explicitly when you want to share a transport instance, inspect behavior in tests, or implement a custom transport by matching the same AgentTransport interface.
How it works
FetchStreamTransport creates a LangGraph SDK Client for the configured API URL. On stream(), it creates a thread when threadId is missing, calls client.runs.stream(...), normalizes SDK events into StreamEvent objects, and yields them to the stream manager.
The transport handles:
- Thread creation โ calls
onThreadIdwhen the SDK creates a new thread. - Streaming modes โ defaults to
values,messages-tuple,updates, andcustom. - Cancellation โ forwards
AbortSignalto LangGraph run APIs. - Queued runs โ supports create, cancel, and join flows when the backend supports them.
- History and state update โ loads checkpoint history and calls
threads.updateState()for regenerate rollback. - Error propagation โ SDK and network errors surface through
agent.error().
FetchStreamTransport implements AgentTransport. Custom transports must
implement stream(assistantId, threadId, payload, signal, options?); optional
methods such as joinStream, createQueuedRun, cancelRun, getHistory,
and updateState enable advanced LangGraph features.
What's Next
Learn how the SSE lifecycle maps to resource signals and how to handle reconnects.
Server configuration for SSE: headers, timeouts, and edge runtime considerations.
The test-time counterpart โ push values synchronously without a real server.