subagents-and-teams
Subagents and Agent Teams
Claude Code supports two distinct approaches for parallelizing and delegating work: subagents and agent teams. Understanding when to use each is critical for effective workflows.
Subagents are specialized AI assistants that run within a single session. Each subagent operates in its own context window with a custom system prompt, specific tool access, and independent permissions. When Claude encounters a task matching a subagent's description, it delegates to that subagent, which works independently and returns results to the main conversation. Subagents cannot spawn other subagents.
Agent teams coordinate multiple independent Claude Code instances working together. One session acts as team lead, creating tasks, spawning teammates, and synthesizing results. Teammates work independently in their own context windows and can communicate directly with each other -- not just back to the lead. Agent teams are experimental and must be explicitly enabled.
Subagents help you:
- Preserve context by keeping exploration and implementation out of your main conversation
- Enforce constraints by limiting which tools a subagent can use
- Reuse configurations across projects with user-level subagents
- Specialize behavior with focused system prompts for specific domains
- Control costs by routing tasks to faster, cheaper models like Haiku