quiet robot

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.

View as Markdown

Sandboxes is in early access. It is free to try, some parts are still in testing, and details may change. Sign up free

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.

ProtectionStops
LimitsA run that loops too often, runs too long or spends too much.
ApprovalsA step running before a person says yes.
PolicyCommands you don't want, and connections to sites you haven't allowed.
Checkpoints and rewindA stopped run leaving a half-done mess.
Keys that stay outYour API keys leaking from the sandbox.

Limits

Every run has three limits. Open Limits in the builder to set them.

LimitWhat countsDefaultRange
LoopsEach trip back round a loop counts once.51 to 50
TimeSeconds from the first step, including time spent waiting for a person.30010 to 3,600
SpendWhat the run costs: sandbox time plus AI usage at list prices.$0.25$0.01 to $5
The Runaway loop recipe: Check always fails, so the loop limit stops the run and the sandbox rewinds to Start.Start (Run command), Try again (Run command), Check (Run command), Done (Output). Arrows: Start to Try again; Try again to Check; Check to Try again on Failed; Check to Done on Passed.FailedPassed>_ RUN COMMANDStartgo back here>_ RUN COMMANDTry again>_ RUN COMMANDCheckalways fails⚑ OUTPUTDonenever reached
The Runaway loop recipe: Check always fails, so the loop limit stops the run and the sandbox rewinds to Start.

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:

Two of them in one flow: an Approval block before shipping, and a step that asks a person first.Fix the bug (Agent), Ship this fix? (Approval), Deploy (Run command), Not shipped (Output). Arrows: Fix the bug to Ship this fix? on Done; Ship this fix? to Deploy on Approved; Ship this fix? to Not shipped on Denied.DoneApprovedDenied◉ AGENTFix the bug✋ APPROVALShip this fix?>_ RUN COMMANDDeployasks a person first⚑ OUTPUTNot shipped
Two of them in one flow: an Approval block before shipping, and a step that asks a person first.
  1. 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.
  2. 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.
  3. Rules that hold commands. Your organization's approval rules (like rm -rf, sudo or git 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:

ChoiceWhat it means
Organization defaultYour organization's saved default. See Outbound network.
No internetNothing in or out. AI steps still reach Claude.
Only these sitesUp to 50 sites, one per line, like pypi.org or *.github.com. Everything else is blocked.
OpenAny 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:

PatternDescription
git push|npm publishPublishing needs a person
DROP TABLE|DELETE FROMDeleting 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

LimitFreePaid plans
Runs at the same time15
Runs started an hour2020
Steps in a flow4040
Arrows in a flow8080
Parallel lanes1010
One command10 minutes10 minutes
A whole run1 hour1 hour

Run sandboxes are billed like any other sandbox, at your plan's prices, and count toward your organization's spend cap.