Agent races
An agent’s first attempt isn’t always its best. A race gives the same task to several copies of your agent at once. Each works in its own copy of the sandbox, starting from exactly the same files, memory and running programs. You compare what they did and keep the best one; the other copies are deleted.
Races are an organization switch: an owner turns them on under Organization → Features and chooses how many agents a race may have. Every agent uses its own tokens, so a race of three costs about three times one attempt.
Starting a race
Section titled “Starting a race”On a sandbox with an agent, choose Race agents and give:
- the task, as you would ask the agent in chat;
- how many agents race (2 or more, up to your organization’s limit);
- a check (optional): a command run in each copy after its agent finishes, such as
npm test. Exit code 0 passes; - a time limit: agents still working then are stopped.
The race page shows each agent as it works, then its time, tokens, cost, the files it changed and whether its check passed. Open an agent’s reply, or its copy, to look closer.
Keeping the best
Section titled “Keeping the best”Choose Keep this one on the agent you prefer. Its copy stays as a normal sandbox (named after the original, “racer 2” for example); the other copies and their changes are deleted. You can rename it, or merge its changes into your repository from its terminal. To keep nothing, delete all the copies instead.
Through the API
Section titled “Through the API”curl -X POST "$STILLBOX_API_URL/sandboxes/$ID/races" \ -H "Authorization: Bearer $STILLBOX_API_KEY" -H "Content-Type: application/json" \ -d '{"task": "Make the checkout page load in under a second", "racers": 3, "check": "npm test"}'Then GET /races/{race_id} until its state is finished, and POST /races/{race_id}/keep with the
sandbox_id of the copy to keep. Each racer’s reply is at
/sandboxes/{sandbox_id}/agent/v1/responses/{response_id}.
Changed files are summarised with git in the repository’s folder (for a sandbox opened from a repository link) or
in the agent’s home folder; pass dir to choose another.