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/langgraph-sdkreactBaseStream
Interface●Since v1.6

BaseStream

Base stream interface shared by all stream types.

Contains core properties for state management, messaging, and stream control that are common to CompiledStateGraph, ReactAgent, and DeepAgent streams.

This interface provides the foundation that all stream types build upon:

  • State management (values, isLoading, error)
  • Message handling (messages)
  • Interrupt handling (interrupt)
  • Stream lifecycle (submit, stop)
  • Branching and history (branch, history)
Copy
interface BaseStream

Example

Copy
// BaseStream is not used directly - use one of the specialized interfaces:
// - UseGraphStream for CompiledStateGraph
// - UseAgentStream for ReactAgent (createAgent)
// - UseDeepAgentStream for DeepAgent (createDeepAgent)

Properties

property
assistantId: string

The ID of the assistant to use.

property
branch: string

The current branch of the thread. Used for navigating between different conversation branches.

property
client: Client

LangGraph SDK client used to send requests and receive responses.

property
error: unknown

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

property
experimental_branchTree: Sequence<StateType>

Tree of all branches for the thread. This API is experimental and subject to change.

property
getMessagesMetadata: (message: Message<ToolCall>, index?: number) => MessageMetadata<StateType> | undefined

Get the metadata for a message, such as first thread state the message was seen in and branch information.

property
history: ThreadState<StateType>[]

Flattened history of thread states of a thread. Contains all states in the current branch's history.

property
interrupt: Interrupt<GetInterruptType<Bag>> | undefined

Current interrupt, if the stream is interrupted. Convenience alias for interrupts[0]. For workflows with multiple concurrent interrupts, use interrupts instead.

property
interrupts: Interrupt<GetInterruptType<Bag>>[]

All current interrupts from the stream. When using Send() fan-out with per-task interrupt() calls, multiple interrupts may be pending simultaneously.

property
isLoading: boolean

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

property
isThreadLoading: boolean

Whether the thread is currently being loaded. true during initial thread data fetch.

property
joinStream: (runId: string, lastEventId?: string, options?: __type) => Promise<void>

Join an active stream that's already running.

property
messages: Message<ToolCall>[]

Messages accumulated during the stream. Includes both human and AI messages. AI messages include typed tool calls based on the agent's tools.

property
setBranch: (branch: string) => void

Set the branch of the thread.

property
stop: () => Promise<void>

Stops the currently running stream.

property
submit: (values: GetUpdateType<Bag, StateType> | null | undefined, options?: SubmitOptions<StateType, GetConfigurableType<Bag>>) => Promise<void>

Create and stream a run to the thread.

property
values: StateType

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

View source on GitHub