6.0
关注
AI SCORE
工具产品2026-07-28 12:00
Vercel Sandbox 支持快照分叉
Vercel Blog#Vercel#开发工具
Editor brief · 编辑速览
Vercel Sandbox 新增 fork() 方法,可从任意快照创建隔离环境,简化开发和测试环节。
Vercel Sandbox 新增 fork() 方法,可从任意快照创建隔离环境,简化开发和测试环节。
Vercel Sandbox 现在支持通过 Sandbox.fork() 进行 forking。
fork 从源的当前快照开始,并继承其配置和环境变量。如果源正在运行,它 fork 最新的保存状态,而非实时内存状态。如果源没有快照,则回退到新建,使用源的运行时和配置。任何传递的参数都会覆盖继承的值。
fork 耗时与创建 sandbox 相同,限制也相同。可以用来从共享基础分支一个 agent、为每个租户提供模板的自己副本,或并行运行一个设置的多种变体。
1import { Sandbox } from '@vercel/sandbox';2// Inherit every field from the source's snapshot3const fork = await Sandbox.fork({4 sourceSandbox: 'prod-agent',5});6// Override specific fields; the rest are inherited7const customized = await Sandbox.fork({8 sourceSandbox: 'prod-agent',9 name: 'forked-prod-agent',10 resources: {11 vcpus: 4,12 }13});
sandbox fork prod-agent --name forked-prod-agent --vcpus 4
升级到最新版本:
pnpm install @vercel/sandbox@latest # SDK
pnpm install -g sandbox@latest # CLI
在 Sandbox 文档中了解更多。