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
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.
fork_cli.sh
examples/python/fork_best_of_n.py in the public SDK repository. It prints what happens at each step.