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
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 time | 0.0 s |
|---|---|
| Tokens processed | 0 |
| Estimated cost | $0.000 |
| Waiting on (workers) | 0 |
All steps
Normal run
- Request arrives. The dispatcher is plain code, not a model. Which checks run is decided at design time, not per request.
- Fan out. The same case goes to three reviewers at once. Nothing is planned or decomposed; the split is always the same.
- Reviewers work. Each reviewer answers one question in its own context. They share nothing and cannot wait on each other.
- First results. Two reviewers finish. The aggregator holds their results and keeps waiting; the damage check is still calling the carrier.
- Last result. The slowest branch reports. Only now is the barrier released, so the gather step is as slow as its slowest input.
- Merge. Valid order 4417, damage confirmed, inside the 30-day window. The aggregator combines three verdicts into one decision.
- 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
- Request arrives. Identical start to the normal run.
- Fan out. Three reviewers start in parallel, as before.
- Reviewers work. Nothing has gone wrong yet.
- Two results arrive. The order check and the policy check report on time. One branch is still open.
- 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.
- 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.
- 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
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
- Orchestrator–workers (alternative)
- Pipeline (alternative)
Space play or pause → next step ← previous step R reset F failure mode