interface ThreadStreamOptionsOptions for ThreadStream construction.
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.
Maximum reconnect attempts after an unexpected SSE disconnect. Defaults to 5. Set to 0 to disable automatic reconnection.
Called before each SSE reconnect attempt (after backoff delay).
Backoff before each SSE reconnect attempt. Defaults to
webSocketReconnectDelayMs from ./websocket.js.
Starting command ID for the internal command counter. Mostly useful for tests.
Built-in "sse" transport only: idle-reconnect policy guarding against
half-open sockets that hang with no error or close (e.g. a platform
revision rollover).
"auto" (default): arm only once the server's SSE keep-alive
heartbeats are observed (LangGraph Platform emits : heartbeat every
~5s), sizing the window from their cadence. Independent of agent
activity; stays dormant on heartbeat-less servers.number: a fixed idle window in milliseconds.0: disables it.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.