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-sdkindexResolveStreamInterface
Type●Since v1.6

ResolveStreamInterface

Resolves the appropriate stream interface based on the agent/graph type.

This type automatically selects the correct stream interface based on the type of agent or graph passed to useStream:

  1. DeepAgent (~deepAgentTypes) → UseDeepAgentStream

    • Includes: values, messages, toolCalls, subagents, getSubagentsByType, getSubagentsByMessage
  2. ReactAgent (~agentTypes) → UseAgentStream

    • Includes: values, messages, toolCalls, getToolCalls
    • Excludes: subagents, getSubagentsByType
  3. CompiledGraph / Default → UseDeepAgentStream with DefaultSubagentStates

    • Includes: values, messages, submit, stop, toolCalls, subagents
    • SubagentStates defaults to DefaultSubagentStates (loosely typed)
Copy
ResolveStreamInterface: IsDeepAgent<
  T
> extends true  UseDeepAgentStream<InferStateType<T>, InferToolCalls<T>, InferSubagentStates<T>, Bag> : IsReactAgent<T> extends true  UseAgentStream<InferStateType<T>, InferToolCalls<T>, Bag> : UseDeepAgentStream<InferStateType<T>, InferToolCalls<T>, DefaultSubagentStates, Bag>

Example

Copy
// Automatic detection based on agent type
type GraphStream = ResolveStreamInterface<typeof compiledGraph, BagTemplate>;
// → UseGraphStream (with typed node names)

type AgentStream = ResolveStreamInterface<typeof reactAgent, BagTemplate>;
// → UseAgentStream (has toolCalls)

type DeepStream = ResolveStreamInterface<typeof deepAgent, BagTemplate>;
// → UseDeepAgentStream (has toolCalls AND subagents)
View source on GitHub