Vercel AI SDK Integration

Runtime Guardrails for Vercel AI SDK

Add blocking and human approval to Vercel AI SDK tool calls before they execute. Full runtime control for your AI applications.

Vercel AI SDK tools execute immediately

As soon as the model calls a tool, it runs. No built-in approval layer means sensitive operations happen automatically. Database writes, API calls, and external integrations all execute without a control boundary.

Without Runplane
Agent decidesTool executesNo control

Wrap tools with runplane.guard()

Intercept tool execution, evaluate against your policies, and control the outcome. Works with any Vercel AI SDK tool — built-in or custom.

agent.ts
import { Shield } from "@runplane/runplane-sdk";
import { generateText, tool } from "ai";

const runplane = new Shield({
  apiKey: process.env.RUNPLANE_API_KEY
});

// Wrap your tool execution with Runplane
const result = await runplane.guard(
  "send_email",
  "vercel-ai-agent",
  { to: params.to, subject: params.subject },
  async () => sendEmail(params)
);

// Or wrap the entire tool definition
const protectedTool = tool({
  description: "Send an email",
  parameters: z.object({
    to: z.string(),
    subject: z.string(),
    body: z.string()
  }),
  execute: async (params) => {
    return runplane.guard(
      "send_email",
      "vercel-ai-agent",
      params,
      () => sendEmail(params)
    );
  }
});

What You Get

Wrap any AI SDK tool

Policy enforcement before execution

Works with streaming and edge functions

How Runplane Works

1

Intercept

guard() intercepts the action before execution

2

Decide

Policy engine evaluates and returns a decision

3

Execute or Halt

Action runs, blocks, or waits for approval

ALLOW
REQUIRE_APPROVAL
BLOCK

Works with All AI SDK Features

generateText
streamText
generateObject
Custom Tools

Start free at runplane.ai

Add runtime control to your Vercel AI SDK agents in minutes. No credit card required.