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/langgraphindexCompiledStateGraphstream
Method●Since v0.3

stream

Copy
stream<
  TStreamMode extends StreamMode | StreamMode[] | undefined,
  TSubgraphs 
View source on GitHub
extends
boolean
,
TEncoding
extends
"text/event-stream"
|
undefined
>
(
input
:
ExtractUpdateType
<
I
,
ExtractStateType
<
I
,
I
>
>
|
CommandInstance
<
InferInterruptResumeType
<
InterruptType
,
false
>
,
{
[
K
in
string
|
number
|
symbol
]
:
U
[
K
]
}
,
N
>
|
null
,
options
:
Partial
<
PregelOptions
<
Record
<
"__start__"
|
N
,
PregelNode
<
S
,
U
>
>
,
Record
<
string
|
N
,
BaseChannel
<
unknown
,
unknown
,
unknown
>
>
,
ExtractStateType
<
C
,
C
>
Record
<
string
,
any
>
,
TStreamMode
,
TSubgraphs
,
TEncoding
>
>
)
:
Promise
<
IterableReadableStream
<
StreamOutputMap
<
TStreamMode
,
TSubgraphs
,
ExtractUpdateType
<
I
,
ExtractStateType
<
I
,
I
>
>
,
ExtractStateType
<
O
,
O
>
,
"__start__"
|
N
,
NodeReturnType
,
InferWriterType
<
WriterType
>
,
TEncoding
>
>
>

Parameters

NameTypeDescription
input*ExtractUpdateType<I, ExtractStateType<I, I>> | CommandInstance<InferInterruptResumeType<InterruptType, false>, { [K in string | number | symbol]: U[K] }, N> | null
optionsPartial<PregelOptions<Record<"__start__" | N, PregelNode<S, U>>, Record<string | N, BaseChannel<unknown, unknown, unknown>>, ExtractStateType<C

Streams the execution of the graph, emitting state updates as they occur. This is the primary method for observing graph execution in real-time.

Stream modes:

  • "values": Emits complete state after each step
  • "updates": Emits only state changes after each step
  • "debug": Emits detailed debug information
  • "messages": Emits messages from within nodes
  • "custom": Emits custom events from within nodes
  • "checkpoints": Emits checkpoints from within nodes
  • "tasks": Emits tasks from within nodes
,
C
> &
Record
<
string
,
any
>,
TStreamMode
,
TSubgraphs
,
TEncoding
>>

The input to start graph execution with

Configuration options for streaming