By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
After twenty lessons you have built one support graph and seen most of its machinery. Real agent systems are not one-off diagrams, though: they are a small set of recurring shapes that keep reappearing under different names. Naming those shapes is not academic. It lets you choose a structure before you write the prompt, defend the choice in review, and recognise a bug as a masked version of a failure you already understand.
This lesson names four: the router, the orchestrator-worker, the evaluator-optimizer and map-reduce. None of them is a framework feature — each is an arrangement of nodes, edges, state and loops that you already know how to build. The diagram below gives each one a column; walk the steps to see the same runtime shaped four different ways.
A router classifies first and routes second. One node, or one cheap function, reads the request and returns a label; a conditional edge maps that label to exactly one destination. You have used this pattern since the conditional-edge lesson, and tools_condition in the agent loop is a router too: it looks at the last message and chooses tools or END.
A router fits when the destinations are already known, few and mutually exclusive, and the classification is cheaper than doing the work. Support triage, read-versus-write decisions, language selection and approval-needed checks are router problems. It does not fit when the request needs to be decomposed: a router that has to invent five new branches is an orchestrator wearing a router's name.
An orchestrator reads the request, writes a plan, and dispatches one worker per planned subtask; a synthesis node merges the results. The difference from a router is that the number and content of the work items are created at run time. The difference from map-reduce is that the units are planned, not read from a list of data. The supervisor lesson was this pattern with conversation state attached: the supervisor planned and routed, and the workers specialised.
The mechanics are the ones from the Send lesson. The plan lands in state as a list, a conditional edge returns one Send per item, each worker writes into a reducer channel, and a final node synthesises the collection into an answer the user can read. The orchestration is not a new runtime; it is Send plus a reducer plus one more model call.
The evaluator-optimizer pattern puts a critic inside a bounded loop. A generator produces a draft; an evaluator scores it against an explicit rubric and either accepts it or returns a critique; the generator revises. It fits when the first attempt is often close and quality is judgeable — drafting, translation, code repair, policy-compliant copy. It does not fit when the output is deterministic or when you cannot write the rubric down, because then the evaluator is just a second opinion with the same blind spots.
accepted plus a short list of failures — is what the router can branch on and what a test can assert.Map-reduce is the pattern for a list. Split the list, Send one branch per item, run the same operation in each branch, and merge the outputs with a reducer. The Send and reducer lessons gave you the parts; the pattern is the discipline of designing the split, the per-item contract and the reduce step explicitly.
Pattern choice is a design decision made from the shape of the work, and it is much cheaper to change now than after the prompt has grown around it. Use this table as the first pass; the second pass is checking that the extra pattern buys enough to justify its failure mode.
| The work looks like | Start with | Because |
|---|---|---|
| One label decides among fixed paths | Router | Destinations are known and mutually exclusive; no work needs to be invented |
| Subtasks are discovered at run time, then combined | Orchestrator-worker | A planner turns one request into N jobs and a synthesiser merges them |
| First draft may be wrong, quality is judgeable | Evaluator-optimizer | A written rubric plus a bounded revision loop improves the artifact |
| Same operation over a list of independent items | Map-reduce | Send one branch per item and let a reducer merge the outputs |
| A fixed sequence of steps with no decisions | None of these | A plain graph of nodes and edges is enough; no model is needed to choose the next node |
Patterns compose, and they compose in a predictable direction: a router can choose an orchestrator; each orchestrator worker can run a map-reduce over a list; an evaluator loop can wrap the generator inside one worker. Composition adds nodes and hops, not new primitives — which is why the failure modes below multiply when you combine them.
Every pattern is paid for in model calls, latency and a new way to fail. A design review that names the cost is a design review that can reject the wrong pattern early.
| Pattern | Extra model calls | Main failure mode | First mitigation |
|---|---|---|---|
| Router | One classification call | Wrong or drifting label | Closed label set, fallback branch, evaluate router accuracy |
| Orchestrator-worker | Plan, N workers, synthesis | Bad plan or unbounded fan-out | Cap subtasks, validate the plan, isolate worker failures |
| Evaluator-optimizer | Two per iteration | Oscillation or judge bias | Written rubric, max revisions, progress check |
| Map-reduce | One per item plus split/reduce | Partial failure or cost blow-up | Per-item error slots, batch caps, order-independent reduce |
Key takeaways
Four shapes cover most agent graphs: router (pick one known branch), orchestrator-worker (plan work, dispatch workers, synthesise), evaluator-optimizer (draft, judge, revise) and map-reduce (one branch per item).
A router chooses among fixed destinations and must not do the work; a closed label set, a fallback and a measured confusion matrix keep it honest.
An orchestrator creates its own work items and needs a plan budget, per-item failure state and an explicit synthesiser.
An evaluator loop needs a written rubric, a verdict-shaped evaluator and a bounded iteration count; without progress it oscillates rather than improves.
Map-reduce is for lists: split deterministically, isolate per-item failures, merge with a reducer that does not assume order, and cap the batch.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.