- Outside the sandbox — use the Mesa SDK (TypeScript or Python) to create repos, sign a short-lived access token, and orchestrate your workflow.
- Inside the sandbox — install the
mesaCLI, configure FUSE access, and startmesa mountas a detached sandbox command withMESA_ACCESS_TOKENin its environment. - Run your agent — run commands in the Mesa mount path (ex. Claude Code, Codex, or a custom agent). Any file edits are automatically persisted back to Mesa.
Sandbox setup
Vercel sandboxes run on Amazon Linux 2023, so install FUSE withdnf. The Mesa installer supports RPM-based Linux distributions, so the standard install script works on Vercel.
Vercel’s runCommand takes an object where cmd is the executable and args are its arguments. Use sh -c only when you need shell syntax like pipes or redirection.
The layout scopes the token: it can reach the repositories the layout declares
and nothing else. A plain
mesa mount then shows exactly those repositories
under the organization browse tree. To mount the layout’s own paths instead,
serialize workspace.layout() with JSON.stringify(...), write it into the
sandbox, and mount with mesa mount --layout <file>.Command snippets
When you already have a Vercel sandbox, these are the commands that run inside it:Example
For a runnable TypeScript example with a small interactive shell, seeexamples/vercel-shell.
Tips
- Use scoped, short-lived access tokens. Sign a dedicated token for each sandbox session with only the scopes it needs. It’s signed locally with your private key (which never enters the sandbox) and expires on its own. See Authentication for details.
- Pick a TTL that covers the session. Tokens default to a 15 minute TTL and max out at 4 hours, and a mount keeps the token it started with for its whole lifetime. If the token expires mid-session, filesystem operations in the sandbox start failing with authentication errors; mint a fresh token on the host and start a new detached mount.
- Use Vercel’s detached commands. Run
mesa mountwithdetached: trueinstead ofmesa mount --daemonize; this lets Vercel keep the long-running mount process alive. - Run commands from the mount path. Set
cwdto~/.local/share/mesa/mnt/<org>/<repo>when running your agent command. - Configure FUSE explicitly. Vercel sandboxes need
fuse3,user_allow_other, and non-root access to/dev/fuse.

