Sandbox lifecycle
A sandbox starts in the running state. It keeps running until you kill it, its timeout expires, or its lifecycle policy pauses it.
JavaScript uses milliseconds for sandbox timeouts, Python uses seconds, and Go uses time.Duration.
mjs
import { Sandbox } from "@abox-dev/sdk";
const sandbox = await Sandbox.create({ timeoutMs: 60_000 });
try {
await sandbox.setTimeout(120_000);
const info = await sandbox.getInfo();
console.log(`Sandbox ${info.sandboxId} is ${info.state}`);
} finally {
await sandbox.kill();
}setTimeout, set_timeout, and SetTimeout start a new timeout from the moment of the call. Use them when the remaining lifetime must become exactly the requested value.
kill permanently removes a running or paused sandbox. A killed sandbox cannot be connected or resumed.
See Persistence to pause a sandbox instead, or open the SDK reference for all options.