Subagents
What it is
A subagent is a separate AI agent that your main agent can spawn to handle a focused piece of work. It runs in its own context with its own instructions, does the job, and reports back a result. Because each subagent starts fresh, the main conversation stays clean — the details of a side task don't crowd out the work you actually care about.
Strengths
- Keeps the main context uncluttered by offloading detail-heavy side tasks.
- Lets you run independent work in parallel, which can be much faster.
- Each subagent can be specialized — a reviewer, a searcher, a tester — with its own focused prompt.
- Failures stay contained: a subagent that goes wrong doesn't derail the whole session.
Trade-offs
- A subagent only knows what you pass it; missing context leads to off-target results.
- Spawning many agents costs more tokens and can get expensive.
- You only get the summary back, so nuance from the side task can be lost.
- Coordinating several at once adds its own complexity.
When to use it
Use subagents when a task is self-contained and would otherwise bloat the main thread — searching a large codebase, reviewing a diff, or running several independent investigations at the same time.
Vibe coding fit
Subagents are how you scale an agent's attention. Hand the noisy, exploratory work — "find everywhere this is used," "review this for bugs" — to a subagent and keep the main agent focused on the plan. Be explicit about what each subagent should return, since you get its conclusion, not its full transcript.
Spawn a review subagent:
task: "Review the diff in src/auth for security issues."
return: "A short list of concrete problems, or 'no issues found'."