langchain.js
    Preparing search index...

    Type Alias SubagentStateMap<T, ToolCall>

    SubagentStateMap: {
        [K in InferSubagentNames<T>]: InferSubagentState<T, K, ToolCall>
    }

    Create a map of subagent names to their state types. This is useful for type-safe getSubagentsByType calls.

    Type Parameters

    • T

      The DeepAgent to extract from

    • ToolCall = DefaultToolCall

      The tool call type for messages. Defaults to DefaultToolCall.

    const agent = createDeepAgent({
    subagents: [
    { name: "researcher", middleware: [ResearchMiddleware] },
    { name: "writer", middleware: [WriterMiddleware] }
    ] as const,
    });

    type StateMap = SubagentStateMap<typeof agent>;
    // StateMap = { researcher: ResearchState; writer: WriterState }