Sandboxes
Limits and safety
How the Agent Playground keeps a run from looping forever, overspending or doing something you didn't want, with limits, approvals, per-flow rules and keys that never enter the sandbox.
Letting an AI work on its own is useful because it can try again and again. That's also the risk: it can try forever, spend money while it does, or do something you'd have said no to. The Playground puts five kinds of protection around every run.
| Protection | Stops |
|---|---|
| Limits | A run that loops too often, runs too long or spends too much. |
| Approvals | A step running before a person says yes. |
| Policy | Commands you don't want, and connections to sites you haven't allowed. |
| Checkpoints and rewind | A stopped run leaving a half-done mess. |
| Keys that stay out | Your API keys leaking from the sandbox. |
Limits
Every run has three limits. Open Limits in the builder to set them.
| Limit | What counts | Default | Range |
|---|---|---|---|
| Loops | Each trip back round a loop counts once. | 5 | 1 to 50 |
| Time | Seconds from the first step, including time spent waiting for a person. | 300 | 10 to 3,600 |
| Spend | What the run costs: sandbox time plus AI usage at list prices. | $0.25 | $0.01 to $5 |
A run stops at whichever comes first. The limits are checked on our side, not in your browser, so a run stops on time even if you close the tab or lose your connection. A command that is running when a limit is reached is stopped within a couple of seconds.
Picking good limits. Run Simulate first. The forecast shows how often each limit would stop the run, and At most, the most a run could cost with the limits you set. If the loop limit stops a large share of simulated runs, raise Loops or improve the step that keeps failing. If the worst case is more than you'd want to spend, lower Spend or Time.
An agent has its own limits too: Turns and Spend on the model. Whichever is reached first, the agent's or the run's, stops it.
Approvals
There are three ways to make a run wait for a person:
- An Approval block. The run pauses at that point with your question, like "Ship this fix?". Approved and Denied each have their own exit, so you decide what a "no" does.
- Ask a person first on a step, under Advanced. That step waits before it runs. On an agent, every command it runs and every file it writes waits.
- Rules that hold commands. Your organization's approval rules (like
rm -rf,sudoorgit push) hold matching commands in every run, and a flow's policy can add more.
A waiting step shows as waiting in the run, appears in Approvals in the dashboard, and sends the usual approval email to the people you chose. Only a signed-in person can approve: an API key can't, so an agent can never approve its own command. When a person or rule refuses an agent's command, the agent is told, and told not to work around it.
The run's Time limit keeps counting while a step waits. For a flow with an approval, give it enough time for a person to answer, like 900 seconds or more.
Policy
Open Policy in the builder (or choose the Rule block) to set rules for this flow. Your organization's rules always apply, and a flow can only add to them.
Network for this flow
What every sandbox in the run may reach:
| Choice | What it means |
|---|---|
| Organization default | Your organization's saved default. See Outbound network. |
| No internet | Nothing in or out. AI steps still reach Claude. |
| Only these sites | Up to 50 sites, one per line, like pypi.org or *.github.com. Everything else is blocked. |
| Open | Any site. |
Turn on Lock it and nothing in the run can widen the network, not even a command that tries.
For one step only, open its Advanced settings and turn on No internet for this step. The sandbox is cut off while that step runs, then the flow's rules come back, whatever happened in the step. This is good for steps that run code you don't trust, like an agent's fix or a downloaded script.
Also hold these commands for a person
Up to 20 extra rules for this flow. Each is a pattern matched against every command, with a description people see when it holds something:
| Pattern | Description |
|---|---|
git push|npm publish | Publishing needs a person |
DROP TABLE|DELETE FROM | Deleting data needs a person |
curl .*-X (POST|PUT|DELETE) | Changing another system needs a person |
Patterns are regular expressions and ignore case. A pattern that's too slow to check holds the command, so a mistake fails safe.
A pattern matches the text of each command, and of each file an agent writes. Treat these rules as an early warning, not a wall: a program can do something a pattern doesn't spell out. For a hard stop, use an Approval block before the step, and the network rules above.
Simulate points out what your policy will likely touch, step by step: a step that waits for a person, a command a rule will hold, or a step without network whose command looks like it needs one.
Checkpoints and rewind
After each step that passes, the sandbox saves a checkpoint: a copy of its files at that moment. They're kept for 24 hours after the run.
- Rewind when stopped. Choose a step and turn on Go back here if a limit stops the run under Advanced. If a limit stops the run, the sandbox goes back to that step's checkpoint, so a runaway loop doesn't leave half-applied changes behind. The Runaway loop recipe shows this.
- Open a sandbox from any step. In a finished run, open a step and start a new sandbox from its checkpoint, to look around or carry on by hand.
Turn off Save a checkpoint when it passes on quick steps that don't change anything, to make runs a little faster.
Keys that stay out
AI steps use your own Claude key, saved once under Rules → Secrets. The key never enters the sandbox. Code in the sandbox, including whatever an agent writes, only sees a stand-in that's useless anywhere else, and the real key is added on the way out, only to the sites the secret allows. The same goes for any other secret a flow uses. See Keys, identity and outbound check.
Everything is recorded
Every command a run executes, every approval and every blocked connection is written to your organization's audit log, with the run it came from. An agent's commands are recorded one by one, like a person's.
Run limits
| Limit | Free | Paid plans |
|---|---|---|
| Runs at the same time | 1 | 5 |
| Runs started an hour | 20 | 20 |
| Steps in a flow | 40 | 40 |
| Arrows in a flow | 80 | 80 |
| Parallel lanes | 10 | 10 |
| One command | 10 minutes | 10 minutes |
| A whole run | 1 hour | 1 hour |
Run sandboxes are billed like any other sandbox, at your plan's prices, and count toward your organization's spend cap.