0, which means never auto-hibernate. The sandbox stays running until you explicitly kill or hibernate it.1234import { Sandbox } from "@opencomputer/sdk"; // No `timeout` — sandbox is persistent (stays alive until killed). const sandbox = await Sandbox.create();
timeout in seconds to have the sandbox auto-hibernate after N seconds of idle time. The timer resets on every operation — exec, file access, agent activity — so a busy sandbox never hits the timeout.12// Auto-hibernate after 5 minutes of inactivity. const sandbox = await Sandbox.create({ timeout: 300 });
12await sandbox.setTimeout(600); // 10 minutes await sandbox.setTimeout(0); // make it persistent
hibernated. Its ID, files, and configuration are preserved.wake() yourself — calling sandbox.exec.run(...), reading a file, or any other operation transparently restores the VM and then performs the requested action.123// Earlier: sandbox auto-hibernated after 5 minutes of idleness. // Now, hours later — this call just works. The SDK wakes it first. const result = await sandbox.exec.run("echo hello");
sandbox.wake() explicitly if you want to pre-warm a sandbox before routing user traffic to it.| Use case | Suggested timeout |
| Always-on agent / bot that must respond instantly | 0 (persistent) |
| Interactive dev sandbox, keep for the session | 600–3600 (10 min – 1 hr) |
| Short-lived batch or test run | 60–300 (1–5 min) |
| One-off exec — kill it yourself when done | 0 + explicit kill() |