SubAgent
Core Facts
Timeline (last 90 days)
Only by using MCP, Skills, SubAgent, and Hooks together with permission modes can Claude Code's capability as an orchestratable system be brought into play.
Implement Spec orchestrates Tickets using a SubAgent loop, on the grounds that having a single Coding Agent complete an entire Spec in one go easily puts it into an error-making state and triggers automatic compaction.
SubAgents can now further spawn SubAgents, so orchestration becomes a tree structure, which is the technical prerequisite for Implement Spec to automatically execute the Ticket graph.
The essence of a SubAgent is context partitioning — creating an independent context window for each subtask to ensure that the subtask context does not contaminate the main task, fundamentally cutting off the token accumulation effect.
In mainstream frameworks such as OpenAI's Agents SDK and LangGraph, SubAgents are typically modeled as tools or nodes that can be called by a parent Agent, with data passed directly through function calls, message queues, or shared memory.
SubAgent 模式在 AutoGPT、CrewAI、MetaGPT 等多 Agent 框架中被广泛采用
The traditional role-based SubAgent approach only modifies the system prompt of the SubAgent, while the Agent's underlying tools, Skills, and MCP are still inherited from the main Agent.
传统基于角色的SubAgent方案只是修改了SubAgent的系统提示词,底层仍然继承主Agent的工具、Skill与MCP
All Facts (17)
Claude Code supports breaking large tasks into multiple subtasks for parallel processing through a SubAgent (sub-agent) architecture.
80%Unverified当前SubAgent实现只能串行执行子Agent,不支持并行执行
95%Unverifiedrun_subagent函数中子Agent的执行被限制为30轮循环
95%UnverifiedSubAgent架构中,父Agent的工具集在子Agent工具的基础上额外增加了一个task工具用于分派任务
95%UnverifiedSubAgent(子智能体)方案的核心目的是实现上下文隔离,防止对话被工具调用产生的中间信息污染
95%Unverified子Agent完成任务后,提取最后一轮的文本块通过join方法拼接成summary,作为tool result返回给父Agent
90%Unverified子Agent的生命周期很短,只在执行任务过程中存在,任务完成后就被销毁;而Agent Teams中的每个Agent都是长期存在、持久性的
90%Unverified将SubAgent改造为并行执行需要解决任务依赖图构建、结果聚合和资源竞争(如文件读写加锁)三个技术挑战
85%UnverifiedSubAgent架构中父子Agent的System Prompt设计体现了软件工程中的单一职责原则
80%UnverifiedOnly by using MCP, Skills, SubAgent, and Hooks together with permission modes can Claude Code's capability as an orchestratable system be brought into play.
50%UnverifiedImplement Spec orchestrates Tickets using a SubAgent loop, on the grounds that having a single Coding Agent complete an entire Spec in one go easily puts it into an error-making state and triggers automatic compaction.
50%UnverifiedSubAgents can now further spawn SubAgents, so orchestration becomes a tree structure, which is the technical prerequisite for Implement Spec to automatically execute the Ticket graph.
50%UnverifiedThe essence of a SubAgent is context partitioning — creating an independent context window for each subtask to ensure that the subtask context does not contaminate the main task, fundamentally cutting off the token accumulation effect.
50%UnverifiedIn mainstream frameworks such as OpenAI's Agents SDK and LangGraph, SubAgents are typically modeled as tools or nodes that can be called by a parent Agent, with data passed directly through function calls, message queues, or shared memory.
50%UnverifiedSubAgent 模式在 AutoGPT、CrewAI、MetaGPT 等多 Agent 框架中被广泛采用
50%UnverifiedThe traditional role-based SubAgent approach only modifies the system prompt of the SubAgent, while the Agent's underlying tools, Skills, and MCP are still inherited from the main Agent.
50%Unverified传统基于角色的SubAgent方案只是修改了SubAgent的系统提示词,底层仍然继承主Agent的工具、Skill与MCP
50%