Infer the state type for a specific subagent by extracting and merging its middleware state schemas, plus the base agent state (messages).
The DeepAgent to extract from
The name of the subagent
The tool call type for messages. Defaults to DefaultToolCall.
const agent = createDeepAgent({ subagents: [ { name: "researcher", middleware: [ResearchMiddleware] } ] as const,});type ResearcherState = InferSubagentState<typeof agent, "researcher">;// ResearcherState includes { messages: Message<ToolCall>[], ...ResearchMiddleware state } Copy
const agent = createDeepAgent({ subagents: [ { name: "researcher", middleware: [ResearchMiddleware] } ] as const,});type ResearcherState = InferSubagentState<typeof agent, "researcher">;// ResearcherState includes { messages: Message<ToolCall>[], ...ResearchMiddleware state }
Infer the state type for a specific subagent by extracting and merging its middleware state schemas, plus the base agent state (messages).