Skip to main content
You want an agent to explore: get a project to an interesting point once (dependencies installed, data loaded, a server running), then try three fixes or three prompts from exactly that point, and keep the one that works. Why fork fits. Fork copies a running sandbox’s memory, files and running processes into new sandboxes. Each copy starts where the original was, so you pay for the setup once, not once per attempt. The original is frozen for about 0.1 s and then carries on.
1

Do the expensive part once

Create one sandbox and bring it to the state every attempt should start from. Anything you do here is in every copy, including processes still running.
2

Fork and try one thing in each copy

best_of_n.py
Entries of the result are in request order. A copy that could not be made is an exception in its place, not a failed call: 429 when your plan’s limit of sandboxes at once is reached, 503 when the platform is at capacity.
3

Keep the winner, delete the rest

Each fork is an ordinary sandbox, billed while it runs. Delete the losers as soon as they are scored, and keep working in the winner, or in the original, which still has its own ID and deadline.
Every fork request keeps a checkpoint of the source sandbox that cannot be deleted yet, capped at 32 per team. Fork at the few points worth branching from, with count set to the number of copies you need, not once per step. A fork of ten costs one checkpoint; ten forks of one cost ten.
From the CLI, the same branching prints one sandbox ID per line:
fork_cli.sh
Next: Fork for scopes and errors. Named snapshots you can keep and start from later are coming soon. Runnable example: examples/python/fork_best_of_n.py in the public SDK repository. It prints what happens at each step.