Specification for a subagent that can be dynamically created.
When using createDeepAgent, subagents automatically receive a default middleware
stack (todoListMiddleware, filesystemMiddleware, summarizationMiddleware, etc.) before
any custom middleware specified in this spec.
Required fields:
name: Identifier used to select this subagent in the task tooldescription: Shown to the model for subagent selectionsystemPrompt: The system prompt for the subagentOptional fields:
model: Override the default model for this subagenttools: Override the default tools for this subagentmiddleware: Additional middleware appended after defaultsinterruptOn: Human-in-the-loop configuration for specific toolsskills: Skill source paths for SkillsMiddleware (e.g., ["/skills/user/", "/skills/project/"])The description of the agent
Human-in-the-loop configuration for specific tools. Requires a checkpointer.
Additional middleware to append after default_middleware
The model for the agent. Defaults to defaultModel
Error name for instanceof checks and logging
Skill source paths for SkillsMiddleware.
List of paths to skill directories (e.g., ["/skills/user/", "/skills/project/"]).
When specified, the subagent will have its own SkillsMiddleware that loads skills
from these paths. This allows subagents to have different skill sets than the main agent.
Note: Custom subagents do NOT inherit skills from the main agent by default. Only the general-purpose subagent inherits the main agent's skills.
Optional custom system prompt override
The tools to use for the agent (tool instances, not names). Defaults to defaultTools
const researcher: SubAgent = {
name: "researcher",
description: "Research assistant for complex topics",
systemPrompt: "You are a research assistant.",
tools: [webSearchTool],
skills: ["/skills/research/"],
};const researcher: SubAgent = {
name: "researcher",
description: "Research assistant",
systemPrompt: "You are a researcher.",
skills: ["/skills/research/", "/skills/web-search/"],
};