quiet robot

Sandboxes

Graph shapes

The shapes a flow can take, with a small example of each: a straight line, branches, loops, loops inside loops, parallel lanes, agents working together, and how paths join again.

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 doesn't have to be a straight line. Arrows can split it, bring it back together, and send it round again. This page shows each shape with a small example you can draw in a few minutes. The diagrams are drawn like the builder's canvas: they read top to bottom, the word on an arrow is the exit it leaves from, and a dashed arrow going back up is a loop.

A straight line

The simplest flow: each step runs after the one before.

A straight line: each step runs after the one before.Get the code (Run command), Build (Run command), Run tests (Run command), Done (Output). Arrows: Get the code to Build on Passed; Build to Run tests on Passed; Run tests to Done on Passed.PassedPassedPassed>_ RUN COMMANDGet the code>_ RUN COMMANDBuild>_ RUN COMMANDRun tests⚑ OUTPUTDone
A straight line: each step runs after the one before.

If any step fails, the run ends there as failed, because its Failed exit has no arrow. That's often what you want.

Branches

A branch sends the run one of two (or more) ways. There are three kinds.

On pass or fail. Draw an arrow from each exit of the same step.

A branch on pass or fail.Run tests (Run command), Package (Run command), Write a bug report (Run command). Arrows: Run tests to Package on Passed; Run tests to Write a bug report on Failed.PassedFailed>_ RUN COMMANDRun tests>_ RUN COMMANDPackage>_ RUN COMMANDWrite a bug report
A branch on pass or fail.

On a condition. A Decide block asks a yes or no question with a command, and the run goes on either way.

A branch on a condition: the Decide block answers yes or no with a command.Lint (Run command), Anything to say? (Decide), Post the review? (Approval), Looks good (Output). Arrows: Lint to Anything to say?; Anything to say? to Post the review? on Yes; Anything to say? to Looks good on No.YesNo>_ RUN COMMANDLint◆ DECIDEAnything to say?test -s findings.txt✋ APPROVALPost the review?⚑ OUTPUTLooks good
A branch on a condition: the Decide block answers yes or no with a command.

On an AI choice. An Ask AI block set to Decision gets one exit per choice.

A branch on an AI choice: one exit per choice.Read the ticket (Run command), Sort the ticket (AI choice), Refund this customer? (Approval), Draft a bug report (Run command), Draft a reply (Ask AI), Ignored (Output). Arrows: Read the ticket to Sort the ticket; Sort the ticket to Refund this customer? on refund; Sort the ticket to Draft a bug report on bug; Sort the ticket to Draft a reply on how-to; Sort the ticket to Ignored on spam.refundbughow-tospam>_ RUN COMMANDRead the ticket◆ AI CHOICESort the ticketrefund · bug · how-to · spam✋ APPROVALRefund this customer?>_ RUN COMMANDDraft a bug report✦ ASK AIDraft a reply⚑ OUTPUTIgnored
A branch on an AI choice: one exit per choice.

Tip

Name your Output blocks for the ending they mean ("Shipped", "Not posted", "Ignored"). A run's ending then tells you what happened without opening it.

Loops

A loop is an arrow back to an earlier step. The classic is "try, check, fix, check again":

A loop: the dashed arrow goes back up, and each trip round counts as one loop.Write code (Run command), Run tests (Run command), Fix failures (Run command), Save result (Run command). Arrows: Write code to Run tests; Run tests to Fix failures on Failed; Fix failures to Run tests on Next; Run tests to Save result on Passed.FailedNextPassed>_ RUN COMMANDWrite code>_ RUN COMMANDRun tests>_ RUN COMMANDFix failures>_ RUN COMMANDSave result
A loop: the dashed arrow goes back up, and each trip round counts as one loop.

The loop ends when a step takes another exit (the tests pass) or a limit stops it. Every trip back counts as one loop, so with Loops set to 5 the run tries at most five fixes.

A retry with a pause puts a Wait in the loop, so a busy website gets a moment:

A retry with a pause.Fetch page (Run code), Wait 3 s (Wait), Parse table (Run code), Save (Run command). Arrows: Fetch page to Wait 3 s on Failed; Wait 3 s to Fetch page on Next; Fetch page to Parse table on Passed; Parse table to Save.FailedNextPassed{ } RUN CODEFetch page◷ WAITWait 3 s{ } RUN CODEParse table>_ RUN COMMANDSave
A retry with a pause.

A loop with a way out. A step in the loop can have its own exit that leaves it. In the bug reproduction recipe, the step that writes the next test fails when it has run out of ideas, and that exit goes to "Ask for more detail" instead of round again.

Loops inside loops

A loop can sit inside another loop. In this flow the inner loop retries a flaky download, and the outer loop rewrites the analysis until it runs:

Loops inside loops: an inner retry and an outer fix, both counted by the same loop limit.Write analysis (Run command), Download data (Run command), Wait 5 s (Wait), Run analysis (Run command), Read the error, fix it (Agent), Summary (Output). Arrows: Write analysis to Download data; Download data to Wait 5 s on Failed; Wait 5 s to Download data on Next; Download data to Run analysis on Passed; Run analysis to Read the error, fix it on Failed; Read the error, fix it to Write analysis on Done; Run analysis to Summary on Passed.FailedNextPassedFailedDonePassed>_ RUN COMMANDWrite analysis>_ RUN COMMANDDownload data◷ WAITWait 5 s>_ RUN COMMANDRun analysis◉ AGENTRead the error, fix it⚑ OUTPUTSummary
Loops inside loops: an inner retry and an outer fix, both counted by the same loop limit.

Both loops count toward the same Loops limit, so set it for the total number of trips you'll allow.

Parallel lanes

Try in parallel copies the sandbox into 2 to 10 lanes. Each lane has its own copy of the files, so the lanes can't break each other's work. On each step after it, set Run in to its lane.

Parallel lanes: each lane gets its own copy of the sandbox, and Keep the best keeps one.Set up (Run command), Try in parallel (Try in parallel), Insertion sort (Run command), Built-in sort (Run command), Dedupe and sort (Run command), Keep the best (Keep the best), Keep the winner (Run command). Arrows: Set up to Try in parallel; Try in parallel to Insertion sort; Try in parallel to Built-in sort; Try in parallel to Dedupe and sort; Insertion sort to Keep the best; Built-in sort to Keep the best; Dedupe and sort to Keep the best; Keep the best to Keep the winner on Passed.Passed>_ RUN COMMANDSet up⑂ TRY IN PARALLELTry in parallellanes A, B, C>_ RUN COMMANDInsertion sortLane A>_ RUN COMMANDBuilt-in sortLane B>_ RUN COMMANDDedupe and sortLane C★ KEEP THE BESTKeep the bestlowest ms>_ RUN COMMANDKeep the winner
Parallel lanes: each lane gets its own copy of the sandbox, and Keep the best keeps one.

A lane can be more than one step: draw a chain of steps that all run in lane A. A lane that fails just drops out of the contest.

Use lanes when you'd otherwise try ideas one after another: three prompts, three upgrade plans, three ways to research a question. They finish in the time of the slowest one, not the sum.

Agents working together

Agents together is the other way to do things at once. Its members share one sandbox and its files, instead of each getting a copy.

Agents together: both agents work at once in the same sandbox, sharing its files. Arrows go to and from the group.Set up (Run command), Docs and tests (Agents together), Run tests (Run command), Done (Output). Arrows: Set up to Docs and tests; Docs and tests to Run tests on Done; Run tests to Done on Passed.DonePassed>_ RUN COMMANDSet up◉◉ AGENTS TOGETHERDocs and testsWrite the docs + Write the tests>_ RUN COMMANDRun tests⚑ OUTPUTDone
Agents together: both agents work at once in the same sandbox, sharing its files. Arrows go to and from the group.
NotesTry in parallelAgents together
FilesEach lane has its own copyShared by all members
How many2 to 10 lanes2 to 6 members
Ends withKeep the best picks one laneAll are done, or the first is done
Good forCompeting ideasSplitting one job into parts

Joins

When paths come back together, the step they meet at runs once, after the paths before it are finished.

  • Lanes join at Keep the best. Draw every lane's last step to the same Keep the best block. It waits for the lanes, keeps the passing lane with the best number as the main sandbox, and deletes the rest.
  • Agents join when the group finishes. With all are done, when every member passes. With the first is done, as soon as one passes; the others are stopped.
  • Branches join at a shared step. Two branches can lead to the same next step, like the "Restart" and "Leave it running" paths that both go on to "Write the summary" in the alert recipe. Use Either way on an arrow when the next step should run whatever happened.

What isn't possible yet

  • A flow inside a flow. You can't use one saved flow as a single block in another. For now, build the shared steps into each flow. Duplicate on the Agent Playground page copies a whole flow to start from.
  • Lanes inside a loop. A Try in parallel block can't run again on a later trip round a loop. Put the loop before the lanes or after Keep the best, or run the whole flow again.
  • Combining lanes. Lanes can't be merged into each other: Keep the best keeps one. If you need parts of several lanes, have each lane print the number that matters, keep the best lane, and run a step after it that redoes the part you need.

Size limits

A flow can have up to 40 steps and 80 arrows. Each step can write up to 20 files (256 KB in total) before it runs, and a single command can run for up to 10 minutes. See Limits and safety for the limits on a whole run.