Orchestration, subagents and people in the loop

  • Advanced
  • 30 min
  • Lesson 5 of 7 in Harness engineering
  • Last verified

Open slides(26 slides)

Before you start

You will be able to

  • Explain subagents as context isolation first, and say what they cost in tokens and when they do not pay.
  • Write a delegation contract for a subagent and hand work over through artefacts and structured results, not transcripts.
  • Split building from checking, and route models by step type, with the cost of each split stated.
  • Isolate parallel agents that share a codebase, with one owner per artefact and a way to integrate.
  • Place people at intent, irreversible actions, escalations and the steering loop, and describe an autonomy ladder.

Three agents work through the same ticket queue, with a supervisor agent watching over them.

First, the supervisor checks every action and the queue crawls. Next, it checks only the end result and misses the problems. By the third day, two agents have picked up the same ticket and neither noticed the other.

Where should the supervisor step in, and when should it not step in at all?

Concept

The earlier lesson on multi-agent systems covers the patterns (a fixed chain, routing, parallel branches, an orchestrator with workers, an evaluator loop) and what multi-agent designs cost. This lesson takes the harness view. Once a task is split, the harness has to decide how work is handed over, who checks it, where each agent works and where a person sits. Those decisions determine whether a split helps or only multiplies the problems.

The default stays what Anthropic’s December 2024 post recommends: look for the simplest solution that works and add complexity only when it measurably improves the outcome. For many tasks, one well-built call with retrieval is enough. A workflow, with its steps fixed in code, is cheaper, more predictable and easier to test than an agent that decides every step, and an agent is cheaper than a team of agents.

Why It Matters

Splitting a task can fail in ways a single agent cannot: handoffs lose detail, two agents do the same work, one agent’s error becomes another’s input, and a trace of five agents is harder to read than a trace of one. Each of those is a harness problem. The same techniques also give you real benefits when the task fits, such as keeping a long job’s context clean or having something other than the author check the work.

Mental Model

The supervisor agent cannot be everywhere, and where it steps in changes what it can see. If it checks every action, work crawls. If it checks only the end, it sees too little too late. The useful move is often to change the jobs, not the supervisor’s position: give each agent a separate slice of the queue so they cannot pick up the same ticket, hand each a brief saying exactly what the job is and what to return, and have the supervisor look only at what comes back. That is a contract, an isolation boundary and a review point, which are the three ideas below.

Subagents are context isolation first

A subagentSubagentAn agent that works in its own context window on a delegated task and returns a short result, which keeps the parent agent's window small. It costs extra tokens.Open the glossary entry runs in its own context window, does messy exploration there, and returns a short result. Anthropic’s context-engineering post (29 September 2025) describes specialised subagents that explore at length and return a condensed summary, often 1,000 to 2,000 tokens, to the lead agent. The parent’s window stays clean and the exploration stays out of it.

Diagram: A parent sends tasks with constraints to two subagents, which each explore in their own windows and send back only a short result and...

task and constraints

task and constraints

short result and file pointers

short result and file pointers

Parent agent: context stays small

Subagent A: explores at length

Subagent B: explores at length

Diagram summary: A parent sends tasks with constraints to two subagents, which each explore in their own windows and send back only a short result and pointers to files.

Isolation has a price, and Anthropic’s multi-agent research write-up (13 June 2025) gives the scale for their system: agents used about four times the tokens of a chat, and multi-agent systems about fifteen times. In their analysis token use alone explained 80 percent of the variance in one benchmark. So you pay for the isolation and the parallelism. It is worth it for broad searches, large reads and independent checks over valuable tasks; it is not worth it for small tasks or for work where all agents need the same context. The same post says most coding tasks have fewer parallel parts than research does.

The delegation contract

Vague delegation produces duplicated work and lost detail. The same write-up reports subagents misinterpreting instructions and repeating searches until each task was given an objective, an output format, guidance on tools and sources, and clear boundaries. A usable contract states:

  • The objective and what a good result looks like.
  • Constraints: scope, what is out of bounds, a budget.
  • Allowed tools, and which of them can change anything.
  • Output format: a structure the parent can read without re-reading the work, with pointers to files for the detail.
  • A stop condition, and where to write any artefacts.
Diagram: A delegation is a contract.

delegation brief

structured result and file pointers

Parent agent

Objective and what good looks like
Constraints and budget
Allowed tools
Output schema
Stop condition and where to write files

Subagent

Parent validates the schema

Diagram summary: A delegation is a contract. The parent sends a brief with an objective, constraints, allowed tools, an output schema and a stop condition. The subagent returns a structured result with file pointers, and the parent validates it before using it.

Pass state through files and structured results, not through long chat transcripts. Give messages between agents a schema and validate them. Make handoffs resumable with job identifiers and status fields, and name one owner for each artefact so that two agents never edit the same thing.

Building and checking are different jobs

An agent that writes the work and also approves it has an obvious conflict. Two splits help. First, a separate checker, such as a second agent with different instructions or, better, a deterministic test, as in the previous lesson. Second, agreeing what done means before the work starts, so that the checker is not moving the goalposts and the builder is not certifying itself. Anthropic’s post on evaluating agents (9 January 2026) makes a related point: grade what the agent produced, not the path it took, and read transcripts to find out whether a grader is rejecting valid work. Expect a cost: a builder and a checker add a second pass over each unit of work, which is worth paying when a defect is expensive.

Diagram: The agent that builds does not certify its own work.

pass

fail

Builder writes the work

Separate checker:
deterministic test or a different agent

Agree 'done' before work starts

Accept

Diagram summary: The agent that builds does not certify its own work. A separate checker, ideally a deterministic test, accepts or rejects it against a definition of done that was agreed before the work began, so neither side moves the goalposts.

Routing models by step is the other split. Use a stronger model for planning and for ambiguous steps, and a smaller, faster one for extraction, formatting, classification and routine checks, with a fallback to the stronger model when confidence is low. Decide by step type, risk and the size of the context, and re-evaluate the routing whenever a new model appears. Switching models in the middle of a conversation can discard cached context, so route at the boundaries of work where you can.

Parallel agents on one codebase

Several agents editing one repository raises merge conflicts, duplicated work and inconsistent assumptions, plus shared resources such as ports and databases. The mitigations are mostly isolation and ownership: a separate working copy or container for each task, ownership by directory or module, a queue with locks for shared resources, small changes, and a final integration step (an agent or the CI pipeline) that decides what merges. This is an unsolved area. In our judgment, expect coordination overhead to grow faster than throughput, and measure before adding agents.

A practice is also right only under its operating conditions. If a team merges with minimal blocking review because correction is cheap and waiting is expensive, that reflects its throughput and test coverage. It would be a poor choice in a low-volume or high-risk setting. In an interview, state the conditions before you copy a practice.

People in the loop

Böckeler’s phrase is that the human steers the agent by iterating on the harness: when an issue recurs, improve the controls so it becomes less likely. Experienced developers carry an implicit harness of conventions, accountability and organisational context that agents lack, and the aim of a good harness is to direct human attention to where it matters most, not to remove it. Put people at:

  • Intent and acceptance, before the work starts.
  • Irreversible or high-impact actions, as approval gates.
  • Escalations, when the agent says it needs a judgment.
  • The steering loop, where they read traces and turn recurring failures into guides, sensors and hooks.

One way to frame autonomy is a ladder: suggest only, act with approval, act and notify, act alone. Move each kind of action up a rung as evidence builds, not the whole agent at once. How much autonomy to give depends on how reversible the action is, how much damage it could do and how strong your verification is.

Diagram: Autonomy is a ladder with four rungs.

Suggest only

Act with approval

Act and notify

Act alone

Evidence builds, per kind of action

Diagram summary: Autonomy is a ladder with four rungs. Each kind of action moves up one rung at a time as evidence accumulates, not the whole agent at once, and how far up depends on reversibility, possible damage and the strength of verification.

Recurring background agents, such as one that finds stale documents and proposes fixes, can belong to the harness too, as housekeeping against drift. Cap how many changes they may open at a time, and review them as you would a person’s.

Real-World Application

An agent fleet that migrates 200 tables. A planner writes a task file listing each table with its checks, which becomes the contract. Workers each take one table in their own working copy and write results to a status file, one owner per table. A checker runs the migration checks, not the worker. A queue limits concurrency so the database is not overloaded, and an integration step merges in order. Budgets per worker and a cap on how many workers run at once stop a loop from multiplying. A person approves the plan and any destructive step, and reads the failures each morning to improve the checks.

Interview Perspective

Expect: “When would you split a coding task across agents, how do they hand off, and who checks the work?” “Five agents are editing one monorepo and conflicts are rising. Redesign it.” “Design autonomy levels for an SRE agent that can restart services, roll back deploys and page people.”

A strong answer starts with the simplest design that could work, uses subagents for isolation and says what that costs, gives a contract, passes artefacts, separates builder from checker, isolates parallel work, caps fan-out and budgets, and says where people sit. Common mistakes: multi-agent by default because it is modern; subagents that share the parent’s context; letting the builder grade itself; unbounded spawning; passing giant transcripts; copying a practice without its conditions. A misconception to watch for: “more agents means more capability.”

Provenance: Common industry pattern. These are typical of agent-engineering interviews; none is verified for a named company.

Practice Questions

  • Basic: Give two reasons to use a subagent and one reason not to.
  • Intermediate: Convert a single-agent research-and-write flow into a planner, workers and a checker, and state what it adds in cost.
  • Advanced: Five agents are editing one monorepo and conflicts are rising. Redesign isolation, ownership and integration.
  • Product-Company: Define autonomy levels for an SRE agent that can restart services, roll back deploys and page people.

Activity

Pick a task you would give to several agents. Write the one-paragraph contract for one subagent (objective, constraints, tools, output format, stop condition). Then estimate the extra tokens: the work each subagent does, plus the parent’s growth from the results, and say whether the task is valuable enough to pay for them.

Homework

Design the orchestration for an overnight agent that merges small dependency updates. State the pattern you start with and why, what each agent is given and returns, where each works, who checks, the caps on parallel work and spending, the rungs of its autonomy ladder, and what a person reads in the morning.

Quick Revision

  • Start with the simplest design that works; add agents only for measured gains.
  • Subagents isolate context and return short results; you pay in total tokens (about 4 times for agents, about 15 times for multi-agent systems in Anthropic’s system).
  • Delegate with a contract: objective, constraints, tools, output format, stop condition. Pass artefacts, not transcripts; one owner per artefact.
  • Builder and checker are separate, with done defined first; route models by step and re-test the routing.
  • Parallel work needs isolation, ownership, a queue and an integration step; practices are right only under their conditions.
  • People sit at intent, irreversible actions, escalations and the steering loop; raise autonomy per action as evidence builds.

Check yourself

  • Walk-through: When would you split a coding task across agents, how do they hand off, and who checks the work?
  • Variation: Do it again for a fleet that migrates 200 database tables.
  • Common misconception: “More agents means more capability.” More agents means more cost, more handoffs and more ways to fail unless the task needs them.

Resources & Further Reading

Checked sources to go deeper. The essential ones come first in each group.

Official documentation

  • Agent Harness (opens in a new tab)

    Microsoft Learn (Agent Framework)2026Documentation

    Shows one framework's harness with optional background child agents, tool approval and session-scoped file access, a concrete example of isolation and approval gates.

Further reading

Hands-on

More for this module: Harness engineering resources

Practice

Test what you just read. Quizzes and cards are grouped by module: Harness engineering.

Check yourself10 questions on what this lesson set out to teach

Checking answers needs JavaScript. You can still read every question and option below.

0 of 10 answered

Keyboard: arrow keys move between options. Space or Enter selects the focused option.

ObjectiveExplain subagents as context isolation first, and say what they cost in tokens and when they do not pay.

  1. Question 1 of 10What is the main reason to send a broad codebase search to a subagent?

    Choose one answer.

  2. Question 2 of 10Two subagents each use 60,000 tokens exploring and each returns about 1,000 tokens. What happens to the parent's context and to the total bill?

    Choose one answer.

ObjectiveWrite a delegation contract for a subagent and hand work over through artefacts and structured results, not transcripts.

  1. Question 3 of 10Which belong in a delegation contract for a subagent? Select all that apply.

    Choose all that apply.

  2. Question 4 of 10A subagent returns a long narrative of everything it read, and the parent's window fills up. Which contract field was missing?

    Choose one answer.

ObjectiveSplit building from checking, and route models by step type, with the cost of each split stated.

  1. Question 5 of 10Why should the agent that wrote a change not be the only judge of it?

    Choose one answer.

  2. Question 6 of 10Which model-routing rule fits best?

    Choose one answer.

ObjectiveIsolate parallel agents that share a codebase, with one owner per artefact and a way to integrate.

  1. Question 7 of 10Five agents working on one repository keep producing conflicting changes. Which set of measures fits best?

    Choose one answer.

  2. Question 8 of 10A team merges with minimal blocking review and reports good results. What should you do before copying the practice?

    Choose one answer.

ObjectivePlace people at intent, irreversible actions, escalations and the steering loop, and describe an autonomy ladder.

  1. Question 9 of 10Where should a person sit in an agent that can roll back deployments?

    Choose one answer.

  2. Question 10 of 10What does moving up an autonomy ladder look like?

    Choose one answer.