Why subagents help: a 10-panel visual guide

2 min read


This is more like agentic engineering 102/103.

Once you get past the basics and start working on more complex or very long-running problems, another issue starts showing up: context pollution and context rot.

Subagents are one way to get around that.

(1) Typically, the workflow starts with the human giving requirements, constraints, and decisions to the main agent.

Clean input to main agent

Start with a clean main thread: requirements, constraints, and decisions.

(2) Then the main agent tries to handle the exploration, testing, and analysis needed to get the task done.

Main agent takes on too much

Without delegation, the same thread now has to hold both the executive context and the messy work.

(3) Logs, notes, errors, and results all start flowing back into the same main thread.

Noisy context accumulates

That thread gets noisy fast once intermediate output starts piling up.

(4) That is where context pollution and context rot start to show up.

  • Context pollution: useful instructions get buried under noisy intermediate output.
  • Context rot: as less relevant detail accumulates, performance drops and the session becomes less reliable over time.

Context pollution and rot

These are related but slightly different failure modes: burial under noise, and gradual degradation as too much irrelevant detail accumulates.

(5) Subagents move noisy intermediate work off the main thread.

Move noisy work off-thread

Delegation changes the shape of the problem: the main thread no longer has to carry every intermediate artifact.

(6) They do the messy work separately and return summaries instead of raw output.

Summaries come back

The important thing that comes back is the summary, not the full transcript of the messy work.

(7) That lets the main agent stay focused on requirements, constraints, decisions, and final outputs.

Main thread stays clean

The main thread stays useful for steering the work instead of drowning in it.

(8) It can keep going as new requirements come in without losing clarity.

Loop and redelegation

That cleaner loop is the real win: new requirements can arrive without derailing the session.

(9) In Codex, you can do this with built-in subagents or define custom ones.

Built-in and custom subagents

In Codex specifically, this can take the form of built-in subagents or custom ones you define yourself.

(10) And in practice, custom agents in Codex can be defined with a small TOML file.

Custom agent file example

The custom route is not especially complicated. In practice, the definition can be very small.

Although I wrote this with Codex in mind, because that is where I live and where I have already started implementing it, only items (9) and (10) are Codex-specific.

The principles from (1) to (8) should apply to any other basic agent workflow too.

Further reading