Skip to content

Integrations

Vercel AI SDK integration

Pass a Promigence sandbox to the Vercel AI SDK as experimental_sandbox, or to bash-tool. The commands your tools run and the files they touch stay in the sandbox, away from your server.

The package is promigence-ai-sdk-sandbox on npm, for TypeScript.

Install

Install it and set your key.

Terminal
npm install promigence-ai-sdk-sandbox @promigence/sdk ai zod bash-tool
export PROMIGENCE_API_KEY=prom_api_...
Language: bash

Example

From the guide Run Vercel AI SDK agents in a Promigence sandbox, which goes on to the spend cap, cleaning up, and what the package does not support.

TypeScript
import { generateText, tool } from "ai";
import { Sandbox } from "@promigence/sdk";
import { promigenceSandbox } from "promigence-ai-sdk-sandbox";
import { z } from "zod";

const sandbox = await Sandbox.create({ timeoutMs: 600_000, spendCap: 1 });
const session = promigenceSandbox(sandbox, { workingDirectory: "/workspace" });

try {
  await generateText({
    model: "anthropic/claude-sonnet-4-5",
    prompt: "run the tests and fix what fails",
    experimental_sandbox: session,
    tools: {
      shell: tool({
        description: "run a shell command",
        inputSchema: z.object({ command: z.string() }),
        execute: async ({ command }, { experimental_sandbox }) => {
          const { exitCode, stdout, stderr } = await experimental_sandbox!.run({ command });
          return `${exitCode}\n${stdout}${stderr}`;
        },
      }),
    },
  });
} finally {
  await session.stop();
}
Language: ts

Next

Get started

Leave your work email and we will get you started.

See our Privacy Policy for how we use your email.