Custom-adapter branch: caller brings their own
AgentServerAdapter. Discriminated against
AgentServerOptions by transport being an adapter instance.
interface CustomAdapterOptionsUseStreamCommonOptions<StateType, ThreadIdType>API key for authentication.
LangGraph SDK client used to send requests and receive responses.
Optional fetch override, forwarded to the SSE transport. Useful
for auth proxies, Next.js route handlers, or tests with injected
mocks. Ignored when webSocketFactory is also supplied.
Initial values to display immediately when loading a thread. Useful for displaying cached thread data while official history loads. These values will be replaced when official thread data is fetched.
Note: UI components from initialValues will render immediately if they're predefined in LoadExternalComponent's components prop, providing instant cached UI display without server fetches.
Specify the key within the state that contains messages. Defaults to "messages".
Callback that is called when the thread ID is updated (ie when a new thread is created).
Thread ID this transport is bound to.
How this thread talks to the agent server. Accepts either a built-in transport string or a custom AgentServerAdapter:
"sse": HTTP commands + one SSE event stream per subscription."websocket": single bidirectional WebSocket.fetch / webSocketFactory
are ignored in this mode.Defaults to the client-level streamProtocol
("v2-websocket" → "websocket", otherwise "sse").
Optional WebSocket factory. Supplying it flips the adapter into WebSocket mode — SSE is bypassed entirely.
Initial values to display immediately when loading a thread.
Specify the key within the state that contains messages.
Callback that is called when a new stream is created.
Callback that is called when the thread ID is updated (ie when a new thread is created).
Thread ID this transport is bound to.