Subagents - Claude Code
Spawn isolated workers with independent context windows.
Subagents are isolated Claude Code instances the main session can spawn for focused work. They have their own context, their own tools, and return a clean result when done.
What it does
Claude delegates a task to a subagent with a specific prompt and toolset. The subagent runs in isolation - its reads, edits, and reasoning don't land in the main context. When it finishes, it returns a summary. This is the building block for parallel work, research fan-outs, and context hygiene in long sessions.
When to use it
- Research tasks that would otherwise swell the main context.
- Parallel exploration across several files or topics.
- Delegating a concrete subtask while you keep the bigger picture.
- Running specialized roles (reviewer, auditor, researcher) with different system prompts.
Gotchas
- Subagent output is what the main session sees - make sure the return is informative.
- Each subagent is a separate model call. Spawning too many inflates cost and time.
- Subagents don't share memory with the parent unless you configure persistent memory.
Official docs: https://code.claude.com/docs/en/sub-agents.md
Technical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.
Get the weekly deep dive
Tutorials on Claude Code, AI agents, and dev tools - delivered free every week.
Was this helpful?




