Skip to content

SDKs

The SDKs wrap the API: create sandboxes, run commands (waiting or streaming), move files, sleep and wake, copy, checkpoint, and talk to the sandbox’s agent. Both read STILLBOX_API_KEY and STILLBOX_API_URL (your region’s API address, ending in /v1).

import { Stillbox } from "@stillbox/sdk";
const stillbox = new Stillbox();
const ws = await stillbox.sandboxes.create({ image: "stillbox/python:dev" });
console.log((await ws.exec(["python", "-V"])).stdout);
from stillbox import Stillbox
with Stillbox() as client:
ws = client.sandboxes.create(image="stillbox/python:dev")
print(ws.exec(["python", "-V"]).stdout)

mapForks (TypeScript) and map_forks (Python) copy a running sandbox once for each item, with everything it has open, run your function on each copy at the same time, and delete the copies afterwards, even when your function fails. It suits evaluations, trying several approaches, and anything that starts from the same prepared state:

def score(copy, prompt):
return copy.exec(["python", "eval.py", prompt]).stdout
results = client.map_forks(ws, prompts, score, concurrency=10)

Each copy is billed like any sandbox while it runs; up to ten run at once.

When your organization has agent races on, race gives one task to the agents of several copies of a sandbox; keep the best attempt and the other copies are deleted:

race = ws.race("Make the checkout page load in under a second", racers=3, check="npm test", wait=True)
best = next(r for r in race["racers"] if r.get("check_exit_code") == 0)
client.races.keep(race["id"], best["sandbox_id"])
const race = await ws.race({ task: "Make the checkout page load in under a second", racers: 3, check: "npm test" }, { wait: true });
const best = race.racers.find((r) => r.check_exit_code === 0);
if (best) await stillbox.races.keep(race.id, best.sandbox_id);