KestrelDocs

Sandbox

Pause a sandbox to keep its disk and memory, resume it later exactly where it was, or take a snapshot to start new sandboxes from the same state.

Fig. 1Backups
Backups float field(vec2 p, float t) { if (p.x < 18.0 || p.x > 702.0) return 0.0; float ph = TAU * t / T; float v = 0.0; // the live data: four masses that churn for (int i = 0; i < 4; i++) { float fi = float(i); vec2 c = vec2(220.0 + 92.0 * fi + 10.0 * sin(ph + fi), 140.0 + 12.0 * cos(ph * 2.0 + fi)); v += blob(p, c, 26.0, 0.7); } // the scan copies them down into the vault, left to right float scan = 150.0 + 420.0 * sm(0.6, 2.4, t); // the vault always holds a copy; it brightens where the scan lays the new one down float fresh = exp(-pow(p.x - scan, 2.0) / 3000.0) * sm(0.6, 0.8, t) * (1.0 - sm(2.3, 2.6, t)); for (int i = 0; i < 4; i++) { float fi = float(i); v += blob(p, vec2(220.0 + 92.0 * fi, 330.0), 24.0, 0.55 + 0.3 * fresh); } v += exp(-pow(p.x - scan, 2.0) / 20.0) * step(abs(p.y - 235.0), 120.0) * 0.4 * sm(0.6, 0.8, t) * (1.0 - sm(2.3, 2.6, t)); return v; }
A snapshot copies the sandbox's disk and memory into storage as one piece. Any number of new sandboxes can start from it, each one an exact copy.

Pause and resume

Pausing saves the whole sandbox, files and running processes together, and stops the VM. Resuming brings it back as it was, with the same id, in about two seconds.

await sandbox.pause();
// later, from any process
const again = await kestrel.sandboxes.resume("sbx_41c9");

A paused sandbox costs storage only, and its timeout starts again from zero when it resumes.

Snapshots

A snapshot is a saved copy you can start from as many times as you like. Use one when every run needs the same slow setup, like a seeded database or a warm build cache.

// set up once
const snap = await sandbox.snapshot({ name: "web-app-seeded" });

// start every run from it
await kestrel.runs.create({ repo: "acme/web-app", task: "Add an index to orders", from: snap.name });
PauseSnapshot
Keeps running processesYesNo, files only
Same sandbox id afterwardsYesNo, a new sandbox each time
Start more than one copyNoYes
Kept forUntil you kill it30 days after its last use
Tip

A snapshot is taken from the repo at its current commit. When main moves on, Kestrel pulls the new commits into each sandbox it starts from the snapshot, so you don't have to retake it after every merge.

Was this page helpful?

Open the dashboard