Pause and resume work with Chalk sandbox checkpoints
This demo shows a sandbox preserving a running counter through suspension and resumption. Compare the counter before and after: checkpointing preserves its state while Chalk releases the sandbox’s CPU and memory.
Check that the counter resumes where it stopped
Use the supplied counter to check that a sandbox resumes its saved process state. Follow the three steps below; you can also close the tab while suspended and return to the resume option later.
Try this experiment · expected results
1Start the supplied counter
Launch a sandbox and start the counter in its terminal.
python3 count.pyExpected: An increasing count. Note the latest number.
2Pause the sandbox
Select Suspend and leave it suspended for a few seconds.
Expected: The terminal disconnects and the counter stops advancing.
3Resume the saved state
Select Resume and compare the next count with the number you noted.
Expected: The counter continues from its saved state, rather than starting over.
Note the running counter, Suspend, then Resume. Chalk restores the saved process state; the counter continues instead of starting a new process.
Built on Chalk
Chalk checkpoints the sandbox and restores it under the same ID. The example supplies the browser terminal, counter process, and controls for the suspend/resume sequence.
Checkpoint the running sandbox
Suspend saves memory, process state, the filesystem, and /tmp for a host-backed sandbox. The terminal detaches while the checkpoint is written.
Release idle compute
A suspended sandbox holds no running CPU or memory allocation. Its checkpoint remains in storage until it is resumed.
Restore the same sandbox ID
Resume restores the saved state on a host with capacity. The supplied counter is started by the sandbox’s entrypoint so its process survives this sequence.
Preserve the sandbox specification
The resumed sandbox retains its kernel, network policy, resource limits, and identity. Suspending is a lifecycle operation, not a permission change.
Suspend and resume in two calls
Suspend a running sandbox by id, and resume it by the same id whenever you need it again. Suspending needs a host-backed sandbox (ComputeClass.HOST), and processes you want to keep running across a resume should be started by the sandbox's own entrypoint; the demo's README explains why.
The example calls the sandbox API directly with the SDK's credentials. Dedicated sandbox.suspend() and sandbox.resume() methods are on their way to chalkcompute. Want a copy of a running sandbox instead of a pause? See the fork demo.
git clone https://github.com/chalk-ai/sandbox-suspend
cd sandbox-suspend
# Or export CHALK_CLIENT_ID and CHALK_CLIENT_SECRET.
chalk login
# Builds the server image, starts a warm pool of sandboxes, prints your terminal's URL.
./deploy.pyLet your agents sleep on it
Talk to an engineer about suspending and resuming sandboxes in your cloud, next to your data.