quiet robot

Recipe: Three agents race, tests pick

Copies a project into three sandboxes, gives each a differently told agent, and keeps the passing fix with the fewest changes. What it does, when to use it, how to make it yours, and what a run costs.

View as Markdown

Copies one project into three sandboxes and sets an agent loose in each, told to work a different way: the smallest fix, a clean rewrite, or the rules first. A score step in each lane runs the tests and counts changed lines, and the judge keeps the lane that passes with the fewest changes. The losers' sandboxes are deleted.

At a glanceNotes
LevelAdvanced
CategoryCoding
ShapeForked sandboxes, an agent in each, a judge
PlanPay as you go (runs 4 sandboxes at once)
Needs a Claude keyYes
Limits it comes with1 loop, 900 seconds, $1.00
Claude key limit for a run$1.00 of Claude
Three agents race, tests pick, as it is on the canvas.Set up the project (Run command), Fork ×3 (Try in parallel), Smallest fix (Agent), Clean rewrite (Agent), Rules first (Agent), Score lane A (Run command), Score lane B (Run command), Score lane C (Run command), Highest score (Keep the best), Keep the winner (Run command). Arrows: Set up the project to Fork ×3; Fork ×3 to Smallest fix; Smallest fix to Score lane A on Done; Score lane A to Highest score; Fork ×3 to Clean rewrite; Clean rewrite to Score lane B on Done; Score lane B to Highest score; Fork ×3 to Rules first; Rules first to Score lane C on Done; Score lane C to Highest score; Highest score to Keep the winner on Passed.DoneDoneDonePassed>_ RUN COMMANDSet up the project⑂ TRY IN PARALLELFork ×3lanes A, B and C◉ AGENTSmallest fixlane A◉ AGENTClean rewritelane B◉ AGENTRules firstlane C>_ RUN COMMANDScore lane Alane A>_ RUN COMMANDScore lane Blane B>_ RUN COMMANDScore lane Clane C★ KEEP THE BESTHighest scorehighest "score">_ RUN COMMANDKeep the winner
Three agents race, tests pick, as it is on the canvas.
Try it nowSimulateRun

Opens it in the Playground as a flow of your own. Simulate shows what a run costs. Run asks before it starts.

The steps

StepBlockWhat it does
Set up the projectRun commandWrites a small shopping-cart module with three pricing bugs and five tests, and commits it so changes can be counted.
Fork ×3Try in parallelCopies the sandbox into lanes A, B and C.
Smallest fixAgentLane A: an agent fixes it with the smallest change it can.
Clean rewriteAgentLane B: an agent rewrites the functions cleanly.
Rules firstAgentLane C: an agent writes down the rules first, then fixes.
Score lane A, B, CRun command, one per laneEach lane's score: 100 for each passing test, minus 1 for each changed line, printed as {"score": ...}.
Highest scoreKeep the bestKeeps the lane with the highest score.
Keep the winnerRun commandShows the winning change and saves it as shop/winning.patch.

When to use it

  • You don't know which approach, prompt or model will solve a task, and trying them one after another is slow.
  • You want the winner picked by tests and numbers, not by taste.
  • Each try must not see or break the others.

Run it

The quick way: choose Try it now under the drawing. It opens the recipe in the Playground as a flow of your own, after you sign in if you aren't yet. Simulate opens it and shows the forecast, and Run opens it and asks before it starts, with what the run will likely cost. From the dashboard instead:

  1. In the dashboard sidebar, open Agent Playground → Recipes and find Three agents race, tests pick. Choose Advanced to filter the list. In the builder, Recipes in the toolbar lists them too.
  2. Choose Use this recipe. It becomes a flow of your own, so changing it never changes the recipe.
  3. If you haven't yet, save your Claude key on the Secrets page. The builder offers Add a key… in the step's key list if it's missing.
  4. Choose Simulate to see the forecast, then Run.

What you'll see: The three agents work at the same time, each in its own sandbox. Open each lane's score step to compare them. The judge keeps one, and Keep the winner shows its diff.

Make it yours

  1. Clone your repository in Set up the project instead of writing the sample, and change the test command in .qr/score.py.
  2. Give each agent a different goal, model or turn limit. Each agent's caps are on its step, under It stops at whichever comes first.
  3. Change the score: for example passing tests minus seconds taken, or a benchmark's number. The judge reads the last JSON line each lane prints.
  4. The flow's key limit caps all three agents together at $1 a run. The Policy panel shows it; change it in the flow's JSON under policy.keyBudgets.

What a run costs

These are the builder's own forecast for the recipe as it comes, with its limits, rounded. Simulate shows the same numbers for your version, and they change as you change the flow.

NotesTypical1 in 10 runsAt most
Sandbox time$0.006$0.008$0.04
Claude, on your key$0.21$0.34the run's spend limit
How long it takesabout 2 minutesabout 3 minutes900 seconds

A typical run uses $0.006 of sandbox time, so about 180 runs cost $1, and every plan includes $5 of usage a month. That includes all 4 sandboxes: the main one and each lane. Claude is billed by Anthropic to your own key, at their usual prices. The run counts it toward its spend limit, so it can't overspend, but we don't charge you for it. At most is the most a run could cost with these limits: it stops at $1.00 or 900 seconds, whichever comes first.

  • Agent PlaygroundQuickstart: build and run your first flow
  • Agent PlaygroundBlocks
  • Agent PlaygroundRecipes
  • SandboxesQuickstart: your first sandbox
  • SandboxesMCP server
  • SandboxesAPI reference
  • InsightsAll posts