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
  • 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
WebChannelsPregelPrebuiltRemote
React SDK
Vue SDK
Svelte SDK
Angular SDK
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/reactUseStreamReturn
Interface●Since v1.0

UseStreamReturn

Copy
interface UseStreamReturn

Properties

property
assistantId: string
property
client: Client
property
error: unknown
property
hydrationPromise: Promise<void>

Promise that settles when the current thread's initial hydration completes. Exposed so Suspense wrappers can throw it until the first StreamController.hydrate call resolves (or rejects) for the active thread. A fresh promise is installed on every switchThread/threadId change.

property
interrupt: Interrupt<InterruptType> | undefined
property
interrupts: Interrupt<InterruptType>[]
property
isLoading: boolean
property
isThreadLoading: boolean
property
messages: BaseMessage<MessageStructure<MessageToolSet>, MessageType>[]

The root message projection. Assembled from two sources and merged in real time:

  1. messages-channel deltas — token-level streaming events (message-start, content-block-delta, message-finish) emitted by the runtime. These drive live, token-by-token updates.
  2. values.messages snapshots — the authoritative ordering and any messages the agent produces without token streaming (human turns, tool results, echoes from subagents).

If the backend only emits values events (no messages channel), every message will appear fully-formed on each values update rather than streaming. This is a backend/runtime concern — the React layer faithfully renders whatever the server sends.

Equivalent to calling useMessages(stream) with no target.

property
subagents: ReadonlyMap<keyof SubagentStates & string extends never ? string : keyof SubagentStates & string, SubagentDiscoverySnapshot>

Subagents discovered on the root run. For DeepAgent-typed streams the key set is narrowed to the subagent names declared on the agent brand (keyof InferSubagentStates<T>).

property
subgraphs: ReadonlyMap<string, SubgraphDiscoverySnapshot>

Subgraphs discovered on the root run.

A namespace is classified as a subgraph iff at least one strictly-deeper namespace has been observed with it as a prefix. This is inferred from the lifecycle event stream — plain function nodes (orchestrator, writer in the nested-stategraph example) never appear here even though the server emits namespaced lifecycle events for them. Promotion is monotonic and retroactive; an entry appears as soon as the first descendant event lands.

property
subgraphsByNode: ReadonlyMap<string, readonly SubgraphDiscoverySnapshot[]>

Subgraphs indexed by the graph node that produced them (addNode("visualizer_0", …)). Each value is an array because parallel fan-outs and loops can spawn multiple invocations of the same node; arrays preserve insertion order. Updates in lock-step with subgraphs.

property
threadId: string | null
property
toolCalls: AssembledToolCall[]
property
values: StateType

The most recent values-channel snapshot emitted at the root namespace — i.e. the thread-level state as the server sees it after each superstep. Updated on every root values event, not on token-level deltas: if you render values.messages directly you'll see full turns appear at once instead of streaming token-by-token. Use messages (or useMessages) for the token-streamed view.

Equivalent to calling useValues(stream).

Methods

method
getThread→ ThreadStream<Record<string, unknown>> | undefined

v2 escape hatch — returns the bound ThreadStream.

method
respond→ Promise<void>
method
stop→ Promise<void>
method
submit→ Promise<void>

Dispatch a new run on the bound thread.

input is typed as Partial<StateType> so IDE autocompletion surfaces the state keys declared on the root hook. Pass null (or omit fields) when resuming an interrupt via options.command.resume — the server accepts a null payload in that case.

View source on GitHub