Catalog / Orchestration

Fan-out / gather

A fixed set of independent checks runs in parallel on the same input. A gather step waits for all of them and merges the results.

Reference task used across all patterns: "My order arrived damaged. Can I get a refund?"

Topology

ActorLead agentWorker

Run

07 steps

Ready to run

Play runs the whole scenario. Step advances one event at a time so you can read what happens.

Metrics

Wall-clock time0.0 s
Tokens processed0
Estimated cost$0.000
Waiting on (workers)
0
Illustrative values. They show proportions between patterns, not benchmarks.

All steps

Normal run

  1. Request arrives. The dispatcher is plain code, not a model. Which checks run is decided at design time, not per request.
  2. Fan out. The same case goes to three reviewers at once. Nothing is planned or decomposed; the split is always the same.
  3. Reviewers work. Each reviewer answers one question in its own context. They share nothing and cannot wait on each other.
  4. First results. Two reviewers finish. The aggregator holds their results and keeps waiting; the damage check is still calling the carrier.
  5. Last result. The slowest branch reports. Only now is the barrier released, so the gather step is as slow as its slowest input.
  6. Merge. Valid order 4417, damage confirmed, inside the 30-day window. The aggregator combines three verdicts into one decision.
  7. Respond. Refund approved. Three checks took the time of one, at the token cost of all three.

Outcome: correct answer. Parallel branches traded tokens for latency. Unlike an orchestrator, nothing here was decided at run time, which makes the flow predictable and easy to test.

Failure mode

  1. Request arrives. Identical start to the normal run.
  2. Fan out. Three reviewers start in parallel, as before.
  3. Reviewers work. Nothing has gone wrong yet.
  4. Two results arrive. The order check and the policy check report on time. One branch is still open.
  5. The straggler. The carrier's API is slow today and the damage check hangs on it. It has not failed, so it reports nothing at all.
  6. The aggregator waits. Its rule is “wait for all three”. Two finished results sit unused, and there is no timeout and no partial-answer path.
  7. The request times out. After thirty seconds the front end gives up and the customer sees an error. Two-thirds of the work was done and thrown away.

Failure: waiting on the straggler. A gather step is as slow as its slowest branch and, without a deadline, as slow as a hung one. Mitigation: per-branch timeouts, a rule for partial results, and cancelling branches that no longer matter.

Execution trace

Model workingSending a message

Reference

Problem
One decision needs several independent checks, and running them one after another wastes time.
Analogy
A doctor orders three lab tests at once and reads them together. The visit cannot end until the slowest lab reports.
Use when
The subtasks are known up front, independent of each other and similar in duration, and latency matters more than token cost.
Avoid when
Branches depend on each other's results, or one branch is much slower or flakier than the rest and you have no timeout policy.
Typical failure
Straggler: the gather step waits without limit on the slowest or hung branch.
Also known as
Parallelization (Anthropic)Concurrent orchestration (Microsoft)ParallelAgent (Google ADK)Map-reduce (LangGraph, related)
Related patterns

Space play or pause   next step   previous step  R reset   F failure mode