Full vs. filesystem-only
| Full snapshot (default) | Filesystem-only snapshot | |
|---|---|---|
| Filesystem (disk) | Preserved | Preserved |
| Memory (RAM) | Preserved | Dropped |
| Running processes | Restored | Lost (reboot) |
| In-memory state (variables, caches) | Restored | Lost (reboot) |
| Resume behavior | Restored in place | reboot from disk |
Network connections to clients outside the sandbox drop when it pauses — in both cases — and must be re-established on resume (see Persistence). The in-sandbox
difference: a full snapshot keeps the process running so it can serve again immediately, while a filesystem-only snapshot reboots, so the service must be restarted first.
Pause filesystem-only
PasskeepMemory: false (JavaScript) / keep_memory=False (Python) to pause(). The filesystem is saved; memory is dropped.
keepMemory / keep_memory defaults to true, so omitting it (or calling pause()) takes a full memory snapshot — see Persistence.
keepMemory is a per-pause choice, not a sandbox-wide mode. Pausing once with keepMemory: false / keep_memory=False does not lock the sandbox into filesystem-only: after you resume, the next pause() takes a full memory snapshot again unless you pass keepMemory: false / keep_memory=False once more.
Auto-pause filesystem-only
You can also make the timeout-driven auto-pause filesystem-only. SetonTimeout / on_timeout to the object form and include keepMemory / keep_memory:
lifecycle reference.
Type safety and validation
keepMemory / keep_memory only governs a pause action, so the SDK rejects nonsensical combinations:
- It cannot be set when the action is
kill. In TypeScript this is a compile-time type error (theonTimeoutobject is a discriminated union onaction); in Python it raisesInvalidArgumentException. - It cannot be combined with auto-resume. A filesystem-only snapshot can’t be woken by inbound traffic (auto-resume restores the running process from memory, which a filesystem-only snapshot doesn’t have), so it must be resumed explicitly with
connect(). SettingkeepMemory: false/keep_memory=Falsetogether withautoResume: true/auto_resume=Trueis rejected client-side.
What changes on resume
Resuming a filesystem-only snapshot is a reboot, so it takes roughly a fresh boot rather than the near-instant in-place memory restore. Any service running inside the sandbox must be restarted after resume, and clients must reconnect. Because resume is a reboot, anything that lived only in memory is gone, while everything written to disk persists. The example below writes a file and starts a background process, pauses filesystem-only, then resumes: the file is still there, but the process is not.Related
- Sandbox persistence — full (memory + filesystem) pause and resume.
- Auto-resume on request — the full
lifecycleconfiguration reference. - Connect to a sandbox — resume a paused sandbox explicitly.