English
Get started

Agent Sandboxes Volumes that outlive sandboxes

Volumes: a disk that outlives its sandboxes

Some data should outlast a sandbox, or be read by many: a dataset, a package cache, a model’s weights. A volume holds it: a disk outside every sandbox, mounted at a path when a sandbox is created, and kept when the sandbox is deleted.

How sandbox volumes work

A volume is a disk of 1 to 1,000 GiB on one of our servers, a sparse ext4 image outside every sandbox. You make one with create_volume and mount it when you create a sandbox, at an absolute path such as /data. A sandbox mounts up to 4 volumes, and runs on the server that holds them.

One sandbox mounts a volume read-write, or any number of sandboxes mount it read-only, never both at once. A sandbox holds its mount until it is deleted: pausing or stopping it keeps the mount. So to hand a volume from the sandbox that filled it to its readers, delete the writer, then create the readers with read-only mounts. A fork of a sandbox that mounts volumes read-only mounts them too.

When a sandbox is deleted, the volume stays with its files, and the next sandbox that mounts it finds them as they were left. Each volume reports the bytes it uses and the sandboxes that mount it, and deleting it is refused while a sandbox mounts it. The volumes guide has every call and field.

from pethost.sandboxes import Mount, Sandboxes

sandboxes = Sandboxes()  # reads PETHOST_TOKEN
volume = sandboxes.create_volume("datasets", size_gib=50)

writer = sandboxes.create_sandbox(mounts=[Mount(volume_id=volume.volume_id, path="/data")])
sandboxes.run_command(writer.sandbox_id, command="seq 1 1000000 > /data/numbers.txt")
sandboxes.delete_sandbox(writer.sandbox_id)  # the volume stays

readers = [
    sandboxes.create_sandbox(mounts=[Mount(volume_id=volume.volume_id, path="/data", read_only=True)])
    for _ in range(3)
]
print(sandboxes.run_command(readers[0].sandbox_id, command="wc -l /data/numbers.txt").stdout)
# 1000000 /data/numbers.txt
vol=$(pethost sandbox volume new datasets --size 50)
pethost sandbox new --name writer --mount "$vol:/data"
pethost sandbox run writer -- 'seq 1 1000000 > /data/numbers.txt'
pethost sandbox rm writer -y                 # the volume stays
pethost sandbox new --mount "$vol:/data:ro"  # a reader

What to know before you rely on a volume

A volume lives on one server’s disk and is not copied anywhere else. If that server is lost, the volume is lost with it, and the sandboxes that mounted it lose it too. Keep a copy elsewhere of anything you cannot lose. A sandbox’s own disk, by contrast, is copied to object storage a minute after the sandbox stops.

A volume also ties its sandboxes to its server. A stopped sandbox that mounts one starts again only there, where a sandbox without volumes may start on another server with room. A fork is refused while the sandbox mounts a volume read-write. A volume cannot be resized or mounted into a running sandbox yet, and one larger than half a server’s disk is refused. If a writer ended without unmounting it, because it crashed or was deleted while paused, mount the volume read-write once, which replays its journal, before any read-only mount.

A volume adds no disk speed. A sandbox’s volumes share its size’s disk rate with its own disk: 64 MiB/s and 1,500 operations a second per vCPU, so 128 MiB/s and 3,000 for a SMALL.

What a volume costs

A volume is billed by its whole size, used or not, at $0.20 per GiB a month, counted by the second. Your plan bounds the GiB your volumes hold together:

PlanVolumes, all together
The trial10 GiB
$20 a month100 GiB
$100 a month600 GiB
$500 a month3,500 GiB
$2,000 a month16,000 GiB

For files that belong to one sandbox, its own disk costs less: a stopped sandbox pays $0.03 per GiB a month of the data it holds, and a template carries files to new sandboxes for nothing within your plan’s template room. A fork copies a sandbox’s own disk along with its memory; a volume is never copied.

How it compares

Volumes cost more at Pethost than at the vendors we read on 21 November 2026. Modal charged $0.09 per GiB a month, Blaxel $0.12 per GB, and Daytona included volumes at no cost, up to 100 an organization; E2B’s volumes were in private beta. Use a volume where several sandboxes read the same data, or where data must outlive the sandbox that made it; keep the rest on a sandbox’s own disk.

Read the docs

Questions

Is a sandbox volume backed up?

No. It lives on one server’s disk and is not copied. Keep a copy elsewhere of what you cannot lose. A stopped sandbox’s own disk is copied to object storage.

Can two sandboxes write to a volume?

Not at once. One sandbox mounts it read-write, or any number mount it read-only, and a sandbox keeps its mount until it is deleted.

Can I mount a volume into a running sandbox?

Not yet. Mounts are set when a sandbox is created, up to 4 of them.

What does a volume cost?

$0.20 per GiB a month of its whole size, used or not, counted by the second.

Related

Give your agent a computer in 0.15 s

Start the free trial