---
title: Data and evals recipes · Sandboxes docs
description: Five worked examples for data and comparisons: scrape a flaky site with retries, research a question three ways, fix a spreadsheet analysis until it runs, try three ideas at once, and score prompts side by side.
url: https://www.quietrobot.ai/docs/sandboxes/playground/recipes/data-and-evals
---

# Data and evals recipes

Five worked examples for data and comparisons: scrape a flaky site with retries, research a question three ways, fix a spreadsheet analysis until it runs, try three ideas at once, and score prompts side by side.

> [!NOTE]
> Sandboxes is in early access. It is free to try, some parts are still in testing, and details may change.

Each recipe below says what it does, shows its shape, walks through its steps, and ends with how to make it your own. See [Recipes](https://www.quietrobot.ai/docs/sandboxes/playground/recipes) for how recipes work.

## Scraper with retries

**The pattern:** a retry loop with a pause. Websites are often busy or slow; this one waits and tries again instead of giving up.

```flow
{"title": "Scraper with retries", "nodes": [["site", "run", "Start test site"], ["fetch", "code", "Fetch page"], ["pause", "wait", "Wait 3 s"], ["parse", "code", "Parse table"], ["save", "run", "Save"]], "edges": [["site", "fetch"], ["fetch", "pause", "Failed"], ["pause", "fetch", "Next"], ["fetch", "parse", "Passed"], ["parse", "save"]]}
```

| Step | Block | What it does |
|---|---|---|
| Start test site | Run command | Starts a small website inside the sandbox that answers "busy, try again" the first two times. |
| Fetch page | Run code | Downloads the page. Fails if the site is busy or can't be reached. |
| Wait 3 s | Wait | Gives the site a moment, then goes back to Fetch page. |
| Parse table | Run code | Reads the price table out of the page into `prices.csv`. |
| Save | Run command | Shows how many rows were saved and the first one. |

**Limits:** 5 loops, 240 seconds, $0.05.

**What you'll see:** Fetch page fails twice ("The site answered 503: will wait and try again"), passes on the third try, and three prices are saved.

**Make it yours:** delete **Start test site** and point **Fetch page** at the real page. Set the flow's **Policy** to **Only these sites** with just that site, so the scraper can't reach anything else. Raise **Wait** for sites that ask you to slow down, and keep **Loops** low so a site that's down for the day doesn't keep you trying.

## Deep research report

**The pattern:** lanes that research a question three different ways, keep the best-sourced draft, then a loop that checks every claim has a source.

```flow
{"title": "Deep research report", "nodes": [["setup", "run", "Load the library"], ["fork", "fork", "Fork ×3", "Skim, Search, Deep"], ["skim", "run", "Skim each page", "Lane Skim"], ["search", "run", "Search for keywords", "Lane Search"], ["deep", "run", "Read everything", "Lane Deep"], ["judge", "judge", "Most sourced claims", "highest sourced"], ["check", "run", "Every claim sourced?"], ["cite", "code", "Find a source or cut it"], ["report", "code", "Write the report"]], "edges": [["setup", "fork"], ["fork", "skim"], ["fork", "search"], ["fork", "deep"], ["skim", "judge"], ["search", "judge"], ["deep", "judge"], ["judge", "check", "Passed"], ["check", "cite", "Failed"], ["cite", "check", "Passed"], ["check", "report", "Passed"]]}
```

| Step | Block | What it does |
|---|---|---|
| Load the library | Run command | Writes four short articles about free shipping for a small shop: the research library. |
| Skim, Search, Read everything | Run command, one per lane | Three ways to draft an answer, each with the network off. "Read everything" collects the most, including two claims with no source behind them. |
| Most sourced claims | Keep the best | Keeps the draft with the most claims that cite a source. |
| Every claim sourced? | Run command | Fails if any claim has no source, and lists them. |
| Find a source or cut it | Run code | For the first unsourced claim: cites the article that backs it, or cuts it. |
| Write the report | Run code | Writes `report.md` with numbered sources. |

**What you'll see:** the deepest draft wins, but it has two unsourced claims. The check loop finds a source for one and cuts the other ("Free shipping always pays for itself within a month" has nothing behind it), and the report comes out with every claim cited.

**Make it yours:** load your own documents in the first step, and make each lane an **Agent** or **Ask AI** step that drafts from them in a different style, printing `{"sourced": N}` at the end. Keep the source check exactly as it is: it's what stops a made-up claim reaching the report.

## Analyze my spreadsheet

**The pattern:** a loop that reads its own errors. Real spreadsheets have messy cells; the analysis crashes, reads why, and tries again.

```flow
{"title": "Analyze my spreadsheet", "nodes": [["setup", "run", "Load the spreadsheet"], ["profile", "code", "Look at the data"], ["write", "run", "Write the analysis"], ["analyze", "run", "Run the analysis", "no network"], ["fix", "code", "Read the error, fix it"], ["report", "run", "Show the summary"]], "edges": [["setup", "profile"], ["profile", "write"], ["write", "analyze"], ["analyze", "fix", "Failed"], ["fix", "analyze", "Passed"], ["analyze", "report", "Passed"]]}
```

| Step | Block | What it does |
|---|---|---|
| Load the spreadsheet | Run command | Writes a small sales sheet with some messy amounts: `"1,200.50"`, `n/a` and a blank. |
| Look at the data | Run code | Counts rows and columns and how many amounts aren't plain numbers. |
| Write the analysis | Run command | Writes a first, simple analysis script. |
| Run the analysis | Run command | Runs it with the network off. On a crash, prints the last line of the error. |
| Read the error, fix it | Run code | Reads that error and writes a better script. |
| Show the summary | Run command | Shows sales by region and saves a bar chart as `chart.svg`. |

**Limits:** 4 loops, 180 seconds, $0.05. **If stopped, go back to:** Write the analysis.

**What you'll see:** the first try crashes on `1,200.50`, the second on `n/a`, and the third skips what it can't read and finishes: sales by region, the top region, and how many rows were left out.

**Make it yours:** upload your own sheet in the first step (or download it), and replace **Read the error, fix it** with an **Agent** whose goal is "The analysis crashed with this error: {output of Run the analysis}. Fix analysis.py." Its **Check that it worked** can be the analysis itself.

## Try 3, keep the best

**The pattern:** parallel lanes, fastest correct answer wins.

```flow
{"title": "Try 3, keep the best", "nodes": [["setup", "run", "Set up"], ["fork", "fork", "Fork ×3", "lanes A, B, C"], ["a", "run", "Insertion sort", "Lane A"], ["b", "run", "Built-in sort", "Lane B"], ["c", "run", "Dedupe + sort", "Lane C"], ["judge", "judge", "Judge", "lowest ms"], ["keep", "run", "Keep winner"]], "edges": [["setup", "fork"], ["fork", "a"], ["fork", "b"], ["fork", "c"], ["a", "judge"], ["b", "judge"], ["c", "judge"], ["judge", "keep", "Passed"]]}
```

| Step | Block | What it does |
|---|---|---|
| Set up | Run command | Writes a benchmark: 4,005 numbers to sort, with a few repeats. |
| Fork ×3 | Try in parallel | Copies the sandbox into lanes A, B and C. |
| Insertion sort, Built-in sort, Dedupe + sort | Run command, one per lane | Each sorts the numbers its own way, checks the answer, and prints `{"ok": ..., "ms": ...}`. |
| Judge | Keep the best | **Number to compare:** `ms`. **Best is:** Lowest. |
| Keep winner | Run command | Runs in the winning sandbox. |

**Limits:** 1 loop, 180 seconds, $0.05.

**What you'll see:** lane C is fast but wrong (it drops the repeats), so it fails and drops out. Lanes A and B are both right, and B is far faster, so it wins.

**Make it yours:** put three approaches in the lanes: three libraries, three settings, three prompts to an agent. Each lane must print a JSON line with the number to compare, and fail if its answer is wrong, so a fast wrong answer can never win.

## Eval harness

**The pattern:** parallel lanes, best score wins. The same as above, but with a score to maximize instead of a time to minimize.

```flow
{"title": "Eval harness", "nodes": [["setup", "run", "Load test set"], ["fork", "fork", "Fork ×3", "lanes T, S, E"], ["t", "run", "Terse prompt", "Lane T"], ["s", "run", "Step by step", "Lane S"], ["e", "run", "With examples", "Lane E"], ["judge", "judge", "Best score", "highest score"], ["report", "run", "Report"]], "edges": [["setup", "fork"], ["fork", "t"], ["fork", "s"], ["fork", "e"], ["t", "judge"], ["s", "judge"], ["e", "judge"], ["judge", "report", "Passed"]]}
```

| Step | Block | What it does |
|---|---|---|
| Load test set | Run command | Writes six questions with known answers, and a scorer. |
| Fork ×3 | Try in parallel | Lanes T, S and E. |
| Terse prompt, Step by step, With examples | Run command, one per lane | Scores one prompt style against the questions and prints `{"score": ...}`. |
| Best score | Keep the best | **Number to compare:** `score`. **Best is:** Highest. |
| Report | Run command | Names the winning prompt. Its sandbox is kept. |

**What you'll see:** "With examples" gets all six right and wins. The other two each miss at least one.

**Make it yours:** replace each lane with an **Ask AI** step (or a script that calls Claude through your key) that answers your test set with one prompt, followed by a **Run code** step that scores the answers and prints `{"score": ...}`. Run it again after each prompt change, and use [Compare](https://www.quietrobot.ai/docs/sandboxes/playground/runs#compare-two-runs) to see which answers changed.
