← Table of Contents · Page 463 of 868

COORDINATION MECHANICS

Part 4 of 11

FAN-OUT AND FAN-IN Fan-out and fan-in describe a way of working in parallel. Fan-out means splitting a job into several independent pieces and sending each piece off to run at the same time. Fan-in means collecting the results of those pieces and merging them into one combined answer. Imagine a teacher who must grade thirty exams. She asks five teaching assistants to each grade six exams at the same time. That is the fan-out. When they finish, she gathers the five stacks, checks that all thirty are marked, and enters the grades in one gradebook. That is the fan-in. Fan-out works best when the pieces are independent, meaning no piece needs the result of another to begin. If the pieces depend on each other, parallel work does not help. The fan-in step is where many designs fail, so it deserves care. The merging agent, or merging code, must handle several realistic problems. First, missing results: what if one of five subagents crashed or timed out? Second, inconsistent formats: what if the subagents returned their findings in different shapes? Third, disagreements: what if two subagents reach conflicting conclusions about the same item? A good design decides these rules in advance. For missing results, the merge step should note which pieces failed and either retry them or clearly report them as incomplete, rather than silently pretending everything succeeded. For inconsistent formats, require every subagent to return the same structured shape, which we discuss next. For disagreements, define a tie-break rule, such as asking a reviewer agent to examine the evidence for both sides, preferring the result with cited sources, or escalating to a human when the stakes are high. Fan-out also has cost implications. Five parallel subagents finish sooner, but they use at least as many tokens as running them one after another, so you gain speed, not savings. Also remember to cap how many run at once, using the budgets and limits you learned in Chapter 25, so a large batch cannot overwhelm your model provider's rate limits or your wallet.
Advertisement
Read Aloud:
0:00 / 0:00