{
 "kind": "api",
 "slug": "vercel-sandbox",
 "path": "apis/vercel-sandbox/",
 "name": "Vercel Sandbox",
 "logo": "https://agentgid.com/media/avatars/vercel.png",
 "maker": "Vercel",
 "density": "full",
 "crumbs": [
  [
   "APIs",
   "apis/"
  ],
  [
   "Code sandboxes",
   "apis/sandbox/"
  ]
 ],
 "lead": "A throwaway Linux computer for untrusted code.",
 "chips": [
  {
   "label": "Code sandboxes",
   "path": "apis/sandbox/"
  },
  {
   "label": "Up · live status",
   "live": true
  },
  {
   "label": "Official MCP server"
  }
 ],
 "primary": {
  "label": "Copy prompt for your agent",
  "copy": "Run the code my agent generates in Vercel Sandbox: on the server use @vercel/sandbox with the OIDC token from .env.local, create the sandbox with networkPolicy deny-all unless it needs the internet, check exitCode and stderr, and call sandbox.stop() when done."
 },
 "links": [
  {
   "label": "Website",
   "href": "https://vercel.com/docs/sandbox"
  },
  {
   "label": "Pricing",
   "href": "https://vercel.com/docs/vercel-sandbox/pricing"
  },
  {
   "label": "GitHub",
   "href": "https://github.com/vercel/sandbox"
  }
 ],
 "track": "Outages, price changes and new versions on your dashboard",
 "verdicts": [
  {
   "key": "price",
   "label": "Price",
   "value": "Free every month",
   "status": "yes",
   "sub": "Then from $20/mo",
   "quote": null,
   "note": "Free tier: Hobby: 5 active-CPU hours, 420 GB-hours memory, 5,000 sandbox creations per month. As reported on the official pricing page, checked Nov 1, 2026.",
   "src": "https://vercel.com/docs/vercel-sandbox/pricing"
  },
  {
   "key": "commercial",
   "label": "Commercial use",
   "value": "With conditions",
   "status": "cond",
   "sub": null,
   "quote": "You shall only use the Services under a Hobby plan for your personal or non-commercial use.",
   "note": "Needs a Pro or Enterprise plan; the Hobby plan is for personal, non-commercial use only.",
   "src": "https://vercel.com/legal/terms"
  },
  {
   "key": "key",
   "label": "Key & sign-up",
   "value": "API key, server only",
   "status": "info",
   "sub": "Env var VERCEL_OIDC_TOKEN (or VERCEL_TOKEN + VERCEL_TEAM_ID + VERCEL_PROJECT_ID)",
   "quote": "This creates a .env.local file with a VERCEL_OIDC_TOKEN.",
   "note": "Vercel OIDC token (recommended): vercel link + vercel env pull writes VERCEL_OIDC_TOKEN to .env.local, and on Vercel it is automatic. Elsewhere: an access token with team and project IDs.",
   "src": "https://vercel.com/docs/sandbox/concepts/authentication.md"
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Official MCP server",
   "status": "yes",
   "sub": "llms.txt · OpenAPI · SDK",
   "quote": "Vercel MCP is Vercel's official MCP server. It's a remote MCP with OAuth that gives AI tools secure access to your Vercel projects available at",
   "note": " Our agent check: 6 of 6 (Nov 13, 2026).",
   "src": "https://vercel.com/docs/mcp/vercel-mcp.md"
  }
 ],
 "vfoot": "Checked against the maker's official pages, pricing on Nov 1, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What Vercel Sandbox does",
   "parts": [
    {
     "t": "prose",
     "text": "Vercel Sandbox starts a small, separate Linux computer in Vercel's cloud for a few minutes or hours. Your app or AI agent runs code there that you do not trust, such as AI-written scripts or user uploads, away from your real site. You pay mostly for the time the processor is actually busy, not for time spent waiting."
    },
    {
     "t": "list",
     "items": [
      "Vercel Sandbox is one of 12 APIs in the Code sandboxes category on AgentGid.",
      "Its cheapest paid plan ($20 a month) is the 3rd cheapest of the 9 here with a monthly plan.",
      "It is one of 11 that can be started for free.",
      "It ships an official MCP server, like 3 others here.",
      "Its official SDK is the 2nd most downloaded in the category (8.1M a week)."
     ],
     "muted": true
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Run code your AI assistant wrote",
       "text": "Your chat or agent writes a script; the sandbox runs it and returns the output, so a bad script never touches your servers.",
       "idea": false
      },
      {
       "title": "Code playgrounds and AI page builders",
       "text": "Let visitors type or generate code and see it run, for example a coding course playground or a tool that builds pages from a prompt.",
       "idea": false
      },
      {
       "title": "Live preview of a generated app",
       "text": "Start the app your user or agent just built and show it at a temporary web address, so they can click through it.",
       "idea": false
      },
      {
       "title": "Work on private data with no internet",
       "text": "When an agent reads private files, block all outgoing traffic so nothing can be sent out of the sandbox.",
       "idea": false
      },
      {
       "title": "Let an agent use a service without seeing its key",
       "text": "The agent inside can call GitHub or an AI service, while your secret key is added on the way out and never enters the sandbox.",
       "idea": false
      },
      {
       "title": "Check homework submissions",
       "text": "Run each student's submitted program in its own sandbox against your tests and collect the results.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "Vercel Sandbox popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "7.6M",
       "l": "SDK downloads a week",
       "d": "+19.1% on the 4-week average",
       "up": true
      },
      {
       "n": "15",
       "l": "public agent repos use its SDK"
      },
      {
       "n": "228",
       "l": "GitHub stars, vercel/sandbox"
      }
     ]
    },
    {
     "t": "small",
     "text": "SDK downloads from npm and PyPI, weekly. Numbers as of Nov 17, 2026."
    }
   ]
  },
  {
   "id": "pricing",
   "nav": "Pricing and limits",
   "h2": "Pricing",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Free tier",
       "v": "Hobby: 5 active-CPU hours, 420 GB-hours memory, 5,000 sandbox creations per month"
      },
      {
       "l": "Cheapest plan",
       "v": "$20 a month"
      },
      {
       "l": "Usage price",
       "v": "Active CPU $0.128/hour; provisioned memory $0.0212 per GB-hour; creations $0.60 per 1M (iad1)"
      },
      {
       "l": "Plans",
       "v": "Pro usage is charged against the Vercel Pro plan's $20/month credit, then at the listed rates. Rates vary by region. Only active CPU time is billed for CPU; memory billed in 1-minute minimums. Hobby sessions max 45 min; Pro 24 h. Vercel's general MCP server includes sandbox tools."
      }
     ]
    },
    {
     "t": "h3",
     "text": "What one action costs"
    },
    {
     "t": "table",
     "head": [
      "Action",
      "Price"
     ],
     "num": true,
     "rows": [
      [
       "1 hour of active CPU (Pro, iad1)",
       "$0.128"
      ],
      [
       "1 GB of memory for 1 hour (Pro, iad1)",
       "$0.0212"
      ],
      [
       "1 million sandbox creations",
       "$0.60"
      ],
      [
       "One 5-minute AI code check (2 vCPU, 4 GB, 10% CPU use, Pro, iad1)",
       "$0.0092"
      ]
     ]
    },
    {
     "t": "more",
     "items": [
      {
       "title": "Price history",
       "items": [
        "A year of the pricing page in the Internet Archive (2 months): the lowest monthly figure went from $20 (2026-02) to $20 (2026-03)."
       ]
      }
     ]
    },
    {
     "t": "small",
     "text": "As reported on the official pricing page, checked Nov 1, 2026. Prices change: confirm before you buy.",
     "link": "vercel.com/docs/vercel-sandbox/pricing",
     "href": "https://vercel.com/docs/vercel-sandbox/pricing"
    }
   ]
  },
  {
   "id": "limits",
   "nav": null,
   "spy_as": "pricing",
   "h2": "Limits",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Hobby",
       "v": "10 sandboxes at once, sessions up to 45 minutes; 5 hours of active CPU, 420 GB-hours of memory and 5,000 creations a month",
       "src": "https://vercel.com/docs/sandbox/pricing.md"
      },
      {
       "l": "Hobby",
       "v": "Over the monthly quota, creating sandboxes is paused (no extra charge)",
       "src": "https://vercel.com/docs/sandbox/pricing.md"
      },
      {
       "l": "Pro / Enterprise",
       "v": "10,000 sandboxes at once, sessions up to 24 hours",
       "src": "https://vercel.com/docs/sandbox/pricing.md"
      },
      {
       "l": "All",
       "v": "Control requests (run commands, read files): 1,000 a minute on Hobby, 10,000 on Pro; deletions 20 a second",
       "src": "https://vercel.com/docs/sandbox/pricing.md"
      },
      {
       "l": "All",
       "v": "Default timeout 5 minutes, can be extended up to the plan's session maximum",
       "src": "https://vercel.com/docs/sandbox/pricing.md"
      }
     ]
    },
    {
     "t": "small",
     "text": "From the official docs.",
     "link": "vercel.com/docs/sandbox/pricing.md",
     "href": "https://vercel.com/docs/sandbox/pricing.md"
    }
   ]
  },
  {
   "id": "status",
   "nav": "Status",
   "h2": "Status and incidents",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Right now",
       "v": "Up",
       "status": "yes",
       "sub": "All Systems Operational"
      },
      {
       "l": "Last 30 days",
       "v": "3 incidents, 1 of them major"
      }
     ]
    },
    {
     "t": "small",
     "text": "From the official status page, checked Nov 23, 2026.",
     "link": "vercel-status.com",
     "href": "https://www.vercel-status.com"
    }
   ]
  },
  {
   "id": "access",
   "nav": "Access and terms",
   "h2": "Key and access",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "How it signs in",
       "v": "Vercel OIDC token (recommended): vercel link + vercel env pull writes VERCEL_OIDC_TOKEN to .env.local, and on Vercel it is automatic. Elsewhere: an access token with team and project IDs."
      },
      {
       "l": "Environment variable",
       "v": "VERCEL_OIDC_TOKEN (or VERCEL_TOKEN + VERCEL_TEAM_ID + VERCEL_PROJECT_ID)",
       "code": true
      },
      {
       "l": "Safe in browser code",
       "v": "No, keep it on your server",
       "status": "no"
      },
      {
       "l": "Card at sign-up",
       "v": "No"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Steps only a person can do"
    },
    {
     "t": "list",
     "items": [
      "Sign up for Vercel and create or link a project (vercel link), then pull the token (vercel env pull). Load .env.local with dotenv; the SDK reads VERCEL_OIDC_TOKEN from the environment.",
      "Choose Pro before any commercial use, and set Spend Management alerts. No code change; the same project and tokens keep working.",
      "Decide on AI training of your content (on Hobby it is on by default); change it in team settings. Nothing in code; note the choice in the project README."
     ]
    }
   ]
  },
  {
   "id": "terms",
   "nav": null,
   "spy_as": "access",
   "h2": "Commercial use and your data",
   "parts": [
    {
     "t": "prose",
     "text": "It is a paid Vercel service with a free monthly allowance on the Hobby plan, which is for personal, non-commercial use only. A business product needs Pro or Enterprise. The client code is open source (Apache-2.0 for the JavaScript package)."
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In a paid app",
       "v": "With conditions",
       "status": "cond",
       "sub": "Needs a Pro or Enterprise plan; the Hobby plan is for personal, non-commercial use only.",
       "quote": "You shall only use the Services under a Hobby plan for your personal or non-commercial use.",
       "src": "https://vercel.com/legal/terms"
      },
      {
       "l": "redistribute-files",
       "v": "Yes",
       "status": "yes",
       "sub": "The JavaScript package and command-line tool are Apache-2.0; the Python package is MIT. Keep their license notices.",
       "quote": "\"license\":\"Apache-2.0\"",
       "src": "https://registry.npmjs.org/@vercel/sandbox/latest"
      },
      {
       "l": "To train your own AI",
       "v": "With conditions",
       "status": "cond",
       "sub": "On Hobby and trial Pro, Vercel may train on your content unless you opt out; on paid Pro it is off unless you opt in.",
       "quote": "You may opt-out of model training at any time by adjusting your team account settings or by upgrading to an enterprise plan.",
       "src": "https://vercel.com/legal/terms"
      },
      {
       "l": "Trains on what you send",
       "v": "“you agree that we may use your content to train our artificial intelligence”",
       "quote": null,
       "src": "https://vercel.com/legal/terms"
      },
      {
       "l": "Keeps your data",
       "v": "“Snapshots expire 30 days after their last use by default.”",
       "quote": null,
       "src": "https://vercel.com/docs/sandbox/pricing.md"
      },
      {
       "l": "Where data is stored",
       "v": "“Vercel Sandbox is available in 19 regions. The default region is iad1.”",
       "quote": null,
       "src": "https://vercel.com/docs/sandbox/pricing.md"
      }
     ]
    }
   ]
  },
  {
   "id": "errors",
   "nav": null,
   "spy_as": "access",
   "h2": "Errors to handle",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Authentication error after a day of local work",
       "v": "The development OIDC token from vercel env pull has expired.",
       "sub": "Run vercel env pull again; on Vercel the token is renewed automatically."
      },
      {
       "l": "Sandbox creation paused (Hobby)",
       "v": "The free monthly sandbox quota is used up.",
       "sub": "Wait for the next 30-day window or upgrade to Pro."
      },
      {
       "l": "snapshot_not_found",
       "v": "A named sandbox's saved state has expired and the SDK tried to resume it.",
       "sub": "Pass resume true to getOrCreate so a fresh sandbox with the same name is made, or lengthen the snapshot expiration."
      },
      {
       "l": "StreamError",
       "v": "The sandbox stopped while you were streaming its logs.",
       "sub": "Extend the timeout for long tasks or reconnect after resuming the sandbox."
      },
      {
       "l": "Non-zero exitCode",
       "v": "The command inside the sandbox failed; the SDK call itself succeeded.",
       "sub": "Check exitCode and read stderr() before using the output."
      }
     ]
    }
   ]
  },
  {
   "id": "agent",
   "nav": "For agents",
   "h2": "Use it from an agent",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Our agent check",
       "v": "6 of 6: llms.txt yes, OpenAPI yes, SDK yes, MCP yes, status page yes, AI assistants allowed yes",
       "sub": "Checked Nov 13, 2026."
      },
      {
       "l": "MCP server",
       "v": "Vercel MCP (general Vercel server; its tool list has a Sandboxes section)",
       "sub": "npx -y add-mcp https://mcp.vercel.com -g"
      },
      {
       "l": "npm",
       "v": "npm install @vercel/sandbox",
       "code": true
      },
      {
       "l": "PyPI",
       "v": "pip install vercel",
       "code": true
      }
     ]
    },
    {
     "t": "h3",
     "text": "Instructions in its docs to check first"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "The docs say",
       "v": "“First, load the installed Sandbox skill, or install it with npx skills add vercel/sandbox. Make sure the Vercel CLI is installed (npm i -g vercel).”",
       "sub": "Ask the person first; it installs an unpinned skill and a global tool and links their account."
      },
      {
       "l": "The docs say",
       "v": "“npx -y add-mcp https://mcp.vercel.com -g”",
       "sub": "Ask the person first; it writes the MCP server into every AI tool on the machine and then asks for an OAuth login to their Vercel account."
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "Vercel Sandbox",
       "me": true,
       "facts": [
        "from $0.0212 per GB-hour",
        "Free tier",
        "Official MCP"
       ]
      },
      {
       "name": "E2B",
       "why": "Pick E2B when you are not on Vercel, want $100 of free credits, or may want to host the open-source engine yourself.",
       "path": "apis/e2b/",
       "facts": [
        "Free (open source)",
        "Free tier",
        "Official MCP"
       ]
      },
      {
       "name": "Daytona",
       "why": "Pick Daytona when you need sandboxes with graphics cards or Windows.",
       "path": "apis/daytona/",
       "facts": [
        "from $0.000108 per GiB-hour after",
        "Free tier",
        "Official MCP"
       ]
      },
      {
       "name": "Modal Sandboxes",
       "why": "Pick Modal Sandboxes when the code you run needs graphics cards, in serverless containers.",
       "path": "apis/modal-sandboxes/",
       "facts": [
        "from $0.00000667 per GiB per",
        "Free tier"
       ]
      }
     ],
     "more": "All code sandboxes APIs",
     "more_path": "apis/sandbox/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Run the code my agent generates in Vercel Sandbox: on the server use @vercel/sandbox with the OIDC token from .env.local, create the sandbox with networkPolicy deny-all unless it needs the internet, check exitCode and stderr, and call sandbox.stop() when done."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Link a folder to a Vercel project and pull a development token into .env.local (needs a Vercel account and the Vercel command-line tool).",
       "code": "vercel link\nvercel env pull",
       "src": "https://vercel.com/docs/sandbox/quickstart.md"
      },
      {
       "text": "Install the package (Node.js 22+ or Python 3.10+).",
       "code": "npm install @vercel/sandbox dotenv @types/node tsx typescript",
       "src": "https://vercel.com/docs/sandbox/quickstart.md"
      },
      {
       "text": "Create a sandbox and run a command, then stop it when done.",
       "code": "const sandbox = await Sandbox.create();\nconst result = await sandbox.runCommand('echo', ['Hello from Vercel Sandbox!']);\nconsole.log(await result.stdout());",
       "src": "https://vercel.com/docs/sandbox/quickstart.md"
      }
     ]
    },
    {
     "t": "h3",
     "text": "First request"
    },
    {
     "t": "tabs",
     "label": "First request",
     "items": [
      {
       "tab": "Request",
       "code": "import { config } from 'dotenv';\nconfig({ path: '.env.local' });\n\nimport { Sandbox } from '@vercel/sandbox';\n\nasync function main() {\n  const sandbox = await Sandbox.create();\n\n  const result = await sandbox.runCommand('echo', ['Hello from Vercel Sandbox!']);\n  console.log(await result.stdout());\n}\n\nmain().catch(console.error);",
       "intro": null
      },
      {
       "tab": "Response",
       "code": "Hello from Vercel Sandbox!"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "Leaving sandboxes to run until the timeout.",
       "fix": "Call sandbox.stop() as soon as the work is done, and use the shortest timeout that works.",
       "why": "CPU and memory are billed while the sandbox runs."
      },
      {
       "dont": "Creating thousands of one-off sandboxes with the default persistence on.",
       "fix": "Pass persistent false (or --non-persistent in the CLI) for one-off jobs.",
       "why": "Sandboxes are persistent by default and the automatic snapshots are billed as storage."
      },
      {
       "dont": "Passing API keys into the sandbox as environment variables for the agent to use.",
       "fix": "Use credential brokering in the network policy, so the key is added to outgoing requests and never enters the sandbox.",
       "why": "Code inside the sandbox can read and leak any key it is given."
      },
      {
       "dont": "Treating a returned command result as success.",
       "fix": "Check exitCode (0 means success) and read stderr() before parsing stdout.",
       "why": "runCommand returns normally even when the program inside failed."
      },
      {
       "dont": "Building a commercial product on the Hobby plan.",
       "fix": "Use Pro or Enterprise for any business use.",
       "why": "The Hobby plan is limited to non-commercial personal use."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Is there a free tier?",
       "a": "Yes. Hobby includes 5 hours of active CPU, 420 GB-hours of memory and 5,000 sandbox creations a month, for non-commercial use. Over the quota, creation pauses instead of charging you.",
       "evidence": {
        "url": "https://vercel.com/docs/sandbox/pricing.md",
        "quote": "Sandbox is free for Hobby users within the usage quotas detailed above."
       }
      },
      {
       "q": "Do I pay while my code waits for an AI model to answer?",
       "a": "Not for CPU. Waiting for network or model calls does not count as active CPU; memory is still billed while the sandbox runs.",
       "evidence": {
        "url": "https://vercel.com/docs/sandbox/pricing.md",
        "quote": "Time spent waiting for I/O (such as network requests, database queries, or AI model calls) does not count toward Active CPU."
       }
      },
      {
       "q": "Can I use it outside Vercel hosting?",
       "a": "Yes. Use an access token with your team and project IDs in other clouds or CI systems.",
       "evidence": {
        "url": "https://vercel.com/docs/sandbox/concepts/authentication.md",
        "quote": "Use access tokens when VERCEL_OIDC_TOKEN is unavailable, such as in external CI/CD systems or non-Vercel environments."
       }
      },
      {
       "q": "How does Pro billing work?",
       "a": "Sandbox usage is first taken from the Pro plan's $20 monthly credit, then billed at the listed rates.",
       "evidence": {
        "url": "https://vercel.com/docs/sandbox/pricing.md",
        "quote": "All Sandbox usage on Pro plans is charged against your $20/month credit."
       }
      },
      {
       "q": "Which languages are inside a sandbox?",
       "a": "The default image has Node.js, Python 3.14, coding agents and common tools, with root access; you can also use your own image.",
       "evidence": {
        "url": "https://vercel.com/docs/sandbox.md",
        "quote": "The default image is vercel/sandbox/universal, which includes the current Node.js LTS, Python 3.14, coding agents, and common utilities."
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Maker",
   "Vercel"
  ],
  [
   "Category",
   "Code sandboxes"
  ],
  [
   "Status",
   "Up · 3 incidents in 30 days"
  ],
  [
   "Price",
   "from $0.0212 per GB-hour"
  ],
  [
   "Plans from",
   "$20/mo"
  ],
  [
   "Official SDK",
   "npm @vercel/sandbox, PyPI vercel"
  ],
  [
   "Latest SDK",
   "3.9.1 on npm"
  ],
  [
   "Agent check",
   "6 of 6"
  ],
  [
   "Pricing checked",
   "Nov 1, 2026"
  ]
 ],
 "good": [
  "You need a Vercel account and a project linked to your folder. Keep the token on the server, never in web page code.",
  "On the free Hobby plan, Vercel may use your content to train its AI models unless you opt out in team settings.",
  "Sandboxes save their files when they stop, and the saved copies count as paid storage; switch this off for one-off jobs."
 ],
 "checked_line": "Read by AgentGid from 23 official pages, card checked Nov 10, 2026; usage numbers update daily."
}