Claude Code Subagents vs Agent Teams vs Dynamic Workflows
Compare Claude Code subagents, agent view, agent teams, and dynamic workflows by who splits the work, how edits stay separate, and usage, then pick one.
Use a subagent when you only need the result of a search or a test run. If you have a few unrelated jobs to hand out yourself, start separate sessions in agent view. Use agent teams when workers need to coordinate on shared tasks, or a dynamic workflow when a script should run tasks in batches or cross-check the results.
I checked the commands and flags on macOS with Claude Code 2.1.333. I consulted the official docs on December 1, 2026 (Taipei time), including Run agents in parallel, Subagents, Agent view, Agent teams, Dynamic workflows, and Costs.
How Do the Four Approaches Divide the Work?
Check who assigns the tasks, how the agents report back, and whether they might edit the same files. A Git worktree is a separate working directory for the same repo, so each Claude Code session can edit its own copy.
| Aspect | Subagents | Agent view | Agent teams | Dynamic workflows |
|---|---|---|---|---|
| Who assigns tasks | Claude in the main session | You | A lead Claude Code session | A script Claude writes |
| Who gets results | The main session gets a summary | You check each background session’s report | The lead pulls results together | The script collects intermediate results and returns the final result to the main session |
| How agents communicate | They report to whoever spawned them, and named subagents can message each other | Sessions can share updates through cross-session messaging | Teammates message each other directly and can share a task list | The script passes results from one stage to the next |
| How edits stay separate | Agents share a working directory by default. Use isolation: worktree to give each its own | Newly dispatched sessions usually move into their own worktree before editing | Assign each file to one teammate | Specify separate copies in the prompt |
| Typical scale | A few small tasks per turn | A few independent jobs | Start with 3 to 5 teammates | Can coordinate dozens to hundreds of agents |
| Availability | Generally available | Research preview | Experimental, off by default | Available on paid plans. On Pro, enable it in /config |
The official overview also lists Projects. You manage Projects at claude.ai/code or in the desktop app. The four approaches here are available from a local terminal.
Subagents Bring a Summary Back to the Main Session
Claude starts a subagent to handle part of the work within the same session. The subagent gets its own context, meaning the information available to it during that run. Per the docs, when all you need is a list of failed tests, the full output can stay with the subagent. If you need to look up code, the built-in Explore subagent searches and reads files without editing them.
To define a subagent for a project, add a Markdown file under .claude/agents/. The settings at the top of the file, called front matter, specify the model, tools, and whether the subagent runs in its own worktree.
1
2
3
4
5
6
7
8
---
name: migrator
description: Rewrite the given components in TypeScript, then report which files changed
tools: Read, Edit, Write, Bash
model: sonnet
isolation: worktree
---
You rewrite the JavaScript components you are given in TypeScript. Run the type checker when done and report the result.
Use isolation: worktree when a subagent needs to edit files separately from other work. Per the docs, the worktree starts from the repo’s default branch by default, so changes that haven’t merged from your current branch may be missing.
- When 20 subagents are running, the Agent tool rejects new ones by default. Set
CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTSto change the limit. Sessions with ultracode enabled are exempt. - Subagents can spawn their own subagents, up to three levels below the main session by default. Set
CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTHto change the depth. /subtaskstarts a fork, a subagent that inherits the full conversation. It reuses the main session’s prompt cache for repeated input, which can save tokens when the task needs the same context.
Use /agents inside a session to find the subagent configuration paths. To check on background sessions, run claude agents from your shell.
Check on Jobs You Assign in Agent View
Agent view lists your background sessions in one place. The sessions keep working after you close the terminal, so you can check back when one needs input. They survive sleep and stop when you shut the computer down.
From your shell, start a background session and open agent view to check its progress.
1
2
claude --bg --name "flaky-test-fix" "Find the flaky tests under test/api and fix them"
claude agents
If you already have a session open, use /bg to send it to the background. It keeps working in the same directory.
Per the docs, a new background session in a Git repo usually moves to a separate worktree before editing. This applies whether you start it from agent view or with --bg, and Claude puts the worktree under .claude/worktrees/. If the session starts in a worktree, it keeps using that one.
Subagents from a background session use the same working directory unless you give them their own worktrees.
When Claude edits files in a worktree it set up for a background session, it commits the changes by default. If the repo has a remote, Claude does a regular push to its task branch and opens a draft PR if the job calls for one. You handle any merge.
You can tell Claude to leave commits or pushes to you in the task, CLAUDE.md, or memory.
Deleting a session from agent view can delete the worktree Claude created, including uncommitted changes. Commit anything you want to keep. If Claude Code refuses to delete the session because its worktree has unpushed commits, push those first.
Agent Teams Coordinate Through a Shared Task List
A lead session assigns work and pulls the results together. Each teammate runs in a separate Claude Code session with its own context and can message other teammates directly. Teammates with the task tools can also claim work from a shared list.
Per the docs, you can have teammates review different parts of a change and compare findings. For a bug with several possible causes, each teammate can test a hypothesis and check the others’ evidence. For a feature, you can divide the work by module or assign the frontend, backend, and tests to different teammates.
Agent teams are off by default. To enable them, add this setting under env in settings.json.
1
2
3
4
5
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
}
}
Once they are on, ask Claude for a team in plain language. For example, “Start three teammates and have each one investigate a different possible cause.”
- Teammates share a working directory. If two teammates edit the same file at the same time, one can overwrite the other’s changes. Assign each file to one teammate.
- With agent teams enabled, a subagent Claude gives a name to launches as a teammate. Claude can form a team even if you didn’t ask for one.
- In that case,
isolation: worktreein the subagent file has no effect, and the teammate edits the main session’s working directory. Only a fork, or a spawn call that passesisolationitself, starts as a regular subagent. - Teammates start only in interactive mode. When you reopen a session with
/resume, any teammates that were running in the same process stay stopped. - Each session can have at most one team. Only the lead can add teammates.
Per the docs, a single session or a series of subagents works better for tasks that need to happen in order, edit the same file, or depend heavily on each other.
Dynamic Workflows Run Batches From a Script
Claude writes a JavaScript script for your task and uses it to run subagents in the background. The script keeps the intermediate results and sends the final output back to the main session. That lets you migrate hundreds of components in batches or have a second group of agents check the first group’s findings.
In an interactive session, include ultracode in your prompt to ask Claude to create a workflow.
1
ultracode: check every API endpoint under src/routes/ for missing auth checks
Once the run starts, /workflows shows the current stage and how many agents have finished. To try an existing workflow, run /deep-research. It searches in several directions, checks sources against each other, and returns a report with citations.
The workflow docs list no worktree setting for agents. For parallel edits, the official example asks for each edit to happen in an isolated copy. If you need that separation, specify it in the prompt.
- By default, up to 16 agents can run at once, depending on how many CPUs Claude Code can use. A single run can start at most 1,000 agents.
- A workflow pauses on its own only for permission prompts or certain usage limits. To review one stage before the next one starts, run the stages separately.
- To resume a stopped workflow, ask Claude to relaunch the same script in the same session. It can reuse saved results, but any agent that was still running when you stopped has to run again.
Which Approach Fits Your Task?
If two changes depend on each other or both need edits to the same file, start in the main session. When work can proceed in parallel, decide who should assign it and how the agents should coordinate.
flowchart TD
A{Can tasks run separately?} -->|No| B[Main session]
A -->|Yes| C{Assign them yourself?}
C -->|Yes| D[Agent view]
C -->|No| E{Need shared task list?}
E -->|Yes| F[Agent teams]
E -->|No| G{Need batches or cross-checks?}
G -->|Yes| H[Dynamic workflows]
G -->|No| I[Subagents]
| Task | Pick | Why |
|---|---|---|
| Find every caller of a function | Subagent (Explore) | You need the call sites, and the search output can stay with the subagent |
| Fix three unrelated bugs at once | Agent view | You can check each fix on its own, and newly dispatched sessions edit separate copies by default |
| Investigate a production bug with three plausible causes | Agent teams | Teammates can test separate hypotheses and challenge each other’s evidence |
| Migrate hundreds of files | Dynamic workflows | The script can process and verify the changes in batches |
| Make a small change that needs feedback as you go | Main session | You can work through the details with Claude directly |
How Much Usage Do Extra Agents Consume?
Each agent makes requests that count toward your usage. Parallel runs usually use up your quota faster. The number of tokens depends on the model and the work.
| Approach | Usage per the docs | How to spend less |
|---|---|---|
| Subagents | Each subagent sends its own requests | Use model: haiku for simple tasks, or a fork when the agent needs the full conversation |
| Agent view | Ten background sessions in parallel use quota about ten times as fast as one | Run jobs separately when they can finish independently |
| Agent teams | With teammates in plan mode (planning before editing), a team uses about 7 times as many tokens as one standard session | Use Sonnet, start with a small team, and shut down teammates when done |
| Dynamic workflows | A workflow can use more tokens than doing the same job in the main session | Try it on one directory and check each agent’s usage in /workflows |
By default, a run that schedules more than 25 agents or expects to use over 1.5 million tokens shows a Large workflow warning. The run keeps going, and you can stop it from /workflows.
With /effort ultracode on, Claude decides which tasks in the current session need workflows. Claude Code skips the Large workflow warning in this mode, and you may hit subscription limits sooner. Use /effort ultracode off when you return to routine work.
Start With a Test Log
I’d suggest starting by handing a test log to a subagent. Type the prompt below in Claude Code, and the main session gets back only the first failed test and where it failed.
1
Use a subagent to read test.log and report only the name of the first failed test and the file and line where it failed
Further Reading
- How Claude Code’s other settings fit together. Claude Code Tutorial: Hooks, Sandbox, Plugins, Worktrees
- Set up separate working directories by hand. git worktree for AI Agents: Run Two Agents in One Repo
- Manage tools such as Claude Code and Codex in the same terminal. herdr Tutorial: Run Multiple AI Agents in One Terminal
