Sandboxes
Blocks
Every block in the Agent Playground, what it does, its exits and settings, and when to use it.
A flow is made of blocks joined by arrows. Open Blocks in the builder to see them all, each with a one-line explanation. Every block has its own color, icon and shape, so you can read a flow at a glance, and never by color alone.
| Group | Blocks |
|---|---|
| Do | Run command, Run code, Ask AI, Agent, Agents together |
| Decide | Decide, AI choice, Loop |
| People and rules | Approval, Rule, Wait |
| Sandbox | Sandbox, Try in parallel, Keep the best |
| Finish | Output |
How blocks connect
Most blocks have two exits at the bottom, such as Passed and Failed. Drag from an exit to another block to draw an arrow. Each exit can have one arrow.
- Follow the right exit. A command passes when it exits with code 0, and fails otherwise. The flow follows the arrow from the exit that happened.
- Either way. Select an arrow and set Follow it when the step to Either way to go on whatever happened, for a step whose result doesn't matter.
- No arrow means stop. An exit with no arrow ends the run there. A failed step with nowhere to go ends the run as failed.
- An arrow back up is a loop. It's allowed, and every trip round counts toward the run's loop limit.
Select any block to open its settings. Every block has a Name. Steps that run something also have Run in, which picks the main sandbox or one of the parallel lanes, and an Advanced section.
Do
Run command
A shell command in the sandbox, such as pytest -q, npm test or python3 report.py.
| Setting | What it does |
|---|---|
| Command | What to run. Exit code 0 counts as Passed. |
| Folder | Where to run it, relative to the home folder. Empty means the home folder. |
Exits: Passed, Failed. Use it for anything you'd type in a terminal: installing, building, testing, copying files.
Run code
A short script you write right in the panel, in Python, Node or Bash. It passes when it exits with 0. Use it when a one-line command isn't enough, for example to read a file, count something and decide whether it's good enough.
import json
rows = json.load(open("report/rows.json"))
print(f"{len(rows)} rows")
raise SystemExit(0 if len(rows) > 0 else 1)Exits: Passed, Failed.
Ask AI
One question to Claude, with one answer back. The answer can be plain Text, JSON with the keys you name, or a Decision (see AI choice). Use it to summarize a log, draft a reply, or pull fields out of a document. It uses your own Claude key. Details are on AI steps and agents.
Exits: Passed, Failed.
Agent
Claude working toward a goal inside the sandbox. It can run commands and read and write files, over several turns, until it's done or reaches a limit you set. Use it when the work needs trying things: fixing a failing test, cleaning a spreadsheet, getting a script to run. Details are on AI steps and agents.
Exits: Done, Stopped.
Agents together
Two to six steps (agents, commands or scripts) working at the same time in the same sandbox, sharing its files. For example, one agent writes the docs while another writes the tests. Set Finish when to all are done, or the first is done to stop the others as soon as one succeeds. Details are on AI steps and agents.
Exits: Done, Failed.
Decide
Decide
A yes or no question answered by a command. Exit code 0 means Yes, anything else No, and the run goes on either way. For example:
test -s findings.txt: did the last step find anything?grep -q ERROR app.log: is there an error in the log?python3 -c "import json,sys; sys.exit(0 if json.load(open('score.json'))['score'] > 0.8 else 1)": is the score good enough?
Exits: Yes, No.
AI choice
An Ask AI block set to reply with a Decision. You give it 2 to 6 choices, such as refund, bug, how-to and spam, and each choice gets its own exit. Claude must answer with exactly one of them, and the run follows that exit. An answer that isn't one of your choices goes to Failed.
Exits: one per choice, and Failed.
Careful
An AI choice decides where the run goes, and the text it reads can come from outside (a customer's email, a web page). Put an Approval after any choice that leads to something that matters, like a refund.
Loop
A loop isn't a box: it's an arrow that goes back to an earlier block. Choosing Loop in the Blocks panel shows you how. The builder marks a backward arrow and tells you it counts as a loop. A loop repeats until a step takes a different exit (the tests finally pass) or a limit stops it.
People and rules
Approval
Pauses the run until a person approves or denies. Write the question in What should a person approve?, such as "Ship this fix? The tests pass." Your team gets the usual approval email and can decide in Approvals.
Exits: Approved, Denied. An API key can never approve, so an agent can't approve its own work. The run's time limit keeps counting while it waits.
Rule
Rules decide what a step may do. Choosing Rule opens the flow's Policy: what the sandbox may reach on the internet, and extra commands that always wait for a person. Your organization's rules always apply on top. Each step can also be stricter in Advanced: No internet for this step and Ask a person first. See Limits and safety.
Wait
Pauses for 1 to 600 seconds. Use it between retries, so a busy website gets a moment before you try again. Exit: Next.
Sandbox
Sandbox
The sandbox isn't a block you place: it's the computer every step runs on. Each run starts a fresh sandbox from the flow's template, and the steps share its files, so one step can write a file and the next can read it. When a run ends, its sandboxes are deleted after a few minutes, and the checkpoints are kept for 24 hours.
Try in parallel
Copies the sandbox into 2 to 10 lanes that run side by side, each with its own copy of the files. Name the lanes (A, B, C, or names like Fast and Safe), then set Run in on each following step to pick its lane. Use it to try several ideas at once instead of one after another.
Exit: Next, then one path per lane.
Keep the best
Compares the lanes and keeps the best one as the main sandbox. The others are deleted.
| Setting | What it does |
|---|---|
| Number to compare | The name of a number each lane prints as a JSON line, like {"ms": 182} or {"score": 0.83}. |
| Best is | Lowest (for time or cost) or Highest (for a score). |
Only lanes that passed can win. If no lane passed, it takes Failed. Exits: Passed, Failed.
Finish
Output
Where the flow finishes. Name it for the result, like "Shipped" or "Not posted", so a run's ending reads clearly. You don't need one: an exit with no arrow finishes the run too.
Advanced settings
Steps that run something share these, under Advanced in their settings:
| Setting | What it does |
|---|---|
| Time limit | How long one command may run, from 30 seconds to 10 minutes. For an agent, each command it runs. |
| Save a checkpoint when it passes | On for commands, code and AI steps. A limit can rewind to a checkpoint, and you can open a new sandbox from one. Turn it off for quick steps to save time. |
| No internet for this step | Cuts the sandbox off from the internet while this step runs, whatever the flow allows. An AI step still reaches Claude. |
| Ask a person first | The step waits for an approval before it runs. On an agent, every command it runs and every file it writes waits. |
| Go back here if a limit stops the run | If a limit stops the run, the sandbox goes back to this step's checkpoint. |
| Usually takes and Passes, % | Hints for Simulate, until the flow has run a few times and the forecast learns from its real runs. |