burst: true when creating the sandbox.123456789101112import { Sandbox } from "@opencomputer/sdk"; const sandbox = await Sandbox.create({ burst: true, memoryMB: 4096, timeout: 300, }); const result = await sandbox.exec.run("echo hello from burst"); console.log(result.stdout); await sandbox.kill();
OPENSANDBOX_RESUMABLE=trueOPENSANDBOX_RESUME_NOTICE_SECONDS=25| Capability | Burst alpha behavior |
| Process state | May restart |
| Filesystem | Preserved across burst restarts |
| Notice window | Up to 25 seconds when advance notice is available |
| Sudden host failure | May resume without advance notice |
| Capacity | Best effort; create may fail or wait when burst capacity is full |
/home/sandbox/.opencomputer/on-restart-notice to flush or checkpoint before restart.1234567891011121314151617181920212223242526272829303132333435363738394041424344454647import { Sandbox } from "@opencomputer/sdk"; const sandbox = await Sandbox.create({ burst: true, timeout: 0, }); await sandbox.exec.run("mkdir -p /home/sandbox/.opencomputer /home/sandbox/app"); await sandbox.files.write( "/home/sandbox/.opencomputer/on-restart-notice", `#!/bin/sh set -eu echo "restart notice: ${1:-25}s" >> /home/sandbox/app/events.log touch /home/sandbox/app/restarting sync `, ); await sandbox.exec.run("chmod +x /home/sandbox/.opencomputer/on-restart-notice"); await sandbox.files.write( "/home/sandbox/app/worker.sh", `#!/bin/sh set -eu cd /home/sandbox/app if [ -f restarting ]; then echo "resumed after restart" >> events.log rm -f restarting else echo "started" >> events.log fi i=$(cat counter 2>/dev/null || echo 0) while true; do i=$((i + 1)) echo "$i" > counter sync sleep 5 done `, ); await sandbox.exec.run("chmod +x /home/sandbox/app/worker.sh"); await sandbox.exec.background("/home/sandbox/app/worker.sh", { maxRunAfterDisconnect: 0, });
/home/sandbox/app.