createDeepAgent<
TResponse extends SupportedResponseFormat| Name | Type | Description |
|---|---|---|
params | CreateDeepAgentParams<TResponse, ContextSchema, TMiddleware, TSubagents, TTools> | Default: ... |
Create a Deep Agent with middleware-based architecture.
Matches Python's create_deep_agent function, using middleware for all features:
Configuration parameters for the agent
// Middleware with custom state
const ResearchMiddleware = createMiddleware({
name: "ResearchMiddleware",
stateSchema: z.object({ research: z.string().default("") }),
});
const agent = createDeepAgent({
middleware: [ResearchMiddleware],
});
const result = await agent.invoke({ messages: [...] });
// result.research is properly typed as string