Skip to content
PluginStats

experimental-ai-sdk-code-mode weekly downloads statistics

By vercel-labs (7 listings) · npm · AI SDKs

QuickJS-backed code mode tool for AI SDK

View on npm Fresh · Oct 17, 2026

experimental-ai-sdk-code-mode has 9,493 recorded weekly downloads on npm, a decrease of 56.9% over the past 30 days.

It ranks #922 of 2,256 tracked npm listings by weekly downloads.

Over 90 days, weekly downloads changed by +100%.

PluginStats has 121 daily observations since Jun 19, 2026; the latest is from Oct 17, 2026.

Weekly downloads
9,493
Official API · Oct 17, 2026
7-day growth
-69.2%
-21.4K weekly downloads
30-day growth
-56.9%
-12.5K weekly downloads
90-day growth
+100%
+4.7K weekly downloads
Rank
#922
Among tracked npm listings

About experimental-ai-sdk-code-mode

AI SDK Code Mode

experimental-ai-sdk-code-mode provides an AI SDK tool that runs JavaScript or type-stripped TypeScript in an isolated QuickJS WASM sandbox. It is meant for agents that need to call several tools, combine their results, run independent tool calls concurrently, or do structured JSON transformations in one step.

Installation

The runtime uses Node.js worker threads and is intended for server-side AI SDK tools, not browser execution.

ai is a peer dependency. The package supports AI SDK 6 stable and AI SDK 7 beta:

Quick Start

What The Model Sees

createCodeModeTool(tools) generates the code-mode tool description from the provided AI SDK tools. The description includes:

• sandbox rules • whether fetch is available, plus the configured fetch policy when present • TypeScript call signatures for every provided tool, including return types when the tool provides an AI SDK outputSchema • examples for calling tools and returning the final value

For example, if you pass search and readDocument, the model sees guidance like this in the code-mode tool description:

Inside code mode, calls look like normal async JavaScript:

JSON.parse and JSON.stringify are available in the sandbox. Returned values and tool inputs/outputs must be JSON-serializable.

API

Returns an AI SDK tool() whose input schema is:

The js string is wrapped in an async function, so top-level await and return are supported:

The package also exports the lower-level runner:

Options

Defaults:

| Option | Default |

| executionPolicy.timeoutMs | 30_000 | | executionPolicy.memoryLimitBytes | 64 * 1024 * 1024 | | executionPolicy.maxStackSizeBytes | 2 * 1024 * 1024 | | executionPolicy.maxResultBytes | 1024 * 1024 | | executionPolicy.maxSourceBytes | 256 * 1024 | | executionPolicy.maxToolInputBytes | 1024 * 1024 | | executionPolicy.maxToolOutputBytes | 4 * 1024 * 1024 | | executionPolicy.maxBridgeRequests | 256 | | executionPolicy.maxInFlightBridgeRequests | 32 | | fetchPolicy | disabled | | fetchPolicy.maxResponseBytes | 1024 * 1024 | | fetchPolicy.allowRedirects | false | | fetchPolicy.maxRedirects | 10 | | approval.mode | "callback" |

Worker-pool size is process-global. By default, code mode uses a dynamic memory-based limit capped at 32 workers. The default admits at least one active invocation, then only admits another worker when available memory can cover the configured QuickJS memory limit plus runtime overhead. Override it explicitly with:

Bundled Worker Assets

Normal Node.js usage does not require worker asset configuration. By default, the package starts an inline Node.js worker from a generated data URL with the QuickJS runtime bundle and asyncify WASM bytes embedded in that worker source, so serverless packagers do not need to preserve sibling worker or WASM files next to the bundled package entry.

If an environment disallows data: URL workers, or if you want to ship an explicit custom worker asset, configure the runtime before starting code-mode invocations:

Custom workers must be self-contained. The package does not publish worker or WASM asset subpaths.

Concurrency

Code mode uses a bounded worker pool. Each active invocation checks out one worker and creates a fresh QuickJS module, runtime, and context for that run. When the run completes normally, the worker returns to the idle pool. When a run times out, aborts, or the worker fails, that worker is retired and replaced on a future invocation.

The worker boundary is intentional. QuickJS can suspend while host tools execute, so each active invocation still needs an independent asyncified QuickJS/WASM instance. Workers also give the host a hard termination boundary for runaway code; instantiating multiple WASM modules in the main thread would preserve asyncify independence, but it would not provide the same event-loop isolation or reliable timeout kill path.

Tool calls inside one sandbox can also run concurrently:

Use setMaxWorkers to cap the number of active pooled workers. When the limit is reached, new invocations fail with CodeModeConcurrencyError. The slot stays occupied until the sandbox result and any accepted host bridge work have settled or observed abort, so detached host work cannot silently outlive accounting.

Every tool or fetch promise created inside code mode must be awaited or otherwise handled before returning. An unawaited bridge call fails with CodeModeDetachedBridgeRequestError; an observed bridge call that is still pending when the script returns is aborted and also fails the invocation. maxBridgeRequests limits total bridge calls per invocation, and maxInFlightBridgeRequests limits concurrent tool/fetch calls inside one sandbox.

Tool Semantics

Nested tool calls preserve the important AI SDK behavior:

• tool inputs are validated against each tool's inputSchema • execute receives forwarded ToolExecutionOptions, including abort signals • nested calls get derived toolCallId values for tracing • thrown tool errors are propagated • async iterable tool outputs are consumed and the final output is returned • tools without execute are rejected • unknown tools fail clearly

Only top-level tool names are intended for the public API:

Observability

Code mode exposes nested bridge activity without parsing generated code or final tool results. Lifecycle hooks fire for nested tool calls, nested tool results, fetch requests, fetch results, interrupts, and the final per-invocation trace:

Lifecycle hook errors are isolated from sandbox execution. Provide lifecycle.onHookError if hook failures should be recorded.

For OpenTelemetry, pass an OTEL-compatible tracer:

This emits spans for the outer code-mode invocation and each nested tool/fetch bridge request. Raw source, inputs, and outputs are not recorded; telemetry attributes include names, ids, status, replay flags, and byte sizes. Set recordInputs: false or recordOutputs: false to omit size attributes for those directions.…

Description from the npm listing.

  • ai-sdk
  • agents
  • code-mode
  • quickjs
  • sandbox
  • tools

Where experimental-ai-sdk-code-mode sits in the listing

Each band is one page of 20. Weekly downloads on a log 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.

All npm2,256 listings · 113 pages · page 47, #2 (overall #922)
All npm: every listing in weekly downloads order
PNG SVG
AI SDKs250 listings · 13 pages · page 3, #17 (overall #57)
AI SDKs: every listing in weekly downloads order
PNG SVG

Charts

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

Adoption over time

experimental-ai-sdk-code-mode weekly downloads on npm, last 90 days: 9,493 weekly downloads as of Oct 17, 2026, +100% over 90 days.experimental-ai-sdk-code-modeWeekly downloads on npm · Last 90 days9,493downloads / week+100% over 90 days010K20K30K40KJul 19Aug 3Aug 18Sep 2Sep 17Oct 2Oct 17downloads / weekobservedarchived (Internet Archive)no observationsJul 21, 2026 – Oct 17, 2026 · 89 observations · Updated Oc…pluginstats.com
experimental-ai-sdk-code-mode weekly downloads on npm, last 90 days: 9,493 weekly downloads as of Oct 17, 2026, +100% over 90 days.
PNG SVG

7/30/90-day growth

experimental-ai-sdk-code-mode weekly downloads growth on npm: -69.2% over 7 days, -56.9% over 30 days, +100% over 90 days.experimental-ai-sdk-code-modeWeekly downloads growth on npm9,493downloads / week now7-day growth-21,362 weekly downloads-69.2%30-day growth-12,516 weekly downloads-56.9%90-day growth+4,749 weekly downloads+100%Growth vs. nearest observation to each baseline date · Updated Oct 17, 2026pluginstats.com
experimental-ai-sdk-code-mode weekly downloads growth on npm: -69.2% over 7 days, -56.9% over 30 days, +100% over 90 days.
PNG SVG

Ranking history

experimental-ai-sdk-code-mode npm ranking history: currently #922 (by weekly downloads).experimental-ai-sdk-code-modenpm ranking · by weekly downloads · Last 90 days#922current rank#918#919#920#921#922#923#924Jul 21Aug 5Aug 20Sep 4Sep 19Oct 4Oct 19rankOct 18, 2026 – Oct 19, 2026 · 2 observations · Updated Oct 17, 2026pluginstats.com
experimental-ai-sdk-code-mode npm ranking history: currently #922 (by weekly downloads).
PNG SVG

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.

Recent observations

Full history (121)
Recent weekly downloads observations for experimental-ai-sdk-code-mode
Date (UTC)Weekly downloadsChange vs. previous
9,493-2.7K
12,160-4.5K
16,666-6.9K
23,592-7.4K
30,9580
30,958-1.6K
32,518+1.7K
30,855+1.4K
29,455+3K
26,420+1.9K
24,476+1.1K
23,332-5.2K
28,535+742
27,793—

Similar npm AI SDKs plugins

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/experimental-ai-sdk-code-mode. First seen Oct 16, 2026; last successful collection Oct 19, 2026. See the methodology.