vercel-sandbox
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVercel Sandbox Skill
Vercel Sandbox 技能
Vercel Sandbox is an ephemeral compute primitive (Beta, all plans) that runs untrusted or
user-generated code in isolated Linux microVMs on Vercel. It supports AI agents, code generation
tools, developer sandboxes, and backend logic testing.
Vercel Sandbox 是一种临时计算原语(Beta版,支持所有套餐),可在Vercel的隔离Linux microVM中运行不受信任或用户生成的代码。它支持AI Agent、代码生成工具、开发者sandbox以及后端逻辑测试。
When to consult reference files
何时查阅参考文件
- Getting started / setup: Read references/quickstart.md
- SDK usage (TypeScript): Read references/sdk-reference.md
- CLI commands: Read references/cli-reference.md
- Pricing, limits, resource specs: Read references/pricing-and-specs.md
- Authentication details: Covered in both quickstart and SDK reference files
- 入门/设置:阅读 references/quickstart.md
- SDK使用(TypeScript):阅读 references/sdk-reference.md
- CLI命令:阅读 references/cli-reference.md
- 定价、限制、资源规格:阅读 references/pricing-and-specs.md
- 身份验证详情:在快速入门和SDK参考文件中均有涵盖
Quick reference
快速参考
Install
安装
bash
pnpm i @vercel/sandbox # TypeScript
pip install vercel-sandbox # Pythonbash
pnpm i @vercel/sandbox # TypeScript
pip install vercel-sandbox # PythonAuthentication setup
身份验证设置
bash
vercel link # Link to a Vercel project
vercel env pull # Pull OIDC token to .env.local (expires 12h locally)bash
vercel link # 关联到Vercel项目
vercel env pull # 将OIDC token拉取到.env.local(本地有效期12小时)Minimal example (TypeScript)
最简示例(TypeScript)
ts
import { Sandbox } from '@vercel/sandbox';
const sandbox = await Sandbox.create();
const result = await sandbox.runCommand('echo', ['Hello from Vercel Sandbox!']);
console.log(await result.stdout());
await sandbox.stop();ts
import { Sandbox } from '@vercel/sandbox';
const sandbox = await Sandbox.create();
const result = await sandbox.runCommand('echo', ['Hello from Vercel Sandbox!']);
console.log(await result.stdout());
await sandbox.stop();Key SDK classes
核心SDK类
| Class | Purpose |
|---|---|
| Create, manage, list, snapshot microVMs |
| Interact with running/detached commands |
| Access exit code, stdout, stderr after completion |
| Save/restore sandbox state for fast restarts |
| 类名 | 用途 |
|---|---|
| 创建、管理、列出、快照microVM |
| 与运行中/分离的命令交互 |
| 完成后访问退出码、标准输出、标准错误 |
| 保存/恢复sandbox状态以实现快速重启 |
Available runtimes
可用运行时
node24node22python3.13node24node22python3.13Default working directory
默认工作目录
/vercel/sandboxvercel-sandbox/vercel/sandboxvercel-sandboxTimeouts
超时设置
Default 5 min. Max: 45 min (Hobby), 5 hours (Pro/Enterprise). Extend with .
sandbox.extendTimeout()默认5分钟。最大值:Hobby套餐45分钟,Pro/Enterprise套餐5小时。可通过延长。
sandbox.extendTimeout()Snapshots
快照
Capture with — sandbox stops after snapshot. Expire after 7 days.
sandbox.snapshot()使用捕获——快照完成后sandbox会停止。7天后过期。
sandbox.snapshot()Updating documentation
更新文档
When the user asks to "update the Vercel Sandbox documentation", choose the right
method based on the environment:
当用户要求“更新Vercel Sandbox文档”时,根据环境选择合适的方法:
Method selection
方法选择
- claude.ai / Claude Desktop (has tool) → Use Path A: web_fetch
web_fetch - Claude Code (has bash with internet) → Use Path B: Python script
To detect: if is in your available tools, use Path A. Otherwise use Path B.
web_fetch- claude.ai / Claude Desktop(具备工具)→ 使用 路径A:web_fetch
web_fetch - Claude Code(具备联网bash环境)→ 使用 路径B:Python脚本
检测方式:如果可用工具中包含,则使用路径A,否则使用路径B。
web_fetchPath A: web_fetch (claude.ai / Claude Desktop)
路径A:web_fetch(claude.ai / Claude Desktop)
- Use to retrieve https://vercel.com/docs/vercel-sandbox (the main page)
web_fetch - Discover all sub-page links under
/docs/vercel-sandbox/ - Fetch each known sub-page URL (see list below) plus any newly discovered pages
- For each reference file in : a. Read the existing file content b. Compare with fetched content — note additions, removals, changes c. Rewrite the reference file with updated, clean markdown d. Update the
references/date at the top> Last fetched: - Report to user: pages fetched, what changed per file, update date
- 使用获取https://vercel.com/docs/vercel-sandbox(主页面)
web_fetch - 发现下的所有子页面链接
/docs/vercel-sandbox/ - 获取所有已知子页面URL(见下方列表)以及任何新发现的页面
- 对于中的每个参考文件: a. 读取现有文件内容 b. 与获取的内容进行比较——记录新增、删除和修改内容 c. 用更新后的清晰Markdown重写参考文件 d. 更新顶部的
references/日期> Last fetched: - 向用户报告:获取的页面数量、每个文件的变更内容、更新日期
Path B: Python script (Claude Code / local terminal)
路径B:Python脚本(Claude Code / 本地终端)
Run the update script which has full internet access:
bash
python3 <skill-path>/scripts/update_docs.py <skill-path>/referencesThe script will:
- Fetch all known sandbox doc URLs from vercel.com
- Discover any new sub-pages from the main page
- For each reference file: compute a diff, overwrite with new content, report changes
- Print a summary of what changed and when
After the script runs, review its output and report changes to the user.
运行具备完整联网权限的更新脚本:
bash
python3 <skill-path>/scripts/update_docs.py <skill-path>/references该脚本将:
- 从vercel.com获取所有已知sandbox文档URL
- 从主页面发现任何新的子页面
- 对于每个参考文件:计算差异,用新内容覆盖,报告变更
- 打印变更内容和时间的摘要
脚本运行后,查看其输出并向用户报告变更情况。
Known doc page URLs
已知文档页面URL
- https://vercel.com/docs/vercel-sandbox (overview + system specs)
- https://vercel.com/docs/vercel-sandbox/quickstart
- https://vercel.com/docs/vercel-sandbox/sdk-reference
- https://vercel.com/docs/vercel-sandbox/cli-reference
- https://vercel.com/docs/vercel-sandbox/pricing
- https://vercel.com/docs/vercel-sandbox/examples
- https://vercel.com/docs/vercel-sandbox/managing
Also discover any new pages linked from the main page's sidebar/navigation.
- https://vercel.com/docs/vercel-sandbox(概述 + 系统规格)
- https://vercel.com/docs/vercel-sandbox/quickstart
- https://vercel.com/docs/vercel-sandbox/sdk-reference
- https://vercel.com/docs/vercel-sandbox/cli-reference
- https://vercel.com/docs/vercel-sandbox/pricing
- https://vercel.com/docs/vercel-sandbox/examples
- https://vercel.com/docs/vercel-sandbox/managing
同时发现主页面侧边栏/导航中链接的任何新页面。