PHASE 11 · MULTI-AGENT

From one agent to a team

Goal: Decompose hard problems across specialized agents.

What this is

One agent with too many tools gets confused — it picks the wrong tool, drifts off-task on long jobs, blows the context window. Multi-agent means decomposing the problem across specialized agents that hand work to each other.

Anthropic's Building Effective AI Agents codifies 6 patterns: prompt chaining (sequential), routing (pick the right specialist), parallelization (fan-out), orchestrator-workers (a manager that delegates), evaluator-optimizer (one agent reviews another's work), and autonomous agents (long-running, goal-directed loops). Internalize these — they're the vocabulary for any multi-agent design.

Frameworks: LangGraph (graph-based, explicit state, the most flexible), Strands (lighter, AWS-aligned, easier to start), OpenAI Swarm (peer-to-peer handoff, minimal). Pick one. They all express the same patterns differently.

The honest caveat: multi-agent is overkill for most apps. A single well-prompted agent with good tools beats a 6-agent swarm 80% of the time. Reach for multi-agent when a single agent demonstrably fails — not because the architecture sounds cool.

The plan

  1. Read Anthropic's Building Effective AI Agents end-to-end. Sketch a one-line example of each of the 6 patterns from your own domain.
  2. Pick LangGraph or Strands. Rebuild your Phase 4 agent as an orchestrator-workers setup: a planner agent + RAG agent + SQL agent, coordinated by an orchestrator.
  3. Try the swarm pattern: agents hand off based on capability with no central coordinator.
  4. Compare orchestration styles on the same task. Supervisor for clear hierarchy; peer-to-peer when routing is fuzzy.
  5. Be honest in writing: where did multi-agent help? Where did it just add latency and bugs? Save that note.

Ask your coding assistant

  • Anthropic's 'Building Effective AI Agents' — what are the 6 patterns and when does each fit?
  • LangGraph quickstart vs. Strands quickstart — which fits a small project?
  • When does multi-agent help vs. hurt vs. a single agent with more tools?
  • What is OpenAI's Swarm pattern? What's it good for?
  • Compare AutoGen, CrewAI, LangGraph, Strands at a high level.

What you'll have when you're done

  • You can decompose a complex task across specialists with intent.
  • You've internalized the 6 patterns and know when each fits.
  • You've seen the real multi-agent failure modes (infinite handoffs, context blow-up, coordination overhead).
  • You know when not to use multi-agent — usually a single agent with better tools wins.

Deliverable

swarm.py — A planner + researcher + SQL agent, coordinated by an orchestrator — with notes on what helped and what didn't.

Concepts unlocked: orchestration · handoffs · the 6 patterns · when multi-agent hurts

Intuition

Your agent has come a long way: it answers from your docs (Phase 2), queries your database (Phase 5), and since Phase 10 you can even test its behavior. But keep piling tools onto that one agent and it starts to crack: with fifteen tools it picks the wrong one, on long jobs it drifts off-task, and it blows the context window trying to hold everything at once. A single brain can only juggle so much.

Restaurants solved this exact problem long ago. A tiny café has one cook who does everything — takes the order, grills, plates, washes up. It works until the dinner rush, when that one cook starts burning things. A busy kitchen runs differently: a head chef reads each incoming order and calls out the pieces; each station — grill, sauté, pastry — owns exactly one job with its own equipment; finished plates come back to the head chef, who assembles the dish. Crucially, nobody shouts across the kitchen at each other — everything flows through the head chef.

Multi-agent is that kitchen. You split the job across specialist agents — each with one narrow job and a small set of tools — coordinated by one agent that hands out work and combines the results.

What multi-agent is. Multi-agent breaks a hard problem into specialized agents that pass work between them — a kitchen brigade instead of one overwhelmed cook. Each agent has a narrow job and a small set of tools, so it stays focused.

How agents talk

So a team beats an overloaded generalist. But what does “hand work to each other” actually mean, mechanically? Is one agent messaging another? Sharing a chat room? Reading each other's minds?

Here's the satisfying part: you already know the mechanism. It's the Phase 4 tool call, and nothing more. In Phase 4, your harness — the code around the model — told the LLM “a calculator tool exists,” and when the model asked for it, your code ran it and fed the text result back. To call a whole agent, the orchestrator's harness does exactly the same thing: it lists the worker as a tool. When the orchestrator asks for it, the harness runs the worker's entire agent loop — its own prompt, its own tools, as many rounds as it needs — and feeds the worker's final answer back as an ordinary tool result.

You'll never write this yourself — your coding assistant will — but seeing it kills the mystery. To the orchestrator, a whole agent sits in the tool list right next to a calculator, and the model can't tell the difference:

# to the orchestrator, a whole agent is just one more tool
def ask_researcher(question):
    return researcher_agent(question)   # runs a FULL agent loop, returns its final text

TOOLS = [ask_researcher_def, calculator_def]  # side by side — request in, text out, either way
An agent is just a tool that thinks. To the caller, a worker agent looks like any other tool: a request goes in, text comes back. The only difference is what happens inside — a full agent loop instead of one function. Every multi-agent pattern you'll meet is built from this one move.

The patterns

Once agents can call agents, the question becomes: how do you wire the kitchen? Anthropic's Building Effective AI Agents — the short guide most teams start from — names five ways to arrange a team. (Its sixth pattern is one you already know: the single autonomous agent, the one you built in Phase 4.) These five are the vocabulary for any multi-agent design:

  • Routing — a dispatcher reads the request and sends it to the right specialist. Kitchen: the expediter reads a ticket and calls it to the right station. Zentara: a front-door agent sends “where's my parcel?” to the tracking agent and “this invoice is wrong” to the billing agent.
  • Orchestrator-workers — a manager agent breaks the task into pieces, hands each to a worker, then combines the results. (You'll build this one.) Kitchen: the head chef splits a banquet order across stations and plates the final dish. Zentara: “prepare the Meridian account review” — docs questions go to the RAG worker, numbers to the SQL worker, and a writer assembles the report.
  • Prompt chaining — a fixed sequence: the output of one agent feeds the next. Kitchen: an assembly line — prep, cook, plate, always in that order. Zentara: draft a delay-apology email → check it against the refund policy → translate it for the customer's region.
  • Evaluator-optimizer — one agent does the work, a second reviews it and sends it back for another pass. Kitchen: the head chef tastes the dish and returns it until it's right. Zentara: one agent drafts a customs declaration, a checker agent verifies every code, and it loops until clean.
  • Parallelization — fan the same work out to several agents at once and merge the answers. Kitchen: three cooks each prep a batch simultaneously for a big order. Zentara: quote one shipment with three carrier agents at the same time, then pick the cheapest.

Here's the pattern you'll build — orchestrator-workers — drawn as a kitchen: the head chef in the middle, stations around it.

Reading the arrows: solid arrows are work being handed out — the head chef passing tickets to stations. Dashed arrows are results reporting back. Every hand-out and every report-back is the same Phase 4 move from the last section: a tool call in, text back out.

The honest caveat

Before you rush off to build a brigade, here's the part most tutorials skip: multi-agent is overkill for most apps. A single well-prompted agent with good tools beats a six-agent swarm about 80% of the time — and the swarm adds latency, cost, and a pile of new ways to fail. A food truck with a three-item menu does not need a head chef and five stations.

The signals that you genuinely need a team are specific:

  • Tool confusion — one agent with 12+ tools keeps picking the wrong one, and trimming descriptions didn't fix it.
  • Long-task drift — jobs with many steps where the agent loses the thread before the end.
  • Genuinely parallel work — independent pieces (three carrier quotes, five documents to summarize) that could truly run at the same time.
When NOT to use a team. One agent with good tools beats a team you can't debug. Every handoff is a seam where information gets dropped or garbled — and a wrong answer can now be hiding inside any of five agents or in the seams between them. Remember Phase 6: you needed traces to see inside one agent. A team multiplies that — you need a trace for every agent plus every handoff, or debugging becomes guesswork. Don't go multi-agent because the diagram looks impressive; do it when a single agent demonstrably can't cope.

Build a small team

Time to run the kitchen yourself. You'll rebuild your Phase 4 agent — agent.py, the one that routes questions to your RAG, a web search, or a calculator — as an orchestrator-workers team: a planner, a RAG agent, and a SQL agent, coordinated by an orchestrator. Then, just as important, you'll write down honestly where the team helped and where it just added overhead.

Read what it builds — the head chef in code. The orchestrator plans, hands each step to the right station, and plates the result:

# swarm.py — an orchestrator delegating to specialist agents
def orchestrator(task):
    plan = planner_agent(task)                # read the ticket: break the task into steps
    results = []
    for step in plan:
        if step.kind == "docs":
            results.append(rag_agent(step))   # Phase 2 RAG, working one station
        elif step.kind == "data":
            results.append(sql_agent(step))   # Phase 5 SQL, working another
    return writer_agent(task, results)        # plate it: combine into a final answer
Deliverable — swarm.py. A planner + researcher + SQL agent coordinated by an orchestrator — plus an honest note on what the team helped with and what it didn't. Knowing when not to use multi-agent is half the skill. Next, in the finale, you'll step back and put a name on all the machinery you've built around the model.