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

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
Copy
stream<
  TStreamMode extends StreamMode | StreamMode[] | undefined,
  TSubgraphs 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

The input to start graph execution with

optionsPartial<PregelOptions<Record<"__start__" | N, PregelNode<S, U>>, Record<string | N, BaseChannel<unknown, unknown, unknown>>, ExtractStateType<C, C> & Record<string, any>, TStreamMode, TSubgraphs, TEncoding>>

Configuration options for streaming

View source on GitHub