Home / Several agents and adversarial checking
Making a large scale fan-out hold together
A bulky deliverable handed to a single agent gets cut off by an output size limit with nothing written at all: split by axis, have each agent write to its own file, respect the documented cap of sixteen agents active at once and one thousand agents in total on a single run, a single call accepting up to 4,096 items that the runtime itself schedules under that cap, then verify by comparing the expected files against what actually exists on disk rather than taking the agents' word for it.
A single agent tasked with writing an over-long deliverable gets interrupted by an output size limit, and nothing gets written to disk: the task looks impossible when the real problem lies in the splitting. The fix fits in one sentence, one agent per axis, each writing its own file, so that the limit only ever bears on a single file at a time rather than on the whole deliverable.
The documented cap
Claude Code caps the number of agents active at the same time at sixteen, a figure that drops if the machine has fewer processors available, including inside a container with a limited number of cores. A second cap, distinct from the first, limits the total number of agents launched across an entire run to one thousand, precisely to stop a runaway loop from launching agents endlessly. These two counters must not be confused: the first bounds what is running at a given instant, the second bounds the cumulative total over the whole duration of the work. A third figure changes the practical picture: a single parallel() or pipeline() call accepts up to four thousand and ninety six items, and the runtime itself schedules them under the cap of sixteen, with no manual step, a longer submission being simply rejected with an error rather than silently truncated. Splitting manually into successive waves, each wave checked before the next one starts, keeps its use, but as a choice for verifying the work in batches rather than as the only way to stay under the concurrency cap.
Verify the disk, not the report
An agent that claims to have written its file can be wrong, about its own output path or about the content actually produced. The discipline that closes the loop is to write, before launching the fan-out, the exact list of expected files, then compare it afterwards against what genuinely exists on disk, never against the reports the agents themselves send back.
# liste attendue, écrite avant le lancement
cat > attendus.txt < obtenus.txt
diff attendus.txt obtenus.txt
One last reflex saves budget on a large volume of similar calls that do not need an immediate answer. The Batch API processes this kind of work asynchronously with a fifty percent discount on token cost, on a rate quota separate from live calls. It suits a fan-out that is already written and ready to run in one go, not work where each step depends on the result of the one before.
These three disciplines combine in the reverse order of their discovery. You first isolate each agent in its own worktree, then respect the concurrency cap through waves, and finally verify on disk what the fan-out actually produced, never what the agents said about it.
Two distinct caps on a fan-out
A fan-out checked in waves, a choice and not an obligation
A coordinator launches twenty four agents in a single go, each tasked with writing the sheet for a different product in the catalogue, every agent instructed to write its result into a separate file named after the product.
Write in one sentence what this situation establishes, and in one sentence what it does not establish.
What this establishes: The number of agents requested in a single go, twenty four, exceeds the cap of sixteen agents active at once, but stays well under the limit of 4,096 items per call, so the runtime itself schedules these twenty four agents in groups without the coordinator having to split anything.
What this does not establish: It does not establish how many of the twenty four expected files actually exist on disk at the end, nor whether their content matches the product named in their filename.
The three most common miscalibrations
- Too broad This situation proves that the eight excess agents will fail completely and never produce their file.
- Too narrow This situation says nothing about the number of agents requested, since only the final result counts.
- Beside the point This situation shows that the product catalogue contains at least twenty four different items.
- A single agent tasked with writing an over-long deliverable gets interrupted by an output size limit, and nothing gets written to disk until the splitting by axis and by file has been done.
- The cap of sixteen agents active at once and the cap of one thousand agents in total on a single run are two distinct counters, one for the present instant, the other for the cumulative total.
- A single parallel() or pipeline() call accepts up to 4,096 items and the runtime schedules them itself under the concurrency cap; splitting into waves stays useful for checking the work in batches, not for respecting the cap, which the runtime already respects.
- The list of expected files, written before the fan-out is launched, is compared against the actual content of the output folder, never against the reports the agents send back.
Before your next fan-out of more than a handful of agents, write the exact list of files you expect into a file, launch the fan-out, then compare that list against the actual content of the output folder before trusting any agent's report.
These points depend on an interface or a rule that may have changed since this was written. Check them on your own screen before relying on them.
- Check the current Claude Code documentation to see whether the cap of sixteen concurrent agents has changed since this lesson was written, this cap depends on the number of processors available on the machine running it.
Every datable claim in this lesson links here to the public text behind it. A source that does not open proves nothing.
- Claude Code, workflows documentation, consulted on 2026-09-02 consultée le 2026-09-02
- Batch API, Claude documentation, consulted on 2026-09-02 consultée le 2026-09-02