Skip to content

[sandbox-cli] Enable AI Gateway for custom images and coding agents - #382

Open
erulkey wants to merge 3 commits into
mainfrom
elisabeth/sandbox-managed-gateway-20261012
Open

erulkey wants to merge 3 commits into
mainfrom
elisabeth/sandbox-managed-gateway-20261012

Conversation

@erulkey

@erulkey erulkey commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Split into smaller PRs for review, in dependency order:

  1. vercel/sandbox#386: Add managed AI Gateway agent setup
  2. vercel/sandbox#387: Add explicit reusable Gateway key setup

The completed stack preserves this PR’s implementation. This original PR remains open as a reference.


Sandbox applications and coding agents currently need separately supplied model credentials. Add --ai to request a Gateway key for each running session using the caller’s Vercel login and inject it through the external firewall. The managed secret never reaches the CLI or VM.

sandbox create --ai codex
sandbox create --ai
sandbox create --image my-image --ai

On the universal image, the first command configures and launches Codex; bare --ai prepares all four bundled agents without launching one. Custom images keep their application and agent configuration unchanged, including on reconnect. Applications must target Gateway using the placeholder AI_GATEWAY_API_KEY supplied in the VM. Existing shortcuts without --ai retain their authentication behavior.

--ai ignores host and saved keys. Reusing your own key requires --ai --use-gateway-key, which reads host AI_GATEWAY_API_KEY or a key saved by sandbox gateway setup. Missing or rejected credentials fail without silently switching modes. Setup prints the credential mode to stderr unless --silent is set. Caller-owned keys remain bound to their original sandbox and are not revoked on stop.

Managed issuance requires vercel/api#98063 and the team rollout flag. This backend is undeployed, so the default managed flow is not ready for production use. Agent shortcuts require the universal image; runtime and snapshot overrides remain unsupported with --ai.

Validation

300 CLI tests pass with sequential file execution, along with CLI typechecking and CLI/SDK builds. The built CLI, tested against a simulated API, requests managed credentials despite a host key being present, uses that key only with the explicit flag, and preserves API rejection without fallback. Tests also cover stdout/stderr, silent output, failed setup and legacy reconnect. README, generated help and the Sandbox skill are updated.

Earlier personal-Pro live tests verified Gateway inference on universal and non-universal Node images, preservation of custom-image configuration and reconnect. These used caller-owned keys before explicit selection was added; they did not verify managed issuance or cleanup. An earlier Codex launch completed inference and a file action after command approval, but its bundled terminal isolation hit a bubblewrap capabilities error, so unattended tool execution remains unverified.

Release still needs deployed managed lifecycle checks, all-four-agent inference/tool actions and the staging event/permission/authentication prerequisites documented in the backend handoff. Full-day use and startup benchmarks are untested. Parallel suites have intermittently failed an existing mocked credential-concurrency test; this change leaves that code untouched.

@vercel

vercel Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sandbox Ready Ready Preview, v0 Oct 14, 2026 1:11am UTC
sandbox-cli Ready Ready Preview, v0 Oct 14, 2026 1:11am UTC
sandbox-sdk-ai-example Ready Ready Preview, v0 Oct 14, 2026 1:11am UTC
workflow-code-runner Ready Ready Preview, v0 Oct 14, 2026 1:11am UTC

@socket-security

socket-security Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​smol-toml@​1.4.21008210090100
Addednpm/​@​napi-rs/​keyring@​2.1.0941008489100
Addednpm/​@​inquirer/​prompts@​8.7.3991009794100

View full report

}

export function gatewayKeyFingerprint(key: string) {
return createHash("sha256").update(key).digest("hex");

This branch was successfully deployed

4 active deployments
Preview – sandbox — 1281074b Deployed Oct 14, 2026 by vercel[bot]
Preview – sandbox-sdk-ai-example — 1281074b Deployed Oct 14, 2026 by vercel[bot]
Preview – workflow-code-runner — 1281074b Deployed Oct 14, 2026 by vercel[bot]
Preview – sandbox-cli — 1281074b Deployed Oct 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants