Vercel Sandbox Provider
@smthrs/vercel is a first-class Smithers SandboxProvider
backed by the Vercel Sandbox SDK: it
ships a <Sandbox> child workflow’s request JSON into the sandbox workdir,
runs the entry command, and reads the result JSON back. The shared
provider-kit owns request shipping, egress, result parsing, secret scrubbing,
and cleanup; this package supplies only the Vercel createSession seam.
The provider id is vercel-sandbox (VERCEL_SANDBOX_PROVIDER_ID); default
workdir /vercel/sandbox.
Credentials
@vercel/sandbox is an optional dependency, lazily imported inside the
session. Install it to use the real provider:
INVALID_INPUT. These values create the sandbox only, never written into
the request JSON or forwarded into the remote command env.
VERCEL_OIDC_TOKEN, orVERCEL_TOKEN+VERCEL_TEAM_ID+VERCEL_PROJECT_ID.
oidcToken, token, teamId,
projectId).
Usage
Request/result contract
The kit writes the request JSON to.smithers/sandbox-request.json in the
workdir and hands the entry command two env vars:
SMITHERS_SANDBOX_REQUEST_PATH: where to read the request JSON.SMITHERS_SANDBOX_RESULT_PATH: where to write the result JSON.
SMITHERS_SANDBOX_RESULT_PATH: either { bundlePath } or a structured
{ status, output|outputs, patches?, diffBundle?, runId? }. Declared ports
surface their reachable sandbox.domain(port) through a heartbeat.
Factory options
runtime: Vercel Sandbox runtime (defaultnode24).vcpus: vCPU count passed toresources.ports: ports whose domains are surfaced.timeoutMs/maxDurationMs: see duration cap below.persist:stop()(pause) instead ofdelete()on teardown.command: entry command.workdir: default/vercel/sandbox.cleanup:"destroy"(default) or"keep".env: merged into the command env.client/createOptions: inject the SDK class or extraSandbox.createoptions.
Duration and plan cap
Default session timeout: 5 minutes;options.timeoutMs (or
request.toolTimeoutMs) maps to the create timeout. Durations above 5
minutes warn through a heartbeat and call sandbox.extendTimeout(), up to
options.maxDurationMs (default 45 minutes); above that cap, a request throws
INVALID_INPUT instead of overrunning the plan. Raise maxDurationMs for Pro
(up to 5 hours).
Cleanup and cost
Ephemeral sandboxes delete permanently on teardown (cleanup: "destroy", the
default); persist: true calls stop() (pause) instead so it can resume, and
cleanup: "keep" skips teardown entirely. You pay Vercel Sandbox wall-clock
from create to teardown.
createMockVercelSandboxEnvironment(handler, config?) is an in-memory SDK
double for tests. Pass it as options.client; it needs zero credentials, so
unit tests run in CI without touching Vercel.