One “superagent” for everything is a typical beginner architecture mistake: the context gets polluted, instructions conflict, and errors pile up until fixing them becomes expensive. Practitioners assemble a stack of roles: a cheap planner, a strong executor, a narrow specialist, an outside observer. This breakdown covers four roles, working subagent configs in Claude Code, a minimal pipeline on a raw API, and task delegation rules under which, per practitioners’ experience, the probability of error drops to zero.
The four roles of a working stack: from a cheap planner to a fresh observer
The division of labor solves two problems at once: each role’s context stays clean, and the cost of a mistake scales with the importance of the step. A typical stack from practice looks like this.
- Planner (a cheap model). Breaks the task into steps and produces specs: the goal, the constraints, the readiness criterion. Runs cheaply and often, and plan errors at this stage cost pennies. In practice: “the plan on DeepSeek Flash”.
- Executor (a mid-tier or strong model). Works to the spec: code, texts, edits. Sonnet-class for routine, Opus for the hard parts.
- Narrow specialist. “Designer: nothing but markup” — a model plus an instructional filter. The narrower the role, the smaller the surface for errors.
- Observer (a cheap model). Reviews the executor’s result against the spec. A fresh head without execution context catches confidently wrong spots that the executor itself never notices.
The observer is the underrated role: the executor believes in its result because it saw every step, while the observer compares the result only against the criterion. Choosing a model for each role is a separate decision; a breakdown by task class is in our piece on choosing a model for the task.
Subagents in Claude Code: a config in .claude/agents in five minutes
Claude Code can delegate tasks to subagents: each one has its own context window, its own toolset, and its own system prompt. The main agent receives only the final report, so its context is not polluted by intermediate output.
A subagent is described by a Markdown file with frontmatter. Files in .claude/agents/ inside a project work for the whole team; files in ~/.claude/agents/ are personal. An example observer:
---
name: spec-reviewer
description: Review the result against the spec. Run after every major edit.
model: haiku
tools: Read, Grep, Glob
---
You are the observer. The execution process was not shown to you: there is only the spec and the result.
Check the result against the readiness criterion from the spec and return a verdict:
PASS or FAIL with a reason. Do not suggest rewriting everything — only a list of discrepancies.Frontmatter fields: name — the name for invocation, description — when the main agent should delegate (automatic task routing keys off it), model — sonnet, opus, haiku, or inherit, tools — an allowlist of tools (without the field, all are inherited). Creating and editing subagents is easiest with the /agents command. The field set is current as of fall 2026.
You cannot set up a planner on a third-party cheap model in Claude Code: the model field accepts only Anthropic models. Roles across different providers are assembled in multi-provider wrappers — OMP practice is covered in our review of multi-provider CLI wrappers. The same piece describes Vibe Mode: the main agent becomes the supervisor and subagents solve the tasks. More tokens and time are spent, but per practitioners’ reports the probability of error drops to zero.
A pipeline on a raw API: plan, execution, review
The three-role scheme can be assembled without wrappers too — on an API in the OpenAI-compatible format. The models are set by environment variables, the roles by system prompts:
# roles.py — pipeline: planner, then executor, then observer
import os, json, urllib.request
def call(model, system, user):
body = {
"model": model,
"temperature": 0.2,
"messages": [
{"role": "system", "content": system},
{"role": "user", "content": user},
],
}
req = urllib.request.Request(
os.environ["LLM_BASE_URL"].rstrip("/") + "/chat/completions",
data=json.dumps(body).encode("utf-8"),
headers={
"Content-Type": "application/json",
"Authorization": "Bearer " + os.environ["LLM_API_KEY"],
},
)
with urllib.request.urlopen(req, timeout=120) as resp:
return json.loads(resp.read())["choices"][0]["message"]["content"]
PLANNER_SYS = ("You are the planner. Break the task into steps and produce a spec: "
"the goal, the constraints, the readiness criterion. No code.")
EXECUTOR_SYS = "You are the executor. Work strictly to the spec. Output only the result."
REVIEWER_SYS = ("You are the observer. The process is unknown to you: there is a spec and a result. "
"Answer PASS or FAIL with a reason.")
task = "Add retry with exponential backoff to the file uploader"
spec = call(os.environ["PLANNER_MODEL"], PLANNER_SYS, task)
result = call(os.environ["EXECUTOR_MODEL"], EXECUTOR_SYS, spec)
verdict = call(os.environ["REVIEWER_MODEL"], REVIEWER_SYS,
"SPEC:\n" + spec + "\n\n" + "RESULT:\n" + result)
print(verdict)The key detail is the observer call: it receives the spec and the result, but not the executor’s transcript. This is not thrift, it is method: an observer without execution context evaluates fit to the criterion, not the executor’s “diligence”. On a FAIL verdict, the result comes back to the executor together with the reason, and the cycle repeats until PASS or until a stop condition.
The spec as a contract: four rules for delegating tasks
- The spec is a contract. The planner produces a spec: goal, constraints, readiness criterion. The executor works only from it; “make it nice” without a criterion is not a task, it is a rework generator. The full method for preparing such documents is in our piece on the PRD method for agents.
- One task — one subagent. Mixing roles in a single context brings back all the superagent mistakes: instructions conflict, the context grows, attention smears.
- Review by a separate head. The observer does not see the process — only the result against the spec. Cleanness of view matters more than speed.
- Escalation by complexity. Cheap executor, then failure, then strong executor, then failure — and only then a human. The escalation pyramid saves flagship tokens.
A minimal spec template is four lines:
Goal: what must exist after the task is done
Constraints: files, stack, what must not be touched
Readiness criterion: how we verify (a test command, a checklist)
Stop conditions: when to come back to a humanThe economics of roles: escalation, cache misses, and agent teams
The escalation pyramid
A cheap executor’s failure is not a verdict on the model but a signal: the task is harder than the planner thought. The task goes to the strong executor, and only after a second failure does it go to a human. Ready-made switching schemes are collected in our piece on fallback chains.
Tokens and cache
Subagents are more expensive in tokens: each carries its own context, and total spend is higher than for a single agent — but cheaper in rework: an error caught by the observer at an intermediate step costs several times less than redoing the final result. The “cheap worker versus flagship” math in numbers is in our piece on worker and flagship costs.
A separate trap is the cache: with a batch of subagents it breaks — every subagent starts from a cold prefix, that is, from a miss. Keep a stable prompt head for each subagent and run subagents on rare, complex tasks rather than routine — the discipline is covered in our piece on prompt cache discipline.
Agent teams in practice
The Tina Huang case: parallel agent teams — a stock research group and a software development team with research, product decisions, and code kept apart inside it. Another scenario: several agents at once on different matters — research, calendar, a marketing campaign. Team architecture: each team has its own context, memory, and channel, with coordination through a human or shared files.
Common questions
How many subagents is optimal? Per task, 2–4: planner, executor, observer. More, and coordination overhead eats the benefit of role separation.
Cache with a batch of subagents? It breaks: every subagent is a prefix miss. The discipline is simple: subagents are for rare, complex tasks, not for routine.
Who watches the subagents? The lead main agent (in OMP that is the Vibe Mode role) or a human; in teams, the human reads the digests.
Where to start? Two roles: a cheap planner plus a strong executor. Add the third role — the observer — when errors become noticeable and expensive.
Roles turn “one smart model” into a system with a division of labor: the planner is cheap, the specialist is narrow, the observer is fresh. A concrete first step: open the /agents command in Claude Code and create the reviewer subagent from the example above — with a PASS or FAIL verdict against the spec. Add the second and third roles when the errors the observer catches pay for the hour of setup. The schemes come from OMP and Cowork practices of fall 2026.
