Skip to content

Filesystem-only pause

Pass keepMemory: false in JavaScript or keep_memory=False in Python when only the filesystem must survive a pause. Resume cold-boots the sandbox from disk: files remain, but processes and in-memory state do not.

Write durable data to the sandbox filesystem, for example under /home/user. /tmp is recreated on a cold boot and is not preserved by this mode.

mjs
import { Sandbox } from "@abox-dev/sdk";

const sandbox = await Sandbox.create();

try {
  await sandbox.files.write(
    "/home/user/persistent.txt",
    "file survived reboot",
  );
  const process = await sandbox.commands.run("sleep 600", { background: true });

  await sandbox.pause({ keepMemory: false });
  await sandbox.connect();

  console.log(await sandbox.files.read("/home/user/persistent.txt"));
  const status = await sandbox.commands.run(
    `if kill -0 ${process.pid} 2>/dev/null; then printf running; else printf stopped; fi`,
  );
  console.log(`Previous process: ${status.stdout}`);
} finally {
  await sandbox.kill();
}

This setting applies to one pause operation. A later plain pause() creates a full snapshot again.

Filesystem-only pause is useful for workspaces and build state that live on disk. Restart required services after connect. Do not combine this mode with auto-resume; an inbound request cannot restore a process that was discarded.