Multi-Agent Patterns

One agent can do a lot. Sometimes the job is clearer as a team.

Multi-agent means: more than one agent, each with a role, and a way to hand work off.


Why split?

ShopTiny wants a short status note for order 4412:

  1. Gather facts (order, item, amount)
  2. Draft a customer-facing note
  3. Check the draft (approve or send back once)

One giant prompt can muddle those jobs. Three small roles stay easy to read and fix.

Role Job
Researcher Look up facts; return short notes
Writer Turn notes into a draft message
Supervisor Approve the draft, or revise once with feedback

Handoff

A handoff is the message (or structured notes) one agent passes to the next.

Researcher does not talk to the customer.
Writer does not look up the order again if notes are enough.
Supervisor does not invent new order facts.

Three roles. Clear handoffs.
  Customer ask


  Researcher  ──notes──►  Writer  ──draft──►  Supervisor

                                          approve ─┴─ revise once


                                            Final message

Patterns (keep these three)

Pattern Meaning
Pipeline A → B → C in order (this chapter’s lab)
Supervisor One agent routes or judges others’ work
Specialists Each agent owns one skill (research vs write)

You already know tools and loops. Multi-agent is mostly who runs which loop, and what they pass.


What you should remember

  1. Split by job, not by “more models = smarter.”
  2. A handoff should be small and clear (notes, draft, yes/no).
  3. One revise is enough for a learning lab — endless loops hide bugs.

See it in Code

The Code panel runs a tiny Researcher → Writer → Supervisor pipeline on order 4412 and prints each handoff.