Skip to main content
A Vercel Sandbox is a short-lived microVM: when it stops or its timeout runs out, its files go with it. Mount an Archil disk in the sandbox and anything written there stays on the disk, where the next sandbox can mount it and your app can read it with the Archil SDK, without starting a sandbox. Vercel Sandbox VMs support FUSE, so the disk mounts as a regular directory.
Archil also runs sandboxes itself. Archil sandboxes are Firecracker microVMs whose root filesystem is an Archil disk, with an egress firewall and forks that branch the root disk at any size. This guide is for teams that already run agents on Vercel Sandbox and want their workspace data on storage they can take with them.

Prerequisites

Vercel Sandbox VMs meet the requirements for mounting: they provide /dev/fuse, and archil runs as root with sudo: true. If you restrict the sandbox’s outbound traffic, allow TCP 8100 and 32050. Export your Archil API key and region, install the Archil and Vercel Sandbox SDKs, and link the directory to a Vercel project with the Vercel CLI. On your machine, @vercel/sandbox authenticates as the linked project.

Mount a disk

First, create a disk. You only do this once:
setup.ts
Run it with eval "$(npx tsx setup.ts)" to export the disk ID and the disk’s mount token, which grants access to this disk only. In a Vercel Function, store both as environment variables instead. Now start a sandbox in the Vercel region next to the disk, install the archil client, mount the disk at /mnt/archil, and write a file. The commands run as root, and the token is passed only to the mount command:
mount.ts
A write is durable on Archil once fsync returns, stored redundantly across Availability Zones (see Data durability). The client buffers writes that haven’t been synced and sends them in the background, so the script unmounts before it stops the sandbox: archil unmount returns once every write has reached the disk, and releases the disk for the next sandbox. Run npx tsx mount.ts twice. Each run starts a new sandbox, and the second one finds the line the first one wrote:
A plain mount is exclusive: one sandbox holds the disk at a time. To mount it in several sandboxes at once, add --conditional, so every sandbox can read and write without a checkout. See Sharing a disk between agents for how to hand files from one sandbox to another, and Consistency for when each one sees the others’ writes.

Read it from anywhere

Both sandboxes are gone, and the file is still on the disk. Read it from your own machine or app with the SDK:
read.ts
If a sandbox stops before it unmounts, see Troubleshooting mounts on other platforms.

Clean up

Delete the disk with the disk CLI. The sandboxes already stopped at the end of each run.

Next steps