LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangGraph
  • Web
  • Channels
  • Pregel
  • Prebuilt
  • Remote
  • Stream
LangGraph SDK
  • Ui
  • Client
  • Auth
  • React
  • Logging
  • React Ui
  • Utils
  • Server
  • Stream
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
WebChannelsPregelPrebuiltRemoteStream
LangGraph SDK
UiClientAuthReactLoggingReact UiUtilsServerStream
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

constructor
constructor

Properties

property
error: __type
property
isLoading: boolean

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

property
values: "values"

Methods

method
clear
method
enqueue
method
fetchSubagentHistory→ Promise<void>

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.

method
getActiveSubagents→ SubagentStreamInterface<Record<string, unknown>, DefaultToolCall, string>[]

Get all currently running subagents.

method
getSnapshot→ T
method
getSubagent→ SubagentStreamInterface<Record<string, unknown>, DefaultToolCall, string> | undefined

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

method
getSubagents→ Map<string, SubagentStreamInterface<Record<string, unknown>, DefaultToolCall, string>>

Get all subagents as a Map.

method
getSubagentsByMessage→ SubagentStreamInterface<Record<string, unknown>, DefaultToolCall, string>[]

Retrieve all subagent streams associated with a specific AI message.

method
getSubagentsByType→ SubagentStreamInterface<Record<string, unknown>, DefaultToolCall, string>[]

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

method
hasSubagents→ boolean

Check if any subagents are currently tracked.

method
reconstructSubagents

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
method
setStreamValues
method
start→ Promise<void>
method
stop→ Promise<void>

Disconnect the client from the active run and mark the controller idle. By default also cancels the run server-side; pass { cancel: false } or call disconnect to keep the agent running (join/rejoin).

method
subscribe→ Promise<SubscriptionHandle<EventForChannel<TChannel>, YieldForChannel<TChannel>>>

Subscribe to raw wire channels and receive protocol events.

For assembled projections, use the lazy getters instead: thread.messages, thread.values, thread.toolCalls, thread.subgraphs, thread.subagents, thread.output.

View source on GitHub