---
title: Recipe: Try boldly, rewind if it breaks · Agent Playground docs
description: An agent tries a bold change on a saved checkpoint. If the tests break, the files go back to the checkpoint and it tries another way. What it does, when to use it, how to make it yours, and what a run costs.
url: https://www.quietrobot.ai/docs/playground/recipes/safe-rewind
---

# Recipe: Try boldly, rewind if it breaks

An agent tries a bold change on a saved checkpoint. If the tests break, the files go back to the checkpoint and it tries another way. What it does, when to use it, how to make it yours, and what a run costs.

Saves a checkpoint, then lets an agent try a bold restructuring. If the tests break, the files go back to the checkpoint and the agent tries another way, told what went wrong. If a limit stops the run, the sandbox rewinds to the checkpoint too, so a failed exploration never leaves a mess.

| At a glance | |
|---|---|
| **Level** | Advanced |
| **Category** | Safety |
| **Shape** | Checkpoint, try, rewind on failure, retry |
| **Plan** | Free and up |
| **Needs a Claude key** | Yes |
| **Limits it comes with** | 3 loops, 900 seconds, $0.90 |

```flow
{"recipe": "safe-rewind", "title": "Try boldly, rewind if it breaks, as it is on the canvas.", "nodes": [["setup", "run", "Save a checkpoint"], ["try", "agent", "Agent tries a bold fix"], ["tests", "branch", "Do the tests pass?"], ["rewind", "run", "Rewind to the checkpoint"], ["keep", "approval", "Keep the change?"], ["commit", "run", "Commit it"], ["dropped", "run", "Rewind and stop"]], "edges": [["setup", "try"], ["try", "tests", "Done"], ["tests", "rewind", "No"], ["rewind", "try"], ["tests", "keep", "Yes"], ["keep", "commit", "Approved"], ["keep", "dropped", "Denied"]]}
```

## The steps

| Step | Block | What it does |
|---|---|---|
| Save a checkpoint | Run command | Writes the shopping-cart module and its tests, and commits them as the checkpoint. |
| Agent tries a bold fix | Agent | An agent restructures the module, told which try this is and what the last check said. |
| Do the tests pass? | Decide | Runs the tests. |
| Rewind to the checkpoint | Run command | Puts every file back as it was at the checkpoint, then goes back to the agent. |
| Keep the change? | Approval | A person reads the change, then approves to keep it. |
| Commit it | Run command | Commits the change. |
| Rewind and stop | Run command | Puts the files back and stops. Nothing is kept. |

## When to use it

* An agent should try something risky, like a refactor or a migration, without leaving a half-done change behind.
* You want each retry to start from a clean state, not from the last broken try.
* You want the run to clean up after itself when it hits a limit.

## 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 **Try boldly, rewind if it breaks**. 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](https://www.quietrobot.ai/docs/playground/ai-steps#add-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**.
5. When the run waits for a person, approve or deny it from the banner, from **Approvals**, or from the approval email.

**What you'll see:** If the first try breaks the tests, **Rewind to the checkpoint** runs and the agent's second try starts from clean files. Once the tests pass, the run waits for a person at **Keep the change?**.

## Make it yours

1. Clone your repository in **Save a checkpoint**; the step commits the starting point.
2. Change the agent's goal to the change you want explored, and the test command in **Do the tests pass?**.
3. For changes outside git, like a database, take a sandbox snapshot instead and restore it in the rewind step. **If stopped, go back to** under the flow's limits rewinds the whole sandbox when a limit stops the run.

## 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.

| | Typical | 1 in 10 runs | At most |
|---|---|---|---|
| **Sandbox time** | $0.003 | $0.005 | $0.01 |
| **Claude, on your key** | $0.13 | $0.30 | the run's spend limit |
| **How long it takes** | about 4 minutes | about 7 minutes | 900 seconds |

A typical run uses $0.003 of sandbox time, so about 300 runs cost $1, and every plan includes $5 of usage a month. The time includes a person taking a minute or two to answer the approval. The clock, and the sandbox, keep running while the run waits. 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 $0.90 or 900 seconds, whichever comes first.

## Related

* [Runaway loop](https://www.quietrobot.ai/docs/playground/recipes/runaway-loop)
* [Limits and safety](https://www.quietrobot.ai/docs/playground/safety)
* [All recipes](https://www.quietrobot.ai/docs/playground/recipes)
