# Claude Code Subagents, Teams, and Workflows: Which Multi-Agent Mode?

> Claude Code subagents, agent teams, and dynamic workflows all run parallel work. Compare who holds the plan, how workers share files, and pick the right mode.

Claude Code subagents are specialized workers Claude spawns to handle a subtask in their own context window. They are one of five ways Claude Code runs several tasks at once — alongside agent view, agent teams, dynamic workflows, and projects — and the right choice depends on who holds the plan and whether the work touches the same files.

**The short answer:** define a subagent as a Markdown file in `.claude/agents/` with YAML frontmatter (name, description, tools, model) and a system-prompt body. Use subagents for delegated subtasks, agent teams when workers must message each other, and dynamic workflows when the orchestration should be a rerunnable script. Isolate same-file work with worktrees.

![Decision tree choosing between Claude Code subagents, agent teams, and dynamic workflows](/blog/claude-code-subagents/multi-agent-decision.svg)

## What a subagent is

A subagent is a configured worker with its own system prompt and tool access. It receives only that system prompt plus basic environment details like the working directory — not Claude Code's main system prompt ([sub-agent docs](https://code.claude.com/docs/en/sub-agents)). Subagents report results back to the conversation that spawned them.

## Create a subagent

Claude Code watches `~/.claude/agents/` (user scope) and `.claude/agents/` (project scope). A file is YAML frontmatter followed by the system prompt in Markdown:

```markdown
---
name: code-reviewer
description: Reviews code for quality and best practices
tools: Read, Glob, Grep
model: sonnet
---

You are a code reviewer. When invoked, analyze the code and provide
specific, actionable feedback on quality, security, and best practices.
```

The frontmatter sets metadata and configuration; the body becomes the system prompt. Edits on disk are picked up within seconds, so the next delegation uses the updated definition without a restart. Use the `/agents` command to manage them interactively.

To give a subagent an isolated copy of the repository, set `isolation: worktree`. Its Bash and PowerShell commands then run inside that worktree instead of your main checkout.

## The five ways to run parallel work

| Mode | Who holds the plan | Workers talk? | Where it runs |
| --- | --- | --- | --- |
| Subagents | Claude, turn by turn | Report back to spawner | Your machine |
| Agent view | You dispatch sessions | Report results to you | Cloud or local |
| Agent teams | Claude coordinates | Teammates message each other, share a task list | Your machine |
| Dynamic workflows | A script Claude writes | Script holds intermediate results | Background runtime |
| Projects | You, across sessions | Cross-session messaging | Cloud or local |

The deciding question is **who holds the plan**. With subagents, skills, and agent teams, Claude is the orchestrator: it decides turn by turn what to spawn, and every result lands in a context window. A dynamic workflow moves the plan into code — the script holds the loop, branching, and intermediate results, so Claude's context holds only the final answer ([workflows docs](https://code.claude.com/docs/en/workflows)).

## Pick by the shape of the task

- **Do the workers need to talk to each other?** Agent teams message each other directly and, with the Task tools, share a task list. Subagents only report back to their spawner.
- **Do the tasks touch the same files?** Isolate with worktrees. Subagents and sessions you run can each use a separate worktree. Agent teams do not isolate teammates in worktrees, so partition the work so each teammate owns a different set of files.
- **More agents than one conversation can coordinate?** Use a dynamic workflow: a codebase-wide bug sweep, a 500-file migration, or research cross-checked against several sources.

## /batch and forked subagents

`/batch` is a skill that has Claude split one large change into 5 to 30 worktree-isolated subagents — a packaged use of subagents and worktrees, not a separate coordination style.

A forked subagent inherits your full conversation context instead of starting fresh. Start one with `/subtask`; `/fork` copies the whole session into a new background session that runs alongside it.

## Dynamic workflows

A dynamic workflow is a JavaScript script that orchestrates many subagents at once. Claude writes the script for the task you describe, and a runtime executes it in the background while your session stays responsive. They require Claude Code v2.1.154 or later and are available on paid plans and via API access; on Pro, enable them from the Dynamic workflows row in `/config`.

Because the plan is code, a workflow can apply a repeatable quality pattern — for example, having independent agents adversarially review each other's findings before reporting — not just run more agents.

## Sources

- [Claude Code: Sub-agents](https://code.claude.com/docs/en/sub-agents)
- [Claude Code: Agents and parallel work](https://code.claude.com/docs/en/agents)
- [Claude Code: Dynamic workflows](https://code.claude.com/docs/en/workflows)
