Auto-resume
Auto-resume lets a paused sandbox wake up on the next supported request. Enable it together with onTimeout: "pause" in JavaScript or on_timeout: "pause" in Python.
mjs
import { Sandbox } from "@abox-dev/sdk";
const sandbox = await Sandbox.create({
lifecycle: {
onTimeout: "pause",
autoResume: true,
},
});
try {
await sandbox.files.write("/tmp/message.txt", "resumed on file read");
await sandbox.pause();
console.log(await sandbox.files.read("/tmp/message.txt"));
} finally {
await sandbox.kill();
}The example pauses the sandbox explicitly. Reading a file through the same SDK handle resumes it without a separate connect call. Command and filesystem operations use the same lifecycle mechanism.
Auto-resume requires a full memory snapshot. It cannot be combined with a filesystem-only pause, because that mode must cold-boot explicitly through connect.
Call kill when the sandbox must be removed permanently.