langchain.js
    Preparing search index...

    Type Alias SubagentStream<T, ToolCall>

    SubagentStream: IsDeepAgentLike<T> extends true
        ? SubagentStreamInterface<
            SubagentStateMap<T, InferAgentToolCalls<T>>[InferSubagentNames<T>],
            InferAgentToolCalls<T>,
            InferSubagentNames<T>,
        >
        : IsAgentLike<T> extends true
            ? SubagentStreamInterface<InferAgentState<T>, InferAgentToolCalls<T>>
            : SubagentStreamInterface<T, ToolCall>

    Represents a single subagent stream.

    Supports two usage patterns:

    1. Agent type inference (recommended): Pass a DeepAgent type directly and let TypeScript infer the correct state and tool call types.
    import type { agent } from "./agent";

    // Automatically infers state and tool call types from the agent
    const subagent: SubagentStream<typeof agent> = ...;
    1. Explicit generics: Pass state and tool call types manually.
    type ResearcherState = { research_notes: string };
    const researcher: SubagentStream<ResearcherState, MyToolCall> = ...;

    Type Parameters

    • T = Record<string, unknown>

      Either a DeepAgent/Agent type for automatic inference, or a state type (Record) for explicit typing. Defaults to Record<string, unknown>.

    • ToolCall = DefaultToolCall

      The type of tool calls in messages. Only used when T is a state type. Defaults to DefaultToolCall.