Parallel Agent Orchestration: Fan-Out, Fan-In, and Backpressure
Design parallel AI agent workflows with clear fan-in contracts, bounded concurrency, backpressure, and safe straggler cancellation under real capacity limits.
Abhishek Raj · · 8 min read
Prepared with AI research assistance. Sources are linked throughout; worked examples are illustrative unless stated otherwise. Editorial approach.
Parallel agent orchestration is useful when independent pieces of work can advance together and their results can be combined under a clear contract. Fan-out creates those pieces; fan-in decides which outcomes are sufficient to continue. Backpressure keeps the resulting workload within the capacity of models, tools, storage, and reviewers.
The important design question is not how many agents can be launched. It is which work can safely overlap, how completion is established, and what happens when a branch stops responding. The design below uses a hypothetical research workflow; its numbers are illustrative, not measured performance.
Establish independence before launching branches
Suppose a report needs a regulatory source review, a technical documentation review, and an internal incident review. Those investigations can overlap if each receives the same question, relevant permissions, and a stable evidence boundary. Writing the final recommendation depends on their results and belongs after the join.
Do not parallelize a dependency by hiding it inside prompts. If branch B needs the approved interpretation produced by branch A, B is not independent. Starting both may create speculative work that must be discarded. Likewise, two agents modifying the same customer record need a coordination contract even if their textual assignments differ.
LangGraph describes parallel graph nodes as sharing a super-step, with state updates merged through channel reducers. Its Send primitive supports dynamic fan-out with branch-specific input. These are execution mechanisms; the application still chooses which tasks are independent and how evidence combines. LangGraph Graph API.
A practical branch assignment should contain a task identifier, input revision, allowed tools, deadline, output schema, and acceptance criteria. Give a source investigator a bounded question rather than the entire mutable conversation. See agent handoff contracts for the ownership and context boundaries that keep these assignments interpretable.
Calculate the critical path and the capacity cost
For three independent branches taking 4, 7, and 11 seconds, sequential execution takes 22 seconds before synthesis. Ideal concurrent execution takes 11 seconds, plus dispatch and joining overhead. If synthesis takes 5 seconds, the illustrative totals are 27 seconds sequentially and at least 16 seconds concurrently.
That calculation assumes uncongested dependencies. If all branches compete for one constrained model endpoint, their waiting time can erase the gain. The longest branch also dominates an all-results join, so adding a slow specialist can worsen latency even when every other specialist is fast.
Use a second calculation for sustainable load. In an illustrative service, 6 incoming requests per second with 4 branches each produce 24 branch starts per second before retries. If a branch occupies capacity for an average of 3 seconds, steady operation requires roughly 72 in-flight branch slots under these assumptions. A scheduler capped at 30 cannot sustain that arrival pattern without reducing work, delaying admission, or rejecting requests.
This is a planning estimate, not a sizing guarantee: variable token lengths, burst arrivals, shared quotas, and correlated failures require measurement. Record queue waiting separately from execution duration. A fast model call preceded by a long queue is still a slow task.
Choose the fan-in contract explicitly
Different joins answer different product questions:
| Join policy | Suitable situation | Main risk |
|---|---|---|
| All required branches | Every evidence category is mandatory | One straggler delays completion |
| Required set plus optional deadline | Core checks are mandatory; enrichment is optional | Missing enrichment must stay visible |
| First acceptable result | Equivalent providers can independently solve the task | Fastest output may fail validation |
| Quorum | Independent checks have a meaningful agreement rule | Correlated errors make agreement misleading |
For the report example, require technical and internal evidence while allowing the public-source enrichment to expire. Return a partial report only if the product permits that state, and identify the missing category. Never have the synthesizer silently infer that a cancelled branch found nothing relevant.
“First acceptable” means validated, not merely first returned. A result with an invalid tenant identifier, missing provenance, or an unsupported conclusion is not a winner. Keep the join policy in code and test data so it cannot drift with the synthesis prompt.
Python's TaskGroup waits for its tasks and ordinarily cancels remaining tasks when a child raises a non-cancellation exception. By contrast, default gather propagates the first exception without automatically cancelling other submitted awaitables. Select the primitive according to the intended failure contract. Python asyncio tasks.
Merge evidence without last-writer ambiguity
Branch outputs should be immutable envelopes rather than edits to one shared paragraph. An illustrative envelope contains branch_id, input_revision, status, evidence, limitations, and finished_at. Evidence items carry a source identity, location, retrieval time, and the claim they support.
The joiner validates each envelope, deduplicates evidence, and rejects results generated from an obsolete input revision. Preserve disagreements: if two sources describe different policy versions, retaining both with dates is more useful than asking the merge step to average them.
A reducer should be independent of arrival order when the business meaning permits it. A set keyed by evidence identity is easier to reason about than appending arbitrary strings and treating the first one as authoritative. Where order matters, persist a deliberate ordering key instead of relying on network completion order.
Concurrent outputs also need bounded size. Four agents returning their complete transcripts can exceed the synthesizer's context budget. Request focused findings with evidence references and fetch supporting material when needed. Output compression must retain uncertainty and exclusions, not just attractive conclusions.
Apply backpressure before creating expensive work
A semaphore around model calls limits active calls inside one process. It does not automatically limit total requests across replicas, total queued tasks, or downstream tool usage. Separate admission capacity, execution concurrency, request-rate limits, token budgets, and queue bounds.
For this proposed design, reserve branch capacity and estimated resource allowance before dispatch. If the reservation fails, wait within the user's deadline, reduce optional work according to policy, or return a clear overload outcome. Do not launch work and hope that all branches independently observe sufficient remaining budget.
AWS explains that durable queues can accumulate work faster than a service can drain it, extending recovery and making results arrive after they are useful. Its discussion supports monitoring backlog age and controlling admission rather than treating persistence as unlimited capacity. AWS: Avoiding insurmountable queue backlogs.
Use per-tenant fairness so one large request cannot occupy every slot. A scheduler might permit at most two active branches from a tenant while allowing other tenants to progress. Those numbers are policy choices to evaluate. Define whether queued work expires and whether expired requests consume a retry allowance; otherwise stale jobs can displace fresh requests indefinitely.
Cancel stragglers without assuming rollback
When an optional branch misses its deadline, mark it unnecessary for the join and request cancellation. Cancellation is a lifecycle signal, not proof that a remote operation stopped. A worker may already have sent an API request, incurred token charges, or committed an external mutation.
Prefer read-only branches for speculative races. If parallel work can write, require stable action identities and reconcile uncertain outcomes before retrying. The implementation details belong with idempotency for agent actions, because cancelling a local task cannot deduplicate a remote effect.
Durable orchestration adds another boundary. Temporal documents that child workflows have their own execution histories and that parent closure affects children according to their Parent Close Policy. A parent does not automatically imply that all descendants have disappeared. Temporal child workflows.
Persist which branches were started, which are still running, and whether cancellation was acknowledged. Ignore a late result for an already closed join unless an explicit amendment workflow accepts it. Release local capacity when local work ends, but track uncertain external activity separately; otherwise the accounting can claim spare capacity while remote requests continue.
Validate orchestration with adversarial schedules
Test the same task under different completion orders. A correct join should produce equivalent evidence coverage when optional timing differences do not matter. Then inject duplicate delivery, a branch timeout, a malformed envelope, an input revision change, and a cancellation arriving immediately before completion.
Assert properties rather than one transcript: mandatory evidence cannot be skipped; closed joins reject late writes; reservations cannot oversubscribe the shared budget; every started branch reaches a recorded outcome or an explicit unresolved state. Test these controls without an LLM first, using predictable branch simulators.
Measure end-to-end success, queue age, active branches, unused speculative work, and cancellation acknowledgement delay. Compare concurrency settings on representative tasks. A faster median with more deadline failures or twice the cost per accepted report may be a poor operating point.
Frequently asked questions
Should every independent task become a separate agent?
No. A deterministic function, batched retrieval request, or ordinary asynchronous call may solve it more cheaply. Use an agent when the branch needs iterative language-based decisions and has a useful verification boundary.
Can quorum make multiple model answers trustworthy?
Only within an evaluated agreement rule. Agents sharing the same model, evidence, and prompt can share the same mistake. Agreement is an observation, not independent proof; verify important claims against evidence or application invariants.
Should a failed branch fail the whole workflow?
That depends on the declared join contract. Missing mandatory authorization evidence should stop the action. Missing optional enrichment may permit a labelled partial result. Encode the distinction before execution and preserve it in the final response.
Source reference list
Related reading
- Agent Handoffs: Shared State, Ownership, and Context Contracts
Design agent handoffs with versioned context packets, explicit ownership, stale-worker fencing, and evidence provenance across specialist workflows.
- Idempotency for AI Agent Actions: Preventing Duplicate Side Effects
Prevent duplicate AI agent actions with stable intent identities, immutable request fingerprints, durable ledgers, and recovery for uncertain outcomes.
- AI Agent Rate Limits: Backpressure and Admission Control
Control AI agent overload with request and token budgets, bounded queues, fair scheduling, and admission rules that protect useful task completion.