LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangGraph
  • Web
  • Channels
  • Pregel
  • Prebuilt
  • Remote
React SDK
Vue SDK
Svelte SDK
Angular SDK
LangGraph SDK
  • Ui
  • Client
  • Auth
  • React
  • Logging
  • React Ui
  • Utils
  • Server
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
  • Store
LangGraph Checkpoint Redis
  • Shallow
  • Store
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
  • Cli
LangGraph API
LangGraph CLI
LangGraph CUA
  • Utils
LangGraph Supervisor
LangGraph Swarm
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangGraph
WebChannelsPregelPrebuiltRemote
React SDK
Vue SDK
Svelte SDK
Angular SDK
LangGraph SDK
UiClientAuthReactLoggingReact UiUtilsServer
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
Store
LangGraph Checkpoint Redis
ShallowStore
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
Cli
LangGraph API
LangGraph CLI
LangGraph CUA
Utils
LangGraph Supervisor
LangGraph Swarm
Language
Theme
JavaScript@langchain/langgraph-sdkuiStreamManager
Class●Since v1.7

StreamManager

Copy
class StreamManager

Constructors

Properties

Methods

View source on GitHub
constructor
constructor
property
error: unknown
property
isLoading: boolean
property
values: StateType
method
clear
method
enqueue
method
fetchSubagentHistory→ Promise<void>
method
getActiveSubagents→ SubagentStreamInterface<Record<string, unknown>, DefaultToolCall, string>[]
method
getSnapshot→ number
method
getSubagent→ SubagentStreamInterface<Record<string, unknown>, DefaultToolCall, string> | undefined
method
getSubagents→ Map<string, SubagentStreamInterface<Record<string, unknown>, DefaultToolCall, string>>
method
getSubagentsByMessage→ SubagentStreamInterface<Record<string, unknown>, DefaultToolCall, string>[]
method
getSubagentsByType→ SubagentStreamInterface<Record<string, unknown>, DefaultToolCall, string>[]
method
hasSubagents→ boolean
method
reconstructSubagents
method
setStreamValues
method
start→ Promise<void>
method
stop
method
subscribe→ () => void

Last seen error from the stream, if any. Reset to undefined when a new stream starts.

Whether the stream is currently running. true while streaming, false when idle or completed.

The current state values of the stream. Updated as streaming events are received.

Fetch and restore internal messages for reconstructed subagents from their subgraph checkpoints. Should be called after reconstructSubagents to restore the full subagent conversation after a page refresh.

Subagent messages are persisted in the LangGraph checkpointer under a subgraph-specific checkpoint_ns (e.g. tools:<uuid>). This method discovers the correct namespace by inspecting the main thread's intermediate history checkpoints, where each pending task's checkpoint.checkpoint_ns identifies the subgraph. Tasks are matched to tool calls by their Send index (task.path[1]), which corresponds to the order of tool calls in the AI message — no deepagent-specific metadata required.

Get all currently running subagents.

Return the current version number, incremented on each state change. Useful as a cache key for external sync (e.g. useSyncExternalStore).

Look up a single subagent stream by its tool call ID.

Get all subagents as a Map.

Retrieve all subagent streams associated with a specific AI message.

Retrieve all subagent streams matching a given tool name / type.

Check if any subagents are currently tracked.

Reconstruct subagent state from historical messages.

This method should be called when loading thread history to restore subagent visualization after:

  • Page refresh (when stream has already completed)
  • Loading thread history
  • Navigating between threads

Abort the current stream and invoke the onStop callback if one was provided in the options.

Register a listener that is called whenever the orchestrator state changes.