Codex subagents: clean fan-out without polluting context
Subagents help when a task really splits apart. Otherwise they add cost, latency, and noise. Here's the grid for using them cleanly.
Duration
9 min
Level
Advanced
Tools
Codex · Subagents
Subagents quickly make it feel like you have a team.
The trap is that the team sometimes works on a problem that only needed one careful read. You get four answers, three confidence levels, duplicates, and you still have to integrate the whole thing mentally.
Clean fan-out starts with one question: are these investigations independent?
1. When it is worth it
Use subagents when branches of work can move without stepping on each other.
Good cases:
- compare three architecture approaches;
- inspect five independent folders;
- check security, tests, performance, and UX on the same PR;
- prepare editorial angles from multiple official sources.
Bad cases:
- fixing one function in front of you;
- writing one short article;
- doing research where each step depends on the previous result;
- delegating only because the task is fuzzy.
Parallelism does not fix poor framing.
2. Require a normalized output
The parent must be able to compare results. Otherwise you get different formats and lose the benefit.
Useful prompt:
Spawn 4 subagents.
Each subagent must answer with:
- main finding;
- evidence with paths or sources;
- risk;
- recommendation;
- confidence: low, medium, or high.
Wait for all results and consolidate.
This forces agents to produce actionable evidence, not mini-essays.
3. Keep the parent as decision-maker
A subagent explores. The parent decides.
Do not ask every agent to propose a complete change to the same file. You will create incompatible recommendations. Ask instead:
- “find the risks”;
- “list the affected files”;
- “check whether a constraint exists”;
- “propose an angle, not the final patch”.
The final patch should remain consolidated in the main session.
4. Limit depth
Recursive fan-out is tempting, but it explodes quickly. One agent spawning three agents, each spawning three more, is not a team. It is a bill and a tree you cannot review cleanly.
For a blog, one level is enough:
- parent: decides the topic;
- agents: research sources, angles, conflicts;
- parent: writes or chooses.
5. Checklist before spawning
Before using subagents, check:
- tasks are independent;
- each agent has a clear question;
- output is normalized;
- the parent keeps final decision;
- token cost is worth the time saved.
If one point is missing, stay single-agent.
Sources
Keep learning