I pitted one Claude agent against a team of subagents. The team found one more bug and cost twice as much.
Anthropic says one agent often beats a crowd of subagents. I tested it on a code audit with 12 planted bugs, seven runs, and a hidden answer key. The result was less tidy than the advice, and more useful.
The team found 1 more bug at twice the cost
Level: Intermediate. About 30 minutes. Needs Node 20+ and a Claude Code login.
Subagents are one of the most tempting features in Claude Code. Give each specialist its own job and its own clean slate, and surely the team beats the generalist.
Anthropic's own advice points the other way. A recent guide from their Applied AI team says many agent setups would do better as one agent with the right instructions, because every subagent is another model loop you pay for, and every handoff loses detail.
I couldn't tell who was right from reading. So I ran the same job both ways and counted.
The test: audit a small app
I wrote a 10-file Node app with 12 problems hidden in it, and kept the answer key where Claude couldn't see it.
Seven are security issues: a hardcoded secret, MD5 password hashing, a delete function with no permission check, path traversal, command injection, a regex built from user input, and session IDs made with Math.random().
Five are performance problems: a file read that blocks the server, a query per user in a loop, an O(n²) dedupe, a regex rebuilt inside a loop, and a cache that grows forever.
One more thing I planted on purpose: the file read inside the request handler looks completely normal. It's the kind of thing you read past.
Setup 1: one agent does everything
claude -p "Audit this repo for security and performance problems. Write audit.md with one finding per line: file:line, severity, what is wrong, one-line fix."
That's it. No agents, no config.
Setup 2: two specialist subagents
A subagent is just a markdown file in .claude/agents/. Here's the whole security one:
The performance one is the same shape, with a different job and a "don't report security issues" line. Both can only read files, not edit them.
Then I asked the main agent to use both, in parallel, and merge the results:
claude -p "Audit this repo for security and performance problems. Use the security-auditor and performance-auditor subagents in parallel, then merge their findings into audit.md with one finding per line: file:line, severity, what is wrong, one-line fix."
The scoreboard
I ran the single agent three times and the subagent team twice, scored every output against the key with a small script, and checked each miss by hand.
Here's the plain version.
- One agent: found 11, 11 and 12 of the 12. About 73 seconds and 37 cents per run.
- Two subagents: found 12 and 12. About 95 seconds and 77 cents per run, with one run costing 99 cents. That's roughly twice the cost and a third more time.
So the team won, but narrowly, and it paid for it. Anthropic's warning about cost held up exactly.
The bug a single agent kept walking past
Look at which finding was missing, because it's the same one every time. In both runs where the lone agent scored 11, it missed the blocking file read. Here's what each setup said about that one file:
The single agent was busy with the path traversal and the missing login check in files.js, both loud and obviously dangerous, and never got round to "this read also freezes the server for everyone." The performance subagent had exactly one question on its mind: what here is slow? So it spotted the file read in both runs.
That's the real reason to use a subagent. Not because it's smarter, but because it can only think about one thing.
Can I get the same effect without paying for it?
Anthropic's suggestion is to fold the specialist knowledge into one agent as a checklist instead. So I tried that: one agent, with the same two lists the subagents had, written into the prompt.
Check explicitly for security: secrets, weak crypto, injection, missing authorization,
path traversal, predictable randomness, unsafe regex. And performance: blocking I/O,
N+1 queries, quadratic algorithms, work repeated inside loops, unbounded memory growth.
It scored 11 and 12 of 12, in 63 and 69 seconds, at 36 and 40 cents. That's the cost and speed of one agent, and it landed in between on accuracy. In one run it still missed the blocking file read, even with "blocking I/O" written right there in the prompt.
I won't oversell that. Two runs can't tell a better prompt from luck. But it's cheap, it's the first thing to try, and if it fixes your blind spot you've saved the extra bill.
What I'd actually do
- Start with one agent. It's faster, it's about half the price, and in my test it was good.
- Write down what it keeps missing. For me it was one specific thing.
- Put that in the prompt as a checklist. Cheapest fix.
- Reach for a subagent when one concern keeps getting crowded out, or when the work is big enough that a fresh context per piece actually matters.
Anthropic's guide says the same thing in a different way: split by context, not by topic. My app is under 100 lines, so every file fit in one agent's head. A subagent earns its keep when that stops being true, and I didn't test that. (I also split my two subagents by topic, security and performance, which is exactly what that guide cautions against. It worked here because both were read-only and each returned a short list, but keep it in mind.)
What this test can't tell you
- It's seven runs on a tiny app. I'd want 20 per setup before I'd bet money on a ranking.
- I scored with a keyword script and checked every miss by hand, but a keyword script is still a rough ruler.
- The team also produced noisier reports: 20 findings in one run against 13 or 14 for a single agent, and a handful were low-value, like flagging a linear scan over a two-item list.
- Costs are what Claude Code reported. I'm on a Pro plan, so I wasn't billed per run.
If you only remember one thing: whether to use subagents isn't a question of power. It's a question of what your agent keeps overlooking, and whether you'd rather fix that with a better prompt or a second bill.
Sources
- https://claude.com/resources/articles/building-agents-when-to-fold-subagents-into-your-main-agent-loop
Editorial note: We ran the steps in this guide ourselves and the screenshots come from those runs. Your results may differ with your plan, model or settings, so check anything important. Cover illustrations are AI-generated. Discovia is independent and not affiliated with Anthropic.
New guides and tools
Hands-on Claude guides, straight to your inbox
Step-by-step walkthroughs of what's new in Claude and Anthropic's tools, with real screenshots and honest results, including what didn't work. No hype, no jargon, no noise.
By subscribing, you agree to receive newsletter and marketing emails, and accept our Terms of Use and Privacy Policy. You can unsubscribe anytime.
Agents Bench
Hands-on builds with agents, MCP servers and the API, tested including the failure cases.
More Agents & API guides →