Drives for Vercel Sandbox are now available in public beta on Hobby, Pro, and Enterprise.
A Drive is persistent storage that you mount as a directory in a Vercel Sandbox. It isn’t tied to a single sandbox, so you can reuse the same Drive across runs and different sandbox instances.
Use Drives to preserve an agent's workspace or on-disk memory, or to reuse datasets, models, and dependency trees.
Copy link to heading Create and mount a Drive
Create or retrieve a Drive and mount it at a path when starting a sandbox. Read and write files through the sandbox filesystem at that path.
import { Sandbox , Drive } from '@vercel/sandbox' ;
const workspace = await Drive . getOrCreate ( {
name : 'agent-workspace' ,
} ) ;
const sandbox = await Sandbox . create ( {
mounts : { '/data' : workspace } ,
} ) ;
Create and mount a Drive in a Vercel sandbox.
Anything stored under /data remains on the Drive after the sandbox stops.
A Drive supports one read-write mount at a time.…