Chapter 16: Parallelism
Lecture
Chapter principle
Key takeaways
- Parallelism is valid only where dependencies permit it.
- Concurrency can cut latency without reducing total work.
- Critical-path and straggler latency matter.
- Fan-out creates branches; fan-in defines how they become a result.
- Evaluate aggregation separately.
- Shared writes and side effects need stronger coordination.
- Parallel designs need limits, failure policies, cancellation and budgets.
Experiments
Every experiment in the book is small, runnable and printed with its real output. In the Lab you can replay a recorded real run of each one, with no programming, and watch what the model and the agent do.
Experiment 29: Doing things at the same time
When does doing things at the same time help, and when does it break?
A real model answers three short, independent questions, first one after another, then all at once. Then comes a task with a dependency: convert 100 dollars to euros, which needs an exchange rate from a slow service. It runs three times the wrong way, with the conversion started at the same moment as the rate request, and once the right way, rate first. This is a recorded run of a real model. Times and wording will differ in a new run. Because calls overlap, steps from different calls appear interleaved.
Experiment 30: Fan out, then combine
When several reviewers work in parallel, how should their findings be combined?
Three real models review the same business proposal at the same time: one for finance, one for risk, one for operations. Each names the single most important issue. The proposal has three problems: an optimistic margin, a single supplier, and a lease that takes longer than the time left before Q3. Two ways of combining the reviews are compared on the same results. Then the review runs again with the operations reviewer given only 0.01 seconds, so it times out. This is a recorded run of real models. A new run will word things differently. The reviewers run at once, so their steps appear interleaved.
All the code for this chapter: github.com/agentic-engineering-book/code
Download the bookBrowse all chapters