Skip to content
PluginStats

ai-sdk-tool-code-execution weekly downloads statistics

By albanese · npm · AI SDKs

Code execution tool for AI SDK that uses Vercel Sandbox.

View on npm Outdated · Oct 28, 2026

ai-sdk-tool-code-execution has 560 recorded weekly downloads on npm, an increase of 233% over the past 30 days, ranking #2235 of 3,247 tracked listings.

Weekly downloads
560
Official API · Dec 5, 2026
7-day growth
+60.5%
+211 weekly downloads
30-day growth
+233%
+392 weekly downloads
90-day growth
+3.5%
+19 weekly downloads
Rank
#2235
▲ 15 in 7 days

About ai-sdk-tool-code-execution

AI SDK Code Execution Tool

A TypeScript package that provides a code execution tool for the AI SDK. Execute Python code in a sandboxed environment using Vercel Sandbox.

Installation

pnpm add ai-sdk-tool-code-execution

Prerequisites

  • A Vercel account with access to Vercel Sandbox (available in Beta on all plans)
  • Vercel CLI installed
  • A Vercel OIDC token for authentication

Setup

1. Link your Vercel project

From your project directory, link to a new or existing Vercel project:

vercel link
2. Pull environment variables

Download your Vercel OIDC token:

vercel env pull

This creates a .env.local file with your VERCEL_OIDC_TOKEN that the SDK uses to authenticate with Vercel Sandbox.

Note: Development tokens expire after 12 hours. Run vercel env pull again when your token expires.

3. Add your AI provider credentials

If using Vercel AI Gateway, add your API key to .env.local:

AI_GATEWAY_API_KEY=your_api_key_here

Usage

import { executeCode } from "ai-sdk-tool-code-execution";
import { generateText, gateway } from "ai";

const result = await generateText({
  model: gateway("openai/gpt-4o-mini"),
  prompt: "What is 5 + 5 minus 84 cubed?",
  tools: {
    executeCode: executeCode(),
  },
});

console.log(result.text);

The executeCode tool allows your AI agent to run Python 3.13 code in a Vercel Sandbox environment. The agent can perform calculations, data processing, and other computational tasks safely in an isolated environment.

Options

Configure the tool with optional parameters:

type CodeExecutionToolOptions = {
  debug?: boolean;
};

Example with debug enabled:

const result = await generateText({
  model: gateway("openai/gpt-4o-mini"),
  prompt: "Calculate the factorial of 10",
  tools: {
    executeCode: executeCode({ debug: true }),
  },
});

When debug is enabled, you'll see detailed logs of code execution in your terminal.

How it works

This package uses Vercel Sandbox to execute Python code in an ephemeral, isolated environment. Each code execution:

  1. Creates a new sandbox with Python 3.13 runtime
  2. Executes your code using python3 -c
  3. Captures stdout, stderr, and exit codes
  4. Automatically stops the sandbox after execution

Important notes

  • Python 3.13 runtime: Code runs in Vercel Sandbox's python3.13 image
  • Not a REPL: You must use print() to see output. Bare expressions produce no output
  • Isolated execution: Each sandbox runs in a secure, ephemeral environment on Amazon Linux 2023
  • Authentication required: Requires a valid Vercel OIDC token
  • Resource limits: See Vercel Sandbox pricing and limits

Alternative authentication

If you cannot use VERCEL_OIDC_TOKEN, you can authenticate with access tokens. Set these environment variables:

VERCEL_TEAM_ID=your_team_id_here
VERCEL_PROJECT_ID=your_project_id_here
VERCEL_TOKEN=your_access_token_here

Find your team ID, project ID, and create an access token in your Vercel dashboard.

Development

Testing locally

Test the tool with the included test script:

pnpm test
Building

Build the package:

pnpm build
Publishing

Update the version in package.json, then publish:

pnpm publish

The package automatically builds before publishing.

Project structure

.
├── src/
│   ├── tools/
│   │   └── execute-code.ts   # Code execution tool implementation
│   ├── index.ts              # Tool exports
│   └── test.ts               # Test script
├── dist/                     # Build output (generated)
├── package.json
├── tsconfig.json
└── README.md

Monitoring usage

Track your sandbox usage in the Vercel dashboard:

  1. Go to your project
  2. Click the AI tab
  3. Click Sandboxes to view execution history and URLs

View compute usage across all projects in the Usage tab of your dashboard.

Learn more

License

ISC

Description from the npm listing.

  • ai
  • ai-sdk
  • tools

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

ai-sdk-tool-code-execution weekly downloads on npm, last 90 days: 560 weekly downloads as of Dec 5, 2026, +3.5% over 90 days.ai-sdk-tool-code-executionWeekly downloads on npm · Last 90 days560downloads / week+3.5% over 90 days02004006008001K1.2K1.4K1.6KSep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
ai-sdk-tool-code-execution weekly downloads on npm, last 90 days: 560 weekly downloads as of Dec 5, 2026, +3.5% over 90 days.

7/30/90-day growth

ai-sdk-tool-code-execution weekly downloads growth on npm: +60.5% over 7 days, +233% over 30 days, +3.5% over 90 days.ai-sdk-tool-code-executionWeekly downloads growth on npm560downloads / week now7-day growth+211 weekly downloads+60.5%30-day growth+392 weekly downloads+233%90-day growth+19 weekly downloads+3.5%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
ai-sdk-tool-code-execution weekly downloads growth on npm: +60.5% over 7 days, +233% over 30 days, +3.5% over 90 days.

Ranking history

ai-sdk-tool-code-execution npm ranking history: currently #2235 (by weekly downloads).ai-sdk-tool-code-executionnpm ranking · by weekly downloads · Last 90 days#2235current rank#1600#1700#1800#1900#2000#2100#2200#2300#2400Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 22 observations · Updated Dec 5, 2026pluginstats.com
ai-sdk-tool-code-execution npm ranking history: currently #2235 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,084 shown · page 112, #15 (overall #2,235)
All npm: every listing in weekly downloads order

Listing placement

AI SDKs378 listings · 19 pages · page 13, #19 (overall #259)
AI SDKs: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (170)
Recent weekly downloads observations for ai-sdk-tool-code-execution
Date (UTC)Weekly downloadsChange vs. previous
560-48
608+71
537+90
447+26
421+12
409+18
391+42
349-51
400-3
403-17
420-3
423+27
396-18
414—

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/ai-sdk-tool-code-execution. First seen Oct 16, 2026; last successful collection Oct 28, 2026. See the methodology.