Lesson 2 of 5 in Many agents at once · 10m
Race and pick
After this lesson you know when it pays to give one task to several agents at once, how to write a prompt that makes their attempts comparable, and how to read the results and keep one.
Why run the same task more than once
An agent's first attempt is one sample. For a task with one obvious answer, one sample is enough. For a task with several defensible answers, the first attempt is mostly a coin toss, and you only learn what the alternatives looked like by asking again.
A race asks several agents at once, each in its own worktree. Instead of arguing about which approach to try first, you read three finished attempts and keep the best. Reading is faster than retrying one at a time, and seeing the alternatives side by side often shows you what you actually wanted.
When a race is worth it
Race when the answer is uncertain and reading is cheap:
-
Design choices. "Add caching to the search endpoint." In-memory, on disk, or HTTP headers? Three entrants will likely pick differently.
-
A bug with an unclear cause. Each entrant may chase a different hypothesis. The one with a failing test that now passes wins.
-
A refactor where taste matters. You'll know the cleanest version when you see it, and not before.
Don't race when the task is well specified. "Rename userId to accountId across the API" has one right answer, and a race only pays for it three times. Don't race large tasks either. Every entrant's diff has to be read, and three 2,000-line diffs aren't a comparison you'll do well.
Write a prompt that makes attempts comparable
Every entrant gets the same prompt and nothing else. No conversation history, nobody to ask. So the prompt has to be a complete brief (see Write a task brief), plus two things that matter more in a race:
-
One way to judge. Name the test, the command or the behavior that decides which attempt is better. "The fastest correct answer to npm test -- search" is something you can check. "The nicest" isn't.
-
Room to differ, inside fences. Say what is fixed (the public API, the files out of bounds) and leave the approach open. If you specify the approach, you've written one answer three times.
A worked prompt:
The /search endpoint takes 900 ms on the fixture in tests/fixtures/big.json.
Make it faster without changing its response shape.
Done when: npm test -- search passes and the timing test in
tests/search.perf.test.ts reports under 200 ms.
Don't touch src/api/routes.ts or add a dependency.
Commit your work with a message that names your approach.
Read the attempts, then pick
When the entrants finish, you have a summary from each and a branch from each. They aren't the same thing. The summary is what the agent says it did; the branch is what it did. Read in this order:
-
The shape. The size of each change. An attempt five times larger than the others either found something the others missed or wandered off.
-
The check. Run the test that decides the race in each entrant's checkout. An attempt that doesn't pass it is out, however good its summary sounds.
-
The diff. Read the survivors. Pick the one you'd rather maintain.
You can hand step 3 to a panel of models first (see Judges and second opinions), but the pick is yours.
Picking keeps a branch. It doesn't merge it. The winner still goes through review like any other branch.
Go further
- Fleet reference — the
race_*tools, entrant limits and budget rules - One worktree per agent — why each entrant gets its own checkout
- Judges and second opinions — score the attempts before you read them all
- Review the diff — read the winner the way you'd read anyone's
- Fleet — where the race budget is set