---
title: "Pause and resume sandboxes with memory · Pethost"
description: "A paused Pethost sandbox keeps its memory and running processes at 30% of the price; the next call wakes it in about 0.1 s, exactly where it was."
---

[Agent Sandboxes](https://pethost.dev/sandboxes/) Pauses with its memory

# Pause a sandbox with its memory, wake it in 0.1 s

An agent’s sandbox spends most of its life waiting for the model. A pause keeps everything in it, its running processes too, at 30% of the running price, and the next call wakes it in about 0.1 s, exactly where it was.

A sandbox pauses: its memory moves to its server’s disk and its price drops to 30%; a request arrives and it wakes in 0.08 s with the same process still running.

## What a pause keeps

A paused sandbox keeps its memory, its processes and its disk on its server’s disk. A dev server keeps its port open, a Python session keeps its variables, a coding agent’s conversation stays where it was, and a build half done goes on from where it stopped. You pause a sandbox with one call, `pause_sandbox`, or let its [idle timer](https://pethost.dev/sandboxes/auto-pause/) do it: by default, after 5 minutes with nothing happening in it.

## What wakes it

Anything that reaches into it: a command, a file read or write, an open stream, a prompt to an agent, an SSH login, or a request to one of its ports. You never resume it first: the call that needs it wakes it, and is answered. `resume_sandbox` is there for when you want it running with nothing to do.

Measured on our servers: a resume takes 41 ms on the server and 124 ms through the API; a command sent to a paused sandbox answers in 80 ms, its wake included; and a visit to a paused sandbox’s [preview URL](https://pethost.dev/sandboxes/preview-urls/) takes about 200 ms.

## How pause and resume work

A pause has the guest write its filesystems out, pauses the VM and takes a diff snapshot: only the memory the VM wrote since its last snapshot is written, and runs of pages that hold only zeroes are left out. Right after a create, a pause took 52 ms at the median for a SMALL sandbox and 85 ms for a LARGE one, through the API.

A paused sandbox keeps its place on its server: the server holds the memory its wake will need, so a wake is never refused for lack of room. That is why it resumes only there, on the same Firecracker, processor and base, and why a pause costs 30% of the running price rather than nothing.

Python

CLI

```
from pethost.sandboxes import Sandboxes

sandboxes = Sandboxes()  # reads PETHOST_TOKEN
sandbox = sandboxes.create_sandbox("base")

# A server process; the call answers once it listens on port 8000.
sandboxes.run_command(sandbox.sandbox_id, command="python3 -m http.server 8000", wait_for_port=8000)
sandboxes.pause_sandbox(sandbox.sandbox_id)  # memory, processes and disk kept on its server

# This call wakes it, and the same server process answers.
page = sandboxes.run_command(sandbox.sandbox_id, command="curl -s localhost:8000 | head -n 1")
print(page.stdout)
```

```
id=$(pethost sandbox new)
pethost sandbox run "$id" -d --wait-for-port 8000 -- python3 -m http.server 8000
pethost sandbox pause "$id"
pethost sandbox run "$id" -- 'curl -s localhost:8000 | head -n 1'   # wakes it
```

## What a paused sandbox costs

A paused sandbox is billed by the whole second at 30% of its size’s running price, with no minimum: $0.0054 an hour for SMALL, up to $0.0432 for XLARGE. Running time is never turned into paused time, and no second is counted twice. When we restart a server’s machine, its running sandboxes are paused and resumed after it, and those seconds cost nothing.

## Pause or stop

A stop is the other way to keep a sandbox you are not using. A pause keeps it ready; a stop keeps it cheap:

|  | Paused | Stopped |
| --- | --- | --- |
| Where it is | On its server’s disk | In object storage |
| What is kept | Memory, processes and disk | The disk; processes end |
| Price, SMALL | $0.0054 an hour | $0.03 per GiB a month of its own data |
| Back to running | About 0.1 s, at the next call | About 0.2 s by `resume_sandbox`, or about 10 s a GiB when its disk is fetched back |

By default a sandbox stops once it has been idle for 30 minutes, paused or not; [the lifecycle](https://pethost.dev/docs/sandboxes/lifecycle/) says how to change that.

## Limits

A paused sandbox’s size cannot change: a new size is refused until it is resumed or stopped. Its vCPUs count against your plan’s budget while it is paused, as a running sandbox’s do. When its server’s disk runs short, the paused sandboxes idle the longest are stopped early, their disks kept, and `state_message` says so. When a workspace’s included usage and balance are both spent, its paused sandboxes are stopped.

## How it compares

As their pages read on 21 November 2026: E2B keeps memory too and charges nothing while a sandbox is paused, but bills 2 vCPU and 4 GiB at $0.1656 an hour running, against $0.018 here, and its docs give a pause about 4 seconds per GiB of memory and a resume about 1 second. Daytona pauses only its Linux VM class, and bills the disk alone while paused. boat.dev has no pause: a stop removes the VM and keeps its disk.

[Read the docs](https://pethost.dev/docs/sandboxes/lifecycle/)

## Questions

**Does pausing and resuming a sandbox keep its running processes?**

Yes, with its memory and its disk. While it is paused, its processes are frozen with the rest of its memory, and they go on from where they were at the wake. A command started with `keep_awake` keeps the sandbox from pausing while it runs, for a build or a job nobody waits on.

**How much does a paused sandbox cost?**

30% of its running price, by the second: $0.0054 an hour for SMALL, $0.0108 for DEFAULT, $0.0216 for LARGE and $0.0432 for XLARGE.

**Can a wake fail for lack of room?**

No: a paused sandbox keeps its place on its server. A wake is refused only when the workspace holds more vCPUs than its plan allows now, after a move to a smaller plan for instance.

**Should I pause or stop a sandbox?**

Pause what you will come back to soon: it keeps memory and processes at 30% of the running price and picks up in about 0.1 s. Stop what can wait: its processes end, its disk is kept in object storage at $0.03 per GiB a month, and a start boots it again from that disk.

## Related

- [A timeline of idle time: at 5 minutes the sandbox pauses at $0.0054 an hour, at 30 minutes it stops to object storage at $0.03 per GiB a month. Pauses itself when idle Five minutes without a call and a sandbox pauses; thirty and it stops to object storage. Every timer is set per sandbox, and 0 turns it off. How it works](https://pethost.dev/sandboxes/auto-pause/)
- [A visit to port 3000’s HTTPS address wakes a paused sandbox in 0.2 s and its page appears; a private port answers 200 to a request with its token and 401 to one without. A URL for every port A dev server on port 3000 answers at its own HTTPS address, public or behind a token, and a visit wakes a paused sandbox in about 0.2 s. How it works](https://pethost.dev/sandboxes/preview-urls/)

## Give your agent a computer in 0.15 s

[Start the free trial](https://console.pethost.dev/welcome?kind=sandboxes)

Pethost · Stephan Gomer · NIP 1133096755

Pethost

- [Templates](https://pethost.dev/templates/)
- [About](https://pethost.dev/about/)
- [Docs](https://pethost.dev/docs/)
- [Blog](https://pethost.dev/blog/)
- [API](https://pethost.dev/docs/api/)
- [CLI](https://pethost.dev/docs/cli/)
- [Plugin](https://github.com/pethost-dev/plugin)
- [Terms](https://pethost.dev/terms/)
- [Privacy](https://pethost.dev/privacy/)
- [Refunds](https://pethost.dev/refunds/)
- [support@pethost.dev](mailto:support@pethost.dev)

Databases

- [Postgres](https://pethost.dev/postgres/)
- [Valkey](https://pethost.dev/valkey/)

Agent Sandboxes

- [Sandboxes](https://pethost.dev/sandboxes/)
- [Pricing](https://pethost.dev/sandboxes/#pricing)
- [Docs](https://pethost.dev/docs/sandboxes/)
- [API](https://pethost.dev/docs/sandboxes/api/)

Comparisons

- [Coolify vs Dokploy vs CapRover vs Dokku](https://pethost.dev/blog/coolify-vs-dokploy-vs-caprover-vs-dokku/)
- [Coolify Cloud vs Dokploy Cloud](https://pethost.dev/blog/coolify-cloud-vs-dokploy-cloud/)
- [Railway vs Render vs Fly.io pricing](https://pethost.dev/blog/railway-vs-render-vs-fly-io-pricing/)
- [Managed Docker Compose hosting](https://pethost.dev/blog/managed-docker-compose-hosting/)

Alternatives

- [Railway alternatives](https://pethost.dev/blog/railway-alternatives/)
- [Heroku alternatives](https://pethost.dev/blog/heroku-alternatives/)
- [Dokploy alternatives](https://pethost.dev/blog/dokploy-alternatives/)
- [Coolify alternatives](https://pethost.dev/blog/coolify-alternatives/)
- [Render alternatives](https://pethost.dev/blog/render-alternatives/)
- [Sliplane alternatives](https://pethost.dev/blog/sliplane-alternatives/)
