When Should You Use a Subagent? Check Isolation First
Use a subagent when the task can return a bounded result without competing for the same files. Keep coupled implementation with one owner.
The answer
Use a subagent for independent research, inspection, or analysis that returns a bounded result.
Use an isolated agent or worktree for an independent task that writes files.
Keep one agent when tasks edit the same files or depend on shared intermediate decisions.
The deciding factor is isolation, not task count.
Good subagent work
A good subagent task has a narrow question, enough context, and a clear return format.
Examples include:
- inspect one package and report its public API;
- compare two official documents;
- run read-only checks against one subsystem;
- find all callers of a changed function;
- review a diff without editing it.
Anthropic’s official subagent documentation describes subagents as separate context windows with their own prompts and tool access. That separation helps when the delegated context does not need to stay in the main thread.
The main agent must still integrate and verify the result.
Bad subagent work
Do not delegate a task only because it sounds large.
Avoid a subagent when:
- both agents will edit the same component;
- one task depends on decisions still forming in the other;
- the main agent must repeat the full investigation to trust the result;
- the handoff is longer than the task;
- ownership of tests or final integration is unclear.
Two agents writing one file can create a read-think-write race. The second write can replace the first without a useful conflict signal.
The parallel-agent overwrite guide explains file partitioning and worktree isolation.
Use this ownership ladder
| Task shape | Choice | Ownership rule |
|---|---|---|
| Small and coupled | One agent | One context owns the full change |
| Independent and read-only | Subagent | Return evidence, not edits |
| Independent and separate files | Agent with explicit paths | Do not touch files outside the assignment |
| Independent but repository-wide | Separate worktree | Isolate index, branch, and commits |
| Same files | One agent | Sequence the work instead of parallelizing it |
This ladder keeps parallelism proportional to the real isolation available.
Write a bounded assignment
A subagent prompt needs five parts:
- One concrete question or deliverable.
- The exact files or sources it may inspect.
- An explicit avoid list.
- A return format with evidence.
- A statement that the main agent owns integration.
“Research this repository” is not bounded. “Inspect these three files and return every call site with line references” is bounded.
For writing tasks, add explicit file ownership. Do not allow broad staging. The unrelated-file commit guide explains why explicit paths matter.
Context isolation is useful, not free
A separate context prevents one investigation from crowding the main task. It also hides the main agent’s evolving decisions unless you send them.
Use a subagent when the return can stand alone. Do not use one for constant back-and-forth.
Read-only research is the safest starting point. Parallel file writes need stronger isolation and a final integration owner.
The default decision
Default to one agent. Add a subagent only when you can state the boundary in one sentence.
If the task writes files, name the exact owned paths. If ownership cannot be separated, sequence the work.
Use which coding agent should you use to choose the primary workflow. Use MCP vs skills when the delegated task needs a new capability or a repeatable procedure.
Decision check
Should this task use a subagent?
Choose the task shape and file overlap. The result tells you when delegation helps and when it creates risk.
Recommendation
Open the matching guide →Need OpenClaw fixed live?
Remote rescue sessions for gateway, auth, tunnel, VPS, and model access problems.
See Rescue Session