quiet robotBook a call

Sandboxes

Pause and resume

Freeze a sandbox with its memory, files and running processes, stop the meter, and pick it up later.

View as Markdown

Sandboxes is in early access. It is free to try, some parts are still in testing, and details may change. Sign up free

Not live yet

Pause and resume is built and works in our tests. It hasn't been tried on the hosted service yet.

Pausing freezes a running sandbox. Its memory, files and running processes are kept, and paused time isn't billed. Resuming picks up where it left off, with the session time it had left.

Terminal
curl -s -X POST "$QR_BASE_URL/api/v1/sandboxes/$SBX/pause"  -H "Authorization: Bearer $QR_API_KEY"
curl -s -X POST "$QR_BASE_URL/api/v1/sandboxes/$SBX/resume" -H "Authorization: Bearer $QR_API_KEY"
TypeScript
await sbx.pause();   // status: "paused", pausedAt set
// … hours later, from any process with the id …
const again = await qr.get(sbx.id);
await again.resume(); // status: "running"

Both calls return the sandbox.

Wake on call

You don't have to resume a sandbox by hand. A command or file call to a paused sandbox wakes it first and then runs. If several calls arrive at once, they share one wake. If waking takes longer than 30 seconds, the call returns 503 waking with Retry-After. Try again.

Pause when idle

Start a sandbox with autoPauseSec and it pauses itself after that many seconds with no commands, file calls or gateway calls. The next call wakes it. You pay for the time it works, not the time it waits.

TypeScript
const sbx = await qr.create({ autoPauseSec: 300 }); // pause after 5 idle minutes
  • Use any value from 60 to 86,400 seconds.
  • A command that's still running keeps the sandbox awake.
  • If your paused sandboxes are at their disk limit, the sandbox stays running and is tried again later.
  • The audit log records each pause with reason: "idle", and each wake with "woken by a call" and how long each step took.

The rules

  • Only a running sandbox can be paused, and not while one of its commands is still running. Wait for the command to finish, or you'll get 409 busy.
  • The deadline stops while paused. A sandbox with 20 minutes left when you paused it has 20 minutes left when you resume it.
  • A paused sandbox is kept for a while, then destroyed: up to 1 day on Free and 30 days on Team and Enterprise. Take a snapshot if you need the files for longer.
  • Paused sandboxes share a disk limit: together they can hold 10 GB on Free, 50 GB on Team and 500 GB on Enterprise. A pause that would go past it returns 409 paused_storage_full and the sandbox keeps running. Resume or delete a paused sandbox to make room.
  • Resuming counts toward your running-sandbox limit. If you're at the limit, resume returns 429 limit_reached.
  • Network rules are kept. A resumed sandbox has the same egress mode and allowlist.

If memory can't be restored

Usually the sandbox comes back exactly as it was. If its memory can't be restored, it starts again from a fresh boot with its files kept: anything in memory, such as a running server, has to be started again. Check that your long-running processes are still there after a resume, and restart them if not.

If a resume fails completely, the sandbox moves to error and the call returns 502 resume_failed. Contact support with the sandbox id.

Pausing works best for sandboxes with 2 GB of memory or less.