Isolate multiple AI agents in a single Vercel Sandbox by giving each its own Linux user and sharing files through a group directory.

domain: vercel.com · 6 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Create a sandbox as usual: `const sandbox = await Sandbox.create()`. Docs: https://vercel.com/docs/sandbox/multi-agent
  2. Create a Linux user per agent: `const alice = await sandbox.createUser('alice')`. Username must match `/^[a-z_][a-z0-9_-]*$/` and be at most 32 characters; the user gets `/bin/bash` and a private home directory at `/home/alice`.
  3. Run commands or file operations scoped to that user via the returned `SandboxUser` handle (methods mirror the sandbox's own `runCommand`/file APIs but execute as that Linux user).
  4. To reference a user that already exists (e.g. restored from a snapshot, or `root`) without creating it, use `sandbox.asUser('bob')`.
  5. For shared workspace between agents, create a group: `const devs = await sandbox.createGroup('devs')` (shared directory at `/shared/devs`, setgid so files inherit the group). Add members with `await sandbox.addUserToGroup('alice', 'devs')`; revoke with `sandbox.removeUserFromGroup('alice', 'devs')`.
  6. Group revocation applies immediately to new commands, but processes already running as that user retain group access until they exit.

Known gotchas

Give your agent this knowledge — and 16,900+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans