Full vs. filesystem-only
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.Picking up envd updates
envd is E2B’s in-sandbox daemon. The envd version a sandbox runs is pinned by its
template, so by default a long-lived paused sandbox stays on that version for its whole
lifetime and does not pick up later envd fixes and improvements.
A filesystem-only resume cold-boots the sandbox from disk, and that reboot can bring the
sandbox up on a newer envd than its template shipped. The filesystem is untouched. This
is how a long-lived sandbox can adopt envd improvements - for example around memory
management, stability, and speed - without losing the data on disk.
To move an existing sandbox onto a newer envd:
- Resume the sandbox.
- Pause it filesystem-only with
keepMemory: false(JavaScript) /keep_memory=False(Python). - Resume it again. This cold boot can bring it up on a newer
envd.
A sandbox has to be resumable to use this flow. A sandbox whose snapshot already fails to
resume cannot be paused filesystem-only in the first place, so it cannot be upgraded this way.
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.