Skip to content
Ylabator
DiagramAdvanced

Five Multi-Agent Architecture Patterns

Router, sequential pipeline, parallel workers, supervisor and generator-evaluator solve different coordination problems, and each fails in its own way. Pick by task structure and build the matching limit in.

4 min read / Updated / Last checked

Format
Diagram · Advanced
Who it is for
Builders and technical founders
You leave with
Compare router, sequential, parallel, supervisor and evaluator patterns, and implement each with the control that stops its typical failure.

The problem

In March 2025, Mert Cemri and 12 co-authors released MAST, a taxonomy of why multi-agent systems fail, built from more than 1,600 annotated traces across seven multi-agent frameworks. They found 14 failure modes in three groups. The most common single mode was step repetition, at 15.7% of failures. Reasoning-action mismatch, where an agent says one thing and does another, followed at 13.2%, and agents unaware of when to stop at 12.4%. The three verification modes (premature termination, missing checks and incorrect checks) together made up 23.5% [1].

Those are not exotic bugs. They are the predictable failures of particular coordination shapes: loops that do not end, stages that pass bad output forward, merges that miss a failed branch, reviewers that approve the wrong thing.

Founders usually see the pattern only as a diagram in a proposal: boxes labeled "planner," "researcher," "reviewer" with arrows between them. The diagram rarely says who owns the state, what stops a loop, or what happens when one box fails. Those three answers decide whether the system works. If the question is still whether to split at all, start with Do You Actually Need Multiple AI Agents?

How it works

Anthropic describes five building blocks for model-based systems: prompt chaining, routing, parallelization, orchestrator-workers and evaluator-optimizer, each with a clear "use when" [2]. Microsoft's architecture guide uses related names (sequential, concurrent, group chat, handoff, magentic) and lists what to watch out for in each [4]. The OpenAI Agents SDK separates orchestration by the model (agents as tools through Agent.as_tool(), or handoffs) from orchestration by code (routing on structured output, chaining, evaluator loops, asyncio.gather) [3].

  1. Router. A classifier sends each request to one specialist. Use it when requests fall into distinct categories [2]. State lives with the chosen worker. Typical failure: misrouting. Control: an unknown or low-confidence label goes to a person, and the router never holds more permissions than any worker.
  2. Sequential pipeline. Each stage transforms the previous stage's output, as in extract, validate, draft, approve. Use it when the task splits cleanly into fixed steps [2]. Typical failure: an early error propagates [4]. Control: validate each stage's output before the next stage reads it.
  3. Parallel workers. Independent subtasks run at once and a merge step combines them. In Anthropic's research system, parallel tool calling cut research time by up to 90% on complex queries [5]. Typical failures: contradictory results [4] and a failed branch nobody notices. Control: the merge knows how many results to expect.
  4. Supervisor. A coordinator plans, delegates bounded tasks to specialists and decides when the goal is met. Use it when the subtasks cannot be predicted in advance [2]. Typical failures: step repetition and not knowing when to stop [1]. Control: a round limit and a shared budget.
  5. Generator-evaluator. One step produces, another checks against criteria, and the loop revises. Use it when clear evaluation criteria exist [2]. Typical failure: incorrect verification [1]. Control: deterministic checks first, a bounded number of rounds, and a person when it never passes.

Five patterns, the job each does, and how each fails

Fig. 01
Five patterns, the job each does, and how each fails
DimensionUse whenTypical failureBuilt-in control
RouterDistinct request typesMisroutingUnknown goes to a person
SequentialFixed, ordered stepsEarly error spreadsValidate every stage
ParallelIndependent subtasksMissing or conflicting partsMerge knows expected count
SupervisorSubtasks not known aheadLoops, no stopRound limit, budget
Generator-evaluatorClear pass criteriaApproves wrong outputDeterministic checks first
Choose by task structure, then build in the control that stops the pattern's typical failure.

By the numbers

annotated traces across seven multi-agent frameworks in the MAST study [1]
1,600+
distinct failure modes MAST identified, in three categories [1]
14
of failures were step repetition, the most common single mode [1]
15.7%
of failures came from the three verification modes combined [1]
23.5%
less research time from parallel tool calling in Anthropic's research system [5]
Up to 90%
Failure modeShare of failuresWhere it bitesControl in the code below
Step repetition15.7%Supervisor, evaluator loopsmax_rounds and Budget
Reasoning-action mismatch13.2%Any agent with toolsValidate tool calls and outputs in code
Unaware of termination conditions12.4%SupervisorExplicit "done" signal, round limit
Disobey task specification11.8%Pipeline stagesPer-stage valid check
Incorrect verification9.1%Generator-evaluatorDeterministic passes check
No or incomplete verification8.2%Parallel mergeMerge receives the expected count
The most common MAST failure modes and the pattern control that targets each [1]

The percentages are shares of failures in MAST's annotated traces, not failure rates of any one product [1]. Their value is in the ranking. The top three are failures of control flow and execution, not of missing knowledge, so code that bounds loops and checks outputs addresses much of the list. The MAST authors also report that targeted fixes, such as clearer role specifications or an added verification step, improved results in their case studies but not consistently, and they call for structural changes [1].

Implementation

The module below implements all five patterns over one function, call(role, text), which stands for any model or agent call. It is plain Python, so the same structure works with any SDK. Each pattern carries its control, and a shared Budget caps total model calls per run.

patterns.pypython
import asyncio

class Budget:
    def __init__(self, max_calls):
        self.left = max_calls
    def spend(self, n=1):
        if self.left < n:
            raise RuntimeError("budget exhausted: stop and escalate")
        self.left -= n

async def route(call, budget, text, workers):  # 1. router
    budget.spend()
    return await workers.get(await call("router", text), workers["human"])(text)  # unknown -> person

async def pipeline(call, budget, text, stages, valid):  # 2. sequential
    for stage in stages:
        budget.spend()
        text = await call(stage, text)
        if not valid(stage, text):  # check before the next stage builds on it
            raise ValueError(f"{stage} produced invalid output")
    return text

async def fan_out(call, budget, parts, merge):  # 3. parallel workers
    budget.spend(len(parts))
    results = await asyncio.gather(*(call("worker", p) for p in parts), return_exceptions=True)
    return merge([r for r in results if not isinstance(r, Exception)], expected=len(parts))

async def supervise(call, budget, goal, specialists, max_rounds=5):  # 4. supervisor
    notes = []
    for _ in range(max_rounds):
        budget.spend()
        step = await call("supervisor", f"{goal}\n{notes}")  # "role: task" or "done"
        if step == "done":
            return notes
        role, task = step.split(":", 1)
        notes.append(await specialists[role.strip()](task.strip()))  # specialists spend too
    raise RuntimeError("supervisor hit max_rounds")

async def refine(call, budget, task, passes, max_rounds=3):  # 5. generator-evaluator
    prompt = task
    for _ in range(max_rounds):  # falls through to None: hand the task to a person
        budget.spend()
        if passes(draft := await call("generator", prompt)):  # deterministic check first
            return draft
        prompt = f"{task}\nRevise: {draft}"

Three design choices carry over to any framework. The budget is shared by the whole run, so a supervisor cannot spend it all on one specialist. Failures surface as exceptions or None, never as a quietly shorter answer, which Microsoft's guidance also asks for: surface errors instead of hiding them [4]. And the parallel merge receives expected, so it can tell "three sources agree" from "one of three sources answered."

In production, add a trace id to every call, persist each run's state so it can resume (see Cortex, Memory, and Durable Agent Execution), and give each worker only the tools its role needs.

Test it

Tests use fake model functions, so they run in milliseconds and pin the controls rather than model quality.

test_patterns.pypython
import asyncio
import pytest

from patterns import Budget, fan_out, pipeline, refine, route, supervise
run = asyncio.run


async def echo(role, text):
    return {"router": "billing", "supervisor": "research: prices"}.get(role, f"{role}:{text}")


async def flaky(role, text):
    if text == "b":
        raise TimeoutError("worker b timed out")
    return text.upper()


def test_router_sends_unknown_labels_to_a_person():
    async def unsure(role, text):
        return "legal"
    workers = {"billing": None, "human": lambda t: asyncio.sleep(0, "queued for human")}
    assert run(route(unsure, Budget(5), "refund?", workers)) == "queued for human"


def test_pipeline_stops_on_invalid_stage_output():
    with pytest.raises(ValueError):
        run(pipeline(echo, Budget(5), "doc", ["extract", "draft"], lambda s, t: s != "extract"))


def test_parallel_merge_sees_missing_results():
    merged = run(fan_out(flaky, Budget(5), ["a", "b", "c"], lambda r, expected: (r, expected)))
    assert merged == (["A", "C"], 3)  # the merge step knows one branch failed


def test_supervisor_loop_is_bounded():
    async def research(task):
        return f"notes on {task}"
    with pytest.raises(RuntimeError):
        run(supervise(echo, Budget(50), "compare vendors", {"research": research}, max_rounds=3))


def test_budget_caps_total_calls():
    with pytest.raises(RuntimeError, match="budget"):
        run(refine(echo, Budget(2), "write a summary", passes=lambda d: False, max_rounds=5))
    assert run(refine(echo, Budget(5), "x", passes=lambda d: False)) is None

Run python -m pytest test_patterns.py. Expected: five passing tests. Then, against the real system, read 20 traces per pattern and tag each failure with a MAST mode [1]. Expected for a healthy design: no run exceeds its budget silently, no supervisor run ends without either "done" or a recorded limit, and every parallel run that lost a branch says so in its output.

Decision

Choose the pattern from the task's structure, then build its control before its features.

  • Router for distinct request types, with a human fallback.
  • Sequential for fixed steps, with validation between stages.
  • Parallel for independent subtasks, with a merge that counts.
  • Supervisor only when subtasks cannot be planned, with a round limit and a shared budget.
  • Generator-evaluator when pass criteria are clear, with code checks before any model judge.
  • Combine patterns only after each part passes its own tests. Most products need one or two of the five, not all of them [2][4].

Sources

  1. [1]Why Do Multi-Agent LLM Systems Fail? (opens in a new tab)Cemri et al., arXiv, October 2025
  2. [2]Building effective agents (opens in a new tab)Anthropic, December 2024
  3. [3]Agent orchestration (opens in a new tab)OpenAI Agents SDK, November 2026
  4. [4]AI agent orchestration patterns (opens in a new tab)Microsoft Azure Architecture Center, February 2026
  5. [5]How we built our multi-agent research system (opens in a new tab)Anthropic, June 2025

Technical guidance, not legal or security certification.

Need a technical review of an AI-built MVP?

Discuss your build