Creativity · Agent Protocol
Claude Code Subagents
Claude Code ships with a first-class subagent pattern: the main Claude session can spawn named sub-Claudes, each with its own system prompt, tool allowlist, and model choice. Subagents are typically configured via markdown files under .claude/agents/ and invoked automatically when Claude recognises a matching task. It's the cleanest example of the orchestrator-worker pattern in a developer-facing tool.
Protocol facts
- Sponsor
- Anthropic
- Status
- stable
- Spec
- https://docs.claude.com/en/docs/claude-code/sub-agents
- Interop with
- MCP, Task tool, A2A, Claude Agent SDK
Frequently asked questions
When does Claude Code use a subagent?
Either when the user invokes one explicitly ('use the security-reviewer subagent') or when Claude recognises the task matches a subagent's description — e.g., code review, database migration, log triage. Each subagent advertises its purpose so the main agent can pick correctly.
Why subagents instead of one big Claude?
Narrow context, narrow tool surface, narrow prompt. A subagent that only reviews code doesn't need grep or write access to production — so mistakes are bounded and its reasoning is sharper.
How does this relate to A2A?
Subagents today are in-process, not A2A-over-the-wire. But the contract is the same shape — name, description, skills, tool surface — so wiring an external A2A agent into the same slot is a small leap.
Sources
- Anthropic — Claude Code subagents docs — accessed 2026-04-20