All chapters
  1. Start hereAn agent is a model call in a loop
  2. Chapter 1One call: what a model is from the outside
  3. Chapter 2The loop: where a call becomes an agent
  4. Chapter 3The abstraction ladder: six rungs over one call
  5. Chapter 4The eight jobs of a harness
  6. Chapter 5Context: deciding what the model sees
  7. Chapter 6Tools: what the model may ask for, and where it runs
  8. Chapter 7MCP: one way to plug tools into any harness
  9. Chapter 8RAG: retrieval is context assembly
  10. Chapter 9Control flow and state: stopping, pausing and resuming
  11. Chapter 10Guardrails: identity, approval and the output contract
  12. Chapter 11Reliability and cost: retries, budgets and the failures that will happen
  13. Chapter 12Observability and evals: knowing what the agent did, and whether it was right
  14. Chapter 13Many agents: more loops, and what each one costs
  15. Adopt · 1SDKs: the same loop in Python, TypeScript and Java
  16. Adopt · 2Coding harnesses: a finished harness for software work
  17. Adopt · 3Frameworks and graph runtimes: the loop as a library
  18. Adopt · 4Managed platforms: someone else runs the loop
  19. Adopt · 5Build your own: a whole harness in one file
  20. DecideBuild or adopt: who runs each job?
  21. ReferenceGlossary
  22. AboutAbout this site
Chapter 13

Many agents: more loops, and what each one costs

Several agents are several loops, each with its own context. Sequence, parallel and consult, why to split, what it costs, and when one loop is the better design.

In the full build of the quote example, the request for 18 Gulf Shore Blvd has reached stage 5. Code has run the 29 underwriting rules and the price. Some points came back flagged, so the harness starts an agent loop on the larger model to recommend on them.

Look at the first request of that loop. It holds the stage's own instructions, the definitions of the tools this stage may ask for, and a task. It holds nothing from stage 4. One stage earlier, a different agent loop on a small model spent up to six turns filling the form: it planned which data services to query, read what they returned, and asked to save the values. Not one of those messages is in front of the model now. The second loop does not know the first one existed.

So this system has two agents, and they never exchange a word. Is that a loss, or is it the design? And why two loops at all, when one loop with all thirteen tools could take the email and work through to a recommendation?

Many agents are many loops. Each loop has its own context, its own tools and its own limits. Code carries every exchange between them, and what that code passes on is the design.

1. Two loops that never meet#

The full build is a workflow: code fixes the order of seven stages, as The eight jobs describes. Four steps use a model. Two are single calls. The other two are agent loops, and they are the subject here. The figures below describe this build only; they come from the source build and were not measured again for this site.

Prefill (stage 4)Underwriting resolve (stage 5)
ModelA small modelA larger model
Turn limitAt most 6At most 10
Tool serverPrefill, 4 toolsUnderwriting, 5 tools: 2 called by code, 3 offered to the model
What its tools can doQuery the data services, save a value, flag a conflictRead the allowed fields, search past decisions, fetch comparable homes
Starts whenA tier is knownCode has run the rules and a point is flagged
Starts withThe request and the tierThe quote id and the flagged points

Between the two loops there is no conversation. Stage 4 ends by publishing an event, and the event carries the quote id, not the data. Stage 5 reads the fields it is allowed to see from the database. The picture shows the whole exchange.

Diagram: Two agent loops in the full build · they share a database row, never a conversation

Time runs down the page. The pipeline code starts each loop and runs the rules between them. Neither loop sends anything to the other: the first writes through its tools, the second reads through its own.

  1. Pipeline code to Prefill loop (small model): Start: the request and the tier. The pipeline starts the first loop with a new, empty history.
  2. Prefill loop (small model) to Database: Save each value, with its source. The model asks to save a field. The harness calls the tool, and the tool server checks the value before it writes.
  3. Prefill loop (small model) to Pipeline code: Done: an event with the quote id. The loop ends. The event carries the id, not the data. The loop's message history is not passed on.
  4. Pipeline code: Run the 29 rules and the price. Plain code. If every point is clear, the second loop never starts and no model is called.
  5. Pipeline code to Resolve loop (larger model): Start: the quote id and the flagged points. A second loop with its own instructions, its own tools and a new, empty history.
  6. Resolve loop (larger model) to Database: Read the fields this stage may see. The model asks for the fields. The harness calls a read tool on the underwriting server. This stage has no tool that writes a field.
  7. Database to Resolve loop (larger model): The stored facts. The second agent learns what the first one did from stored, checked values, not from the first agent's words.
  8. Resolve loop (larger model) to Pipeline code: A recommendation for each flagged point. The loop ends with a recommendation. A person decides in the next stage.

The prefill loop wrote to a database through its tools; the resolve loop read from that database through other tools. What connects the two agents is a row and an id.

Now the question from the opening. Suppose the team had built one agent: one loop, one model, all tools, from the email to the recommendation. Four things would change, and each has a cause.

The context would carry stage 4 into stage 5. A model keeps nothing between calls, so every turn resends the whole history (Context is the home of that idea). In one loop, the raw results of the prefill lookups would ride along on every later turn. Those tokens are paid for again on each call, and they sit between the model and the few facts the judgement needs.

The loop that judges could also write. A stage connects only to its own tool server. The prefill loop can ask to save a field; the resolve loop has no such tool, so no reply from its model can change the form. One agent would need both servers, and the line between "may write facts" and "may recommend" would become a sentence in a prompt. A prompt guides; it does not enforce (Guardrails).

Every turn would run on the larger model. Filling a form is narrow work and gets a small model. Weighing a flagged point is judgement and gets a larger one. One loop has one model for all of its turns.

The model would decide whether to judge at all. Between the two loops, code runs the rules and the price. If every point is clear, the second loop never starts and no model is called. In a single loop there is no "between": the code step would become one more tool the model may or may not ask for.

None of this says that two loops are better than one in general. In this build the two pieces of work differ in context, permissions, model and trigger, and a harness can keep those apart only by running separate loops.

2. One agent cannot call another#

The phrase "the agent calls another agent" hides the mechanism, in the same way "the model calls a tool" does. A model returns text and tool requests. When one agent appears to call another, some code received a request and started a second loop. That code may be your harness, a library or a vendor's runtime. In every case, coordination is ordinary code that you can read: control flow, state and a policy for failure.

So the bottom of this chapter is one function. run_agent is the loop from The loop, with three changes: the model, instructions and tools arrive as arguments, there is a turn limit, and each call begins with a new, empty message list.

The code below is a sketch written for this page. It is not part of the miniature in examples/quote-email/, and it was not run against a model; it compiles, and its control flow was exercised once with a stub in place of the model. It demonstrates what "an agent" means in the rest of this chapter: one description plus one run of the loop. It assumes a call_model function like the one in agent_minimal.py, extended to take the model, the system prompt and the tool definitions.

# Sketch for this page; not part of the miniature.
from dataclasses import dataclass, field
from typing import Callable


@dataclass
class AgentSpec:
    """Everything that makes one agent different from another. None of it is shared."""
    name: str
    model: str                                   # a small model for narrow work, a larger one for judgement
    system: str                                  # its own instructions
    schemas: list[dict] = field(default_factory=list)                    # the tool definitions the model is shown
    tools: dict[str, Callable[..., str]] = field(default_factory=dict)   # the functions the harness may run
    max_turns: int = 6


def run_agent(spec: AgentSpec, task: str) -> str:
    """The loop from agent_minimal.py, with a turn limit. Each call starts a new, empty history."""
    messages = [{"role": "user", "content": task}]          # the separate context starts here
    for _ in range(spec.max_turns):
        response = call_model(model=spec.model, system=spec.system, tools=spec.schemas, messages=messages)
        messages.append({"role": "assistant", "content": response["content"]})
        if response["stop_reason"] != "tool_use":
            return "".join(block["text"] for block in response["content"] if block["type"] == "text")
        results = [{"type": "tool_result", "tool_use_id": block["id"],
                    "content": spec.tools[block["name"]](**block["input"])}
                   for block in response["content"] if block["type"] == "tool_use"]
        messages.append({"role": "user", "content": results})
    raise RuntimeError(f"{spec.name}: no answer after {spec.max_turns} turns")

Three lines carry the idea. The first line of run_agent creates messages from the task and nothing else, so two runs can never see each other's history: that is the separate context. The call passes spec.model, spec.system and spec.schemas, so each agent has its own model, instructions and tool list. And a tool runs only if its name is a key in spec.tools, so an agent's reach is the dictionary it was given, whatever its model asks for.

The sketch leaves out most of a harness on purpose: no checkpoint, no retry, no budget, no output check, no trace. A tool name that is missing from the dictionary raises an error instead of returning a tool result marked as failed. Each of those belongs to one of the eight jobs, and each must exist once per loop.

The two agents of the full build, written as descriptions for this sketch. The model names are placeholders, and the instructions are shortened to one line.

# Sketch for this page; not part of the miniature.
SMALL, LARGE = "a-small-model", "a-larger-model"     # placeholders, not real model ids

PREFILL = AgentSpec("prefill", SMALL, "Fill the blank fields. Give a source for every value.", max_turns=6)
RESOLVE = AgentSpec("resolve", LARGE, "Recommend on each flagged point. A person decides.", max_turns=10)

3. Three ways to connect two loops#

There are only a few ways to combine two runs of run_agent. Each is a few lines. What differs is who decides that the second loop runs, and what the second loop is given.

Sequence: the output of one agent is the input of the next#

Code fixes the order. The first loop ends, and its final text becomes the task of the second.

# Sketch for this page; not part of the miniature.
def quote_in_sequence(request: str) -> str:
    facts = run_agent(PREFILL, task=request)        # loop 1 ends; its history is discarded
    return run_agent(RESOLVE, task=facts)           # loop 2 starts from the facts and nothing else

Everything the second agent knows about the first agent's work is in the variable facts. Whatever the first loop saw and did not write into its final answer is gone.

The full build is a sequence, with one difference that matters. It does not pass the facts as text. The event between the stages carries the quote id, and the second stage reads the fields it is allowed to see from the database. The source design gives the reasons: one source of truth, small events, and each agent gets only its own slice of the data.

What to pass: the history, a summary, or a pointerThree choices for a hand-off, and what each one risks

The harness takes the output of one loop and builds the input of the next. There are three things it can put there.

What is passedWhat the next agent getsWhat it risks
The whole historyEverything the first loop saw, including raw tool resultsThe context is not separate any more: the tokens, the noise and any untrusted text all travel
A summary written by the first modelA short textWhatever the summary leaves out is lost, and nothing reports the loss
A pointer to stored dataAn id; the agent reads what its tools allowThe data must be stored in a checked form first, which is more to build

The full build uses the third. It works there because the prefill stage does not end in prose: its tools write each value to a table, and the tool server checks a value before it writes. A pointer is only as good as what it points to.

Parallel: start several loops, wait, merge#

When several pieces of work do not depend on each other, the harness can start their loops together, wait for all of them, and combine the answers. Each loop has its own context window.

The three specialist agents below are invented for this illustration. Neither build of the quote example has them.

# Sketch for this page; not part of the miniature.
from concurrent.futures import ThreadPoolExecutor

ROOF = AgentSpec("roof", SMALL, "Assess the roof from the facts given.")
FLOOD = AgentSpec("flood", SMALL, "Assess the flood exposure from the facts given.")
WILDFIRE = AgentSpec("wildfire", SMALL, "Assess the wildfire exposure from the facts given.")


def review_in_parallel(facts: str) -> str:
    with ThreadPoolExecutor(max_workers=3) as pool:            # the harness owns the concurrency limit
        reviews = list(pool.map(lambda spec: run_agent(spec, task=facts), [ROOF, FLOOD, WILDFIRE]))
    merged = facts + "\n\nSpecialist reviews:\n" + "\n".join(reviews)   # the merge is plain code
    return run_agent(RESOLVE, task=merged)

Diagram: Parallel · three loops at once, three separate contexts, one merge in code

Read left to right. The harness starts the three loops together and waits for all of them. Each loop has its own message history. The specialists are invented for this illustration; neither build has them.

  1. 1 · Start
    1. Harness starts three loops: Plain code. It gives each loop the same facts and sets the limit on how many run at once.
  2. 2 · Three loops
    1. Roof specialist: One run of the loop with its own instructions and its own history. It cannot see the other two.
    2. Flood specialist: One run of the loop with its own instructions and its own history. It cannot see the other two.
    3. Wildfire specialist: One run of the loop with its own instructions and its own history. It cannot see the other two.
  3. 3 · Wait and merge
    1. Harness merges the three answers: Plain code. It also has to decide what happens when one loop fails or runs out of turns.
  4. 4 · Continue
    1. Resolve loop: A fourth loop. It starts from the facts and the three final answers, and sees none of the specialists' turns.

The three reviews take about as long as the slowest one, not the sum of the three. That is the gain. The harness now owns three things it did not own before: the limit on how many loops run at once, what happens when one of them fails, and the merge. In this sketch one failed specialist raises an error and the whole review is lost; a real harness has to decide that on purpose.

The full build has no parallel agents. Its parallel work happens one level down: the tool server runs the data services in four waves, in parallel inside a wave, and one model reply may hold several tool requests. Parallel tool calls inside one loop share one context. Parallel agents do not.

Consult: the specialist is a tool#

In the first two patterns, code decides that a second loop runs. In the third, the model of the first agent asks for it. The harness offers a tool, here ask_flood_specialist. When the model returns a tool request with that name, the harness does not query a database. It runs a second loop and returns that loop's final answer as the tool result.

# Sketch for this page; not part of the miniature.
def ask_flood_specialist(question: str) -> str:
    return run_agent(FLOOD, task=question)          # a second loop; only its final answer returns


RESOLVE.schemas.append({"name": "ask_flood_specialist",
                        "description": "Ask a flood specialist one question about this property.",
                        "input_schema": {"type": "object", "required": ["question"],
                                         "properties": {"question": {"type": "string"}}}})
RESOLVE.tools["ask_flood_specialist"] = ask_flood_specialist

To the first model, this is one more tool. It wrote a question, and a tool result came back. It never sees the specialist's turns.

Diagram: Consult · the first model asks through a tool, the harness runs a second loop

Time runs down the page. The two models never exchange a message. The harness receives a tool request from the first model, runs a whole second loop, and returns only that loop's final answer as the tool result.

  1. First model (resolve) to Harness: Tool request: ask_flood_specialist, with a question. An ordinary tool request. The question is the only thing the first model can send.
  2. Harness to Specialist model (flood): A new loop: instructions plus the question. The harness starts a second loop with a new, empty history. What it adds to the question is a design decision.
  3. Specialist model (flood): Its own turns and tool calls. The specialist's turns stay in its own context. Each one resends that context, and each one is paid for.
  4. Specialist model (flood) to Harness: The final answer. The loop ends. Its history is discarded unless the harness stores it for a trace.
  5. Harness to First model (resolve): Tool result: the answer, and only the answer. The first model receives one tool result. It cannot tell that a model wrote it, and it cannot see what was left out.

One string goes in: the question, which the first model wrote. One string comes out: the final answer. The specialist has none of the first agent's history unless the question repeats it. An agent started this way is called a subagent, and the agent whose model asked for it is often called the orchestrator.

The model asks, the harness decides and calls, the tool does. Here the tool is a loop.

A fourth pattern you will meet: the handoff#

Some products add one more. In a handoff, the harness swaps the instructions and the tools, and a second agent continues from the conversation history the handoff gives it. In a consult the first agent continues with an answer; in a handoff it does not continue at all. And because the history travels, a handoff does not give the second agent a clean context.

PatternWho decides that the second loop runsWhat the second loop starts withWhat comes back
SequenceCodeThe first loop's output, or a pointer to itNothing; the work moves on
ParallelCodeThe same task, or a part of itOne answer per loop, merged by code
ConsultThe first model, through a tool requestThe question the first model wroteThe final answer, as a tool result
HandoffThe first model, through a tool requestThe conversation historyNothing; the second agent answers the user

The second column decides how testable the system is. In the first two rows, code chooses the path, so it is the same on every run. In the last two, a model chooses, so whether the specialist is asked at all can differ between two runs on the same input.

4. What a split buys#

A second loop is a second run of run_agent, and the four arguments of that function are the four things a split can buy.

A separate context window. The second loop does not carry the first loop's history. The specialist can read twenty documents to answer one question, and only the answer enters the first agent's context. This is the most common reason vendors give: Claude Code's documentation says to use a subagent "when a side task would flood your main conversation with search results, logs, or file contents you won't reference again".

A narrower tool set and permission scope. Each agent gets its own dictionary of tools. In the full build this is a property of the network, not of a prompt: the resolve loop is connected to a server that has no tool for writing a field.

A cheaper model for narrow work. Each loop names its model. Narrow, repetitive turns can run on a small model while one stage of judgement runs on a larger one.

Parallel wall-clock time. Independent loops can run together, so the elapsed time is about that of the slowest loop.

A better answer is not on the list. A split changes what each model call contains and which tools it may reach. Whether that improves the result depends on the task.

5. What a split costs#

Each gain above has a price on the same axis. The honest accounting has five lines.

Total tokens usually go up. Every loop resends its own context on every turn: its instructions, its tool definitions and its growing history. Two loops mean two sets of instructions and tool definitions. The task that crosses between them is paid for twice, once as output of the first model and once as input of the second. There is a pull the other way: the second loop does not carry the first loop's history, which can save more than the overhead when that history is long. So the direction is not a law. For parallel and consult patterns the vendor reports point one way. Anthropic's account of its own multi-agent research system, published in June 2025, says that "agents typically use about 4× more tokens than chat interactions" and that "multi-agent systems use about 15× more tokens than chats". Those are that vendor's figures for that system, not a measurement of the quote example.

A hand-off loses whatever the summary leaves out. The first loop saw a detail, for example that two data services disagreed about the year the roof was replaced. If its final answer says only "roof: 2015", the second agent reasons from a fact that was never as certain as it now looks. Nothing in the second loop can show that something is missing.

Errors compound across agents. A wrong value from the first agent is not a tool error. It arrives as the task, in the place where the second model expects ground truth, and the second agent builds on it. The full build limits this in the only way that works: by not trusting prose. The tool server checks a saved value against what the data service returned, and code runs the rules on stored fields before any model judges.

Tracing must join the runs. One request is now several loops, possibly in several processes. A trace of the second loop alone shows a good recommendation built on a bad input and no way to see where the input came from. Every run needs a shared id, and the hand-off itself must be recorded: what was passed, and by whom. Observability and evals covers the trace; in the full build the shared key is the quote id.

A prompt injection has more places to travel. The broker's email is untrusted text. In one loop, the harness knows where that text sits and treats it as data. In a split, the first agent reads the email and writes a summary, and the summary becomes the second agent's task, a position that carries more authority than a quoted email. An instruction that survives the summary has been promoted. Each hand-off needs the checks that Guardrails describes.

And every loop needs the eight jobs: its own turn limit, budget, retries, output check and trace. A split does not add one model call. It adds one harness's worth of obligations.

A split buysAnd costs
A separate context windowIts own instructions and tool definitions on every turn; the hand-off paid twice; detail lost at the hand-off
A narrower tool set and permission scopeOne more boundary to configure and to check
A cheaper model for narrow workA second model's behaviour to evaluate
Parallel wall-clock timeA concurrency limit, a failure policy and a merge to write
Errors that compound; traces that must be joined; more paths for untrusted text
Do more agents give better results?What vendors themselves report, and what it does not settle

No general result says so, and the vendors that sell multi-agent features do not claim it.

Anthropic's report on its research system says multi-agent systems "excel at valuable tasks that involve heavy parallelization" and at work with "information that exceeds single context windows". The same report says that domains "that require all agents to share the same context" or "involve many dependencies between agents are not a good fit for multi-agent systems today", and that "most coding tasks involve fewer truly parallelizable tasks than research". It also states the cost plainly: "in practice, these architectures burn through tokens fast."

LangChain's multi-agent documentation opens its list of patterns with a caution: "a single agent with the right (sometimes dynamic) tools and prompt can often achieve similar results."

What this supports: a split can help when the work is wide, independent and too large for one context. What it does not settle is your task. Whether two agents beat one on the quote example is a question for an eval on the same golden set, not for an architecture diagram.

6. When to split: a rule built from the example#

The costs are certain: more loops, more hand-offs, more to trace. The gains are conditional. So the default is the smallest thing that works, and a split needs a named reason.

Start with one loop inside a workflow. Split when a context is too full, when a stage needs different permissions, or when the work is truly independent.

A context is too full. The sign is measurable: the input tokens of each turn keep growing with material the later turns do not use. Try the cheaper fixes on Context first, such as compacting the history or loading tool definitions on demand. Split when the material itself is the problem, as when one question needs twenty documents read and one sentence kept.

A stage needs different permissions. If one part of the work may write and another may only read, or one part reads untrusted text and another can cause a side effect, separate loops with separate tool sets make the rule enforceable in code. This reason does not depend on token counts.

The work is truly independent. No piece needs another piece's result, and a merge in plain code is possible. If each piece needs to know what the others found, they share a context in practice, and separate loops will pass it back and forth at a price.

Test the full build against the rule. Its two loops pass the second test: prefill writes fields, resolve only reads and recommends, and each connects to its own server. They pass the first as well, since the raw results from the data services stay out of the judgement stage.

Then test the invented specialists from section 3. Roof, flood and wildfire reviews look independent. But a house is one risk: a flood question changes with elevation, and a roof matters more where the wind is strong. If the three reviews need each other's findings, the third test fails, and they would read the same facts three times. On this example, one resolve loop with good tools is the design to beat.

7. The same three patterns, packaged#

Everything above is plain code at rung 1 of The ladder. Higher rungs hide how the second loop is started and how the message travels. None of them removes the decisions: what the second agent is given, what it may reach, and what comes back.

Rung 3 and coding harnesses: a subagent is a consult, built in#

An agent SDK and a coding harness already run the loop, so what they add is the consult pattern: a built-in tool whose work is to run a second loop.

The Claude Agent SDK documentation defines subagents as "separate agent instances that your main agent can spawn to handle focused subtasks." On context, the subagent's "context window starts fresh, with no parent conversation, but isn't empty", and "The only content you pass from parent to subagent is the Agent tool's prompt string". It does not receive the parent's history, tool results or system prompt; it does receive its own system prompt, the project's instruction file and its tool definitions. On the way back, "only its final message returns to the parent." On tools, a definition lists them, and "If omitted, inherits every tool available to subagents".

The fragment below shows the shape. It is adapted from the official SDK documentation and was not run here; the description and prompt are written for this page.

# Documented shape, adapted from the Claude Agent SDK documentation; not run here.
options = ClaudeAgentOptions(
    allowed_tools=["Read", "Grep", "Glob", "Agent"],        # "Agent" is the tool that starts a subagent
    agents={
        "code-analyzer": AgentDefinition(
            description="Use for questions about how existing code works.",
            prompt="You analyze code. Report what you find; do not change files.",
            tools=["Read", "Grep", "Glob"],                 # narrower than the parent's list
        ),
    },
)

Compare it with the sketch. prompt is spec.system, tools is the agent's own tool list, and description is what the parent model reads to decide when to ask, as with any tool. The same page says that "multiple subagents can run concurrently, so independent subtasks finish in the time of the slowest one", and that "a subagent can spawn subagents of its own". How a subagent's permission mode relates to its parent's is on a separate permissions page that was not read for this chapter.

Claude Code offers the same mechanism as files. Its documentation says: "Each subagent runs in its own context window with a custom system prompt, specific tool access, and independent permissions." A subagent is a Markdown file in .claude/agents/ for a project or ~/.claude/agents/ for all of a user's projects, and its frontmatter sets the tools, the model, the permission mode and a turn limit.

A subagent file in Claude CodeThe documentation's example, read as the arguments of run_agent

This example is from the documentation's section on writing subagent files.

---
name: code-reviewer
description: Reviews code for quality and best practices
tools: Read, Glob, Grep
model: sonnet
---

You are a code reviewer. When invoked, analyze the code and provide
specific, actionable feedback on quality, security, and best practices.

The frontmatter is the arguments of run_agent again. tools narrows the tool set; it "Inherits every tool available to subagents if omitted", so leaving the line out is a choice for the wide set. model picks a model per subagent, and the page names the reason: "Control costs by routing tasks to faster, lower-cost models like Haiku." permissionMode sets the permission mode and maxTurns a turn limit. On cost, a subagent "sends its own requests, which count toward the same usage limits as your main conversation."

Claude Code also documents agent teams: several sessions, each with its own context window, that message each other directly under a lead session. The documentation marks them "experimental and disabled by default" and says they "use significantly more tokens than a single session". Product detail is on Coding harnesses and SDKs.

Rungs 4 and 5: frameworks name the patterns, graph runtimes draw them#

An agent framework gives each pattern a construct. The claims here come from the baseline fact check of 2026-11-14; the OpenAI and LangChain pages were read again today.

The OpenAI Agents SDK has both model-chosen patterns. Its documentation describes agents as tools, where "A manager agent keeps control of the conversation and calls specialist agents through Agent.as_tool()", and handoffs, where "that specialist becomes the active agent for the rest of the turn." LangChain's documentation names five patterns: subagents, handoffs, skills, router and custom workflow. A graph runtime makes the wiring itself the program. In LangGraph, "A subgraph is a graph that is used as a node in another graph", so a whole agent can be one box in a larger graph, with the runtime carrying state between boxes. Google ADK documents sequential, parallel and loop workflow templates, and its page says graph-based workflows now supersede them.

A framework hides the plumbing: starting the loop, passing the state, waiting. It cannot hide the choice of what state to pass. A graph that hands the full state to every node has drawn several agents and kept one context.

Rung 6: a managed platform runs the second loop too#

On a managed platform, the vendor runs the loops and the hand-off. Claude Managed Agents, which its documentation says is in beta, documents multiagent orchestration: it "lets one agent coordinate with others to complete complex work." Each subagent works in its own session thread, described as "a context-isolated event stream with its own conversation history." Two limits are stated: "Delegation is one level deep, and a session can have at most 25 child threads at a time, idle ones included."

One sentence on that page deserves a second reading: "All agents share the same sandbox, filesystem, and vault credentials." The context is split; the reach is not. Section 4 listed a separate context and a narrower permission scope as two different gains. Read any multi-agent feature with both questions.

When the other agent belongs to someone else: A2AA protocol between agent systems that cannot see inside each other (baseline 2026-11-15)

All the patterns above assume that one team controls every agent. When the other agent belongs to another team or company, there is no shared database and no shared code. A2A (Agent2Agent) is an open protocol for that case. Its documentation describes it as an open source project under the Linux Foundation, contributed by Google, with a released version 1.0.0.

The A2A client sends work, and the A2A server, the remote agent, does it. The remote agent is opaque: its internal workings, memory and tools stay hidden. It publishes an Agent Card, a JSON document that states its identity, endpoint, skills and the authentication it requires. Work is a task with an id and a lifecycle. The documentation gives the relation to MCP in one line: "A2A connects the agents to each other; MCP connects each agent to its own tools".

From inside your harness, a remote agent looks like a slow tool with a task id. A2A carries the task. It does not decide which agent to ask, what must not leave your system, or whether to trust the answer. The full build does not use A2A: all of its agents live in one system, so events and one database are less to build.

8. Who runs it#

The question for this chapter is who starts the second loop and carries the message. BUILT IN means the product does it in your deployment, MANAGED that the vendor runs it, YOU BUILD that it stays with you.

ProductSeveral agentsWhat it provides
The miniatureNOT ITS JOBOne loop. It has no second agent
The full buildYOU BUILDA sequence: two loops in separate stages, an event with the quote id, one database
Claude Messages APIYOU BUILDOne call. Every loop and every hand-off is your code
Claude Agent SDKBUILT INSubagents through the Agent tool: a fresh context, only the final message returns, several can run at once
Claude CodeBUILT INSubagents as files in .claude/agents/; agent teams, experimental and off by default
Codex CLI, GitHub Copilot CLI, Antigravity CLI, Cursor, Grok BuildBUILT INEach documents subagents; the details differ per product
OpenAI Agents SDKBUILT INHandoffs, and agents as tools
LangChainBUILT INFive documented patterns, including subagents and handoffs
LangGraphBUILT INA subgraph as a node in a graph
Google ADKBUILT INMulti-agent workflows; graph-based workflows supersede the older templates
CrewAIBUILT INCrews of agents, and Flows for fixed steps
Claude Managed AgentsMANAGEDMultiagent orchestration, in beta: context-isolated threads, one level deep, a shared sandbox
OpenAI Agents APIMANAGEDThe baseline lists subagents in its managed harness

The Claude rows were read on 2026-11-16. The other rows come from the baseline fact check of 2026-11-14 and 2026-11-15. The full product by job matrix is on Build or adopt.

Almost every product that runs a loop will also start a second one for you. Starting it was never the hard part: section 3 did it in two lines. No row answers section 6. Which work deserves its own context, what crosses the boundary, and which tools the second agent may reach stay with the team that owns the system.

What you can do now, and what is still open#

You can now read any multi-agent design as a small set of facts: how many loops there are, who decides that each one runs, what each starts with, what it may reach, and what comes back. In the quote example the answers fit in one line. Two loops, code decides, a quote id crosses, each stage reaches only its own server, and a person decides at the end.

The idea to keep is that an agent boundary is a context boundary. Everything a split buys and everything it costs follows from the fact that the second loop starts with only what code chose to give it.

This closes the eight jobs. Every one of them has now been written by hand at least once, including the loop that starts another loop. The open question is how much of that code you should still be writing. SDKs starts the climb: the provider SDK that wraps the call, the agent SDK that wraps the loop, and the same tool loop in three languages.