quiet robot

Sandboxes

Blocks

Every block in the Agent Playground, what it does, its exits and settings, and when to use it.

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

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.

Every block, with the color and label it has on the canvas.Run command (Run command), Run code (Run code), Ask AI (Ask AI), Agent (Agent), Agents together (Agents together), Decide (Decide), AI choice (AI choice), Approval (Approval), Wait (Wait), Try in parallel (Try in parallel), Keep the best (Keep the best), Output (Output). Arrows: .>_ RUN COMMANDRun command{ } RUN CODERun code✦ ASK AIAsk AI◉ AGENTAgent◉◉ AGENTS TOGETHERAgents together◆ DECIDEDecide◆ AI CHOICEAI choice✋ APPROVALApproval◷ WAITWait⑂ TRY IN PARALLELTry in parallel★ KEEP THE BESTKeep the best⚑ OUTPUTOutput
Every block, with the color and label it has on the canvas.

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.
Exits in action: on Failed the run goes to the fix, which loops back; on Passed it finishes.Run tests (Run command), Fix the code (Agent), Done (Output). Arrows: Run tests to Fix the code on Failed; Fix the code to Run tests on Done; Run tests to Done on Passed.FailedDonePassed>_ RUN COMMANDRun testspytest -q◉ AGENTFix the code⚑ OUTPUTDone
Exits in action: on Failed the run goes to the fix, which loops back; on Passed it finishes.

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.

SettingWhat it does
CommandWhat to run. Exit code 0 counts as Passed.
FolderWhere 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.

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

A Decide block after a scan: findings go to a person, a clean scan finishes.Scan for secrets (Run command), Anything found? (Decide), Review the findings (Approval), Clean (Output). Arrows: Scan for secrets to Anything found?; Anything found? to Review the findings on Yes; Anything found? to Clean on No.YesNo>_ RUN COMMANDScan for secrets◆ DECIDEAnything found?test -s findings.txt✋ APPROVALReview the findings⚑ OUTPUTClean
A Decide block after a scan: findings go to a person, a clean scan finishes.

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.

An AI choice with three choices, each with its own arrow.Read the email (Run command), What kind of email? (AI choice), Add to orders (Run command), Draft an answer (Ask AI), Ignored (Output). Arrows: Read the email to What kind of email?; What kind of email? to Add to orders on order; What kind of email? to Draft an answer on question; What kind of email? to Ignored on spam.orderquestionspam>_ RUN COMMANDRead the email◆ AI CHOICEWhat kind of email?order · question · spam>_ RUN COMMANDAdd to orders✦ ASK AIDraft an answer⚑ OUTPUTIgnored
An AI choice with three choices, each with its own arrow.

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.

An Approval before anything real: Denied has its own ending.Build the release (Run command), Publish version 2.1? (Approval), Publish (Run command), Not published (Output). Arrows: Build the release to Publish version 2.1?; Publish version 2.1? to Publish on Approved; Publish version 2.1? to Not published on Denied.ApprovedDenied>_ RUN COMMANDBuild the release✋ APPROVALPublish version 2.1?>_ RUN COMMANDPublish⚑ OUTPUTNot published
An Approval before anything real: Denied has its own ending.

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.

Two lanes, then Keep the best picks the faster one.Set up (Run command), Try in parallel (Try in parallel), Fast build (Run command), Safe build (Run command), Keep the best (Keep the best), Ship the winner (Run command). Arrows: Set up to Try in parallel; Try in parallel to Fast build; Try in parallel to Safe build; Fast build to Keep the best; Safe build to Keep the best; Keep the best to Ship the winner on Passed.Passed>_ RUN COMMANDSet up⑂ TRY IN PARALLELTry in parallellanes Fast, Safe>_ RUN COMMANDFast buildLane Fast>_ RUN COMMANDSafe buildLane Safe★ KEEP THE BESTKeep the bestlowest seconds>_ RUN COMMANDShip the winner
Two lanes, then Keep the best picks the faster one.

Keep the best

Compares the lanes and keeps the best one as the main sandbox. The others are deleted.

SettingWhat it does
Number to compareThe name of a number each lane prints as a JSON line, like {"ms": 182} or {"score": 0.83}.
Best isLowest (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:

SettingWhat it does
Time limitHow long one command may run, from 30 seconds to 10 minutes. For an agent, each command it runs.
Save a checkpoint when it passesOn 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 stepCuts the sandbox off from the internet while this step runs, whatever the flow allows. An AI step still reaches Claude.
Ask a person firstThe 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 runIf 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.