Auto-stop and auto-pause
Stop idle sandboxes automatically, and (where enabled) wake them again on the next API call or preview request with their disk kept.
Auto-stop stops a sandbox after it has been idle for a while (autoStopAfterSeconds); its disk is kept and start boots it again. Auto-pause adds autoResume: true: the next API call (exec, files, ...) or authenticated preview request wakes it without an explicit start.
What wakes a sandbox#
| Traffic | Wakes it |
|---|---|
| API calls on the sandbox (exec, files, processes, ...) | yes |
| Authenticated requests to an exposed preview URL | yes |
| SSH | no (start it first: sandal start <id>) |
Create with auto-stop and auto-pause#
import { Sandal, SandalApiError } from "@sandal-dev/sdk";
const sandal = Sandal.fromEnv();
try {
const sb = await sandal.createSandbox({ autoStopAfterSeconds: 600, autoResume: true, ttlSeconds: 24 * 3600 });
console.log("auto-pause on", sb.id);
} catch (error) {
if (error instanceof SandalApiError && error.code === "capability_unavailable" && error.details.feature === "auto-resume") {
const sb = await sandal.createSandbox({ autoStopAfterSeconds: 600, ttlSeconds: 24 * 3600 }); // auto-stop only
console.log("auto-pause not enabled in this project; auto-stop only", sb.id);
} else throw error;
}Memory and processes#
pause/resumekeep memory and running processes on the same sandbox (pause about 0.7-1 s, resume about 1-2.5 s on production).- A stopped sandbox, including one stopped by auto-stop, boots from its disk: memory and running processes are gone. There are no memory snapshots. Treat in-memory state as a speed-up, not as durable storage: write what matters to disk or a volume.
- Forks and restores from a snapshot are disk-level (Snapshots & forks).