LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangGraph
  • Web
  • Channels
  • Pregel
  • Prebuilt
  • Remote
LangGraph React SDK
  • React Ui
  • Server
LangGraph Vue SDK
LangGraph Svelte SDK
LangGraph 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
LangGraph React SDK
React UiServer
LangGraph Vue SDK
LangGraph Svelte SDK
LangGraph 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/vueSubagentStreamInterface
Interfaceā—Since v0.1

SubagentStreamInterface

Base interface for a single subagent stream. Tracks the lifecycle of a subagent from invocation to completion.

Extends StreamBase to share common properties with UseStream, allowing subagents to be treated similarly to the main stream.

Prefer using SubagentStream which supports passing an agent type directly for automatic type inference.

Copy
interface SubagentStreamInterface

Bases

StreamBase<StateType, ToolCall>

Properties

property
activeSubagents: SubagentStreamInterface<Record<string, unknown>, ToolCall, string>[]

Currently active subagents (where status === "running").

property
completedAt: Date | null

When the subagent completed

property
depth: number

Nesting depth (0 = called by main agent, 1 = called by subagent, etc.)

property
error: unknown

Last seen error from the stream.

property
getSubagent: (toolCallId: string) => SubagentStreamInterface<Record<string, unknown>, ToolCall, string> | undefined

Get subagent stream by tool call ID.

property
getSubagentsByMessage: (messageId: string) => SubagentStreamInterface<Record<string, unknown>, ToolCall, string>[]

Get all subagents triggered by a specific AI message.

Useful for rendering subagent activities grouped by the AI message (and therefore conversation turn) that spawned them.

Copy
// Render subagents after each AI message that triggered them
{stream.messages.map((msg) => (
  <div key={msg.id}>
    <MessageBubble message={msg} />
    {msg.type === "ai" && "tool_calls" in msg && (
      <SubagentPipeline
        subagents={stream.getSubagentsByMessage(msg.id)}
      />
    )}
  </div>
))}
property
getSubagentsByType: (type: TName) => SubagentStreamInterface<Record<string, unknown>, ToolCall, TName>[]

Get all subagents of a specific type. When called with a literal type name that matches a key in SubagentStates, returns streams with properly inferred state types.

Copy
// With DeepAgent type inference
const stream = useStream<typeof agent>(...);
const researchers = stream.getSubagentsByType("researcher");
// researchers[0].values is typed with ResearcherMiddleware state
property
getToolCalls: (message: AIMessage<ToolCall>) => ToolCallWithResult<ToolCall>[]

Get tool calls for a specific AI message.

property
id: string

Unique identifier (the tool call ID)

property
interrupt: Interrupt<unknown> | undefined

Get the interrupt value for the stream if interrupted. Convenience alias for interrupts[0].

property
interrupts: Interrupt<unknown>[]

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.

property
messages: Message<ToolCall>[]

Messages accumulated during the stream.

property
namespace: string[]

Namespace path for this subagent execution

property
parentId: string | null

Tool call ID of parent subagent (for nested subagents)

property
result: string | null

Final result content (when complete)

property
startedAt: Date | null

When the subagent started

property
status: SubagentStatus

Current execution status

property
subagents: Map<string, SubagentStreamInterface<Record<string, unknown>, ToolCall, string>>

All currently active and completed subagent streams. Keyed by tool call ID for easy lookup.

property
switchThread: (newThreadId: string | null) => void

Switch to a different thread, clearing the current stream state. Pass null to reset to no thread (a new thread will be created on next submit).

property
toolCall: SubagentToolCall<SubagentName>

The tool call that invoked this subagent

property
toolCalls: ToolCallWithResult<ToolCall>[]

Tool calls paired with their results. Useful for rendering tool invocations and their outputs together.

property
values: StateType

The current state values of the stream.

View source on GitHub