Agent Playground
Tutorial 4: Try several ideas at once
Copy a sandbox into three lanes that run side by side, get a shipping quote in each, and keep the cheapest. The pattern behind bake-offs, A/B tests and comparisons.
When you're not sure which way is best, you don't have to try them one after another. In this tutorial you'll split a run into three lanes that run at the same time, each with its own copy of the files, and then keep the best result. The example asks three shippers for a quote and books the cheapest, but the same shape works for comparing prompts, settings, suppliers or ideas.
Time: about 15 minutes. Plan: Pay as you go. This flow runs four sandboxes at once (the main one and three lanes), and Free runs up to three. Cost of a run: a fraction of a cent.
1. Write the order
- In Agent Playground, choose New flow and name it
Get three shipping quotes. - Click the Start step, name it
Write the order, and set its Command to:
echo '12 boxes, 140 lb, Indianapolis to Denver' > order.txt && cat order.txtEvery lane gets a copy of this file, so each shipper quotes on the same order.
2. Split into three lanes
- With Write the order selected, click Try in parallel in the Blocks panel (under Sandbox). Name it
Ask three shippers. - In its settings, set the lanes to
A,BandC. You can name lanes anything short, likeFastandSafe.
When the run reaches this block, it copies the sandbox into three lanes, in about a second.
3. Get a quote in each lane
Add three Run command steps, one per lane. For each one, set Run in to its lane, and connect it from Ask three shippers.
| Name | Run in | Command |
|---|---|---|
Quote from shipper A | Lane A | echo 'Shipper A: $48.20' > quote.txt && cat quote.txt && echo '{"price": 48.20}' |
Quote from shipper B | Lane B | echo 'Shipper B: $41.75' > quote.txt && cat quote.txt && echo '{"price": 41.75}' |
Quote from shipper C | Lane C | echo 'Shipper C: $52.00' > quote.txt && cat quote.txt && echo '{"price": 52.00}' |
These commands stand in for asking a real shipper. In your own flow, each lane would call that shipper's website or API, or use an Agent to fill in their quote form.
The important part is the last bit of each command: a line of JSON with the number to compare, here {"price": 48.20}. That's how the next block knows which lane did best.
4. Keep the cheapest
- Add a Keep the best block (under Sandbox) and name it
Keep the cheapest. Connect all three lanes to it. - Set Number to compare to
price. - Set Best is to Lowest.
Keep the best reads each lane's number, keeps the winning lane as the main sandbox, and deletes the others. Only a lane that passed can win, so a lane whose step failed (say, a shipper's site was down) simply drops out.
Finally, add a Run command named Book it, connected from Passed on Keep the cheapest, with:
echo "Booking with $(cat quote.txt)"It runs in the winning lane's sandbox, so quote.txt is the cheapest shipper's quote.
5. Run it
Set the limits to Loops 1, Time 120 seconds and Spend $0.05, and choose Run.
All three quotes run at the same time, so three take about as long as one. Keep the cheapest shows every lane's number and which one it kept: shipper B, at $41.75. Book it says Booking with Shipper B: $41.75.
When to use lanes
- Compare and pick: three suppliers, three prompts for an AI, three settings for a report. Print the number you care about (
price,score,seconds) and let Keep the best choose. - Try risky options safely: each lane has its own copy, so a lane that makes a mess can't affect the others. The Dependency upgrade bot recipe tries three upgrade plans this way and keeps the boldest one that still works.
- Make a wrong answer lose: have each lane fail if its answer is wrong, so a fast or cheap wrong answer can never win. The Try 3, keep the best recipe shows this.
Each lane is a sandbox, and you pay for each one's time, so three lanes cost about three times one. A short lane still costs a tiny fraction of a cent.
What you learned
- Try in parallel copies the sandbox into lanes that run at the same time.
- Run in on each step picks its lane.
- Keep the best compares a number each lane prints as JSON, keeps the best lane that passed, and carries on in it.
Next
In Tutorial 5, you'll add AI to a flow: one step that drafts a reply with Claude, and an agent that works toward a goal on its own.