Skip to content
PluginStats

@tanstack/ai-code-mode weekly downloads statistics

By tanstack (52 listings) · npm · AI SDKs

Secure TypeScript Code Mode for TanStack AI agents to execute sandboxed tool orchestration programs.

View on npm Fresh · Oct 18, 2026

@tanstack/ai-code-mode has 54,065 recorded weekly downloads on npm, an increase of 77.3% over the past 30 days, ranking #578 of 2,322 tracked listings.

Weekly downloads
54,065
Official API · Oct 18, 2026
7-day growth
+5.6%
+2.9K weekly downloads
30-day growth
+77.3%
+23.6K weekly downloads
90-day growth
+54.5%
+19.1K weekly downloads
Rank
#578
Among tracked npm listings

About @tanstack/ai-code-mode

<div align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/api/readme/ai.png?theme=dark" /> <source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/api/readme/ai.png" /> <img src="https://tanstack.com/api/readme/ai.png" alt="TanStack AI" width="900" /> </picture> </div> <br />

@tanstack/ai-code-mode

Code Mode for TanStack AI — let LLMs write and execute TypeScript in secure sandboxes with typed tool access.

Overview

Code Mode gives your AI agent an execute_typescript tool. Instead of one tool call per action, the LLM writes a small TypeScript program that orchestrates multiple tool calls with loops, conditionals, Promise.all, and data transformations — all running in an isolated sandbox.

Installation

pnpm add @tanstack/ai-code-mode

You also need an isolate driver:

# Node.js (fastest, uses V8 isolates via isolated-vm)
pnpm add @tanstack/ai-isolate-node

# QuickJS WASM (browser-compatible, no native deps)
pnpm add @tanstack/ai-isolate-quickjs

# Bun servers (native QuickJS via bun:ffi)
bun add @tanstack/ai-isolate-quickjs-bun

# Cloudflare Workers (edge execution)
pnpm add @tanstack/ai-isolate-cloudflare

Quick Start

import { chat, toolDefinition } from '@tanstack/ai'
import { createCodeMode } from '@tanstack/ai-code-mode'
import { createNodeIsolateDriver } from '@tanstack/ai-isolate-node'
import { z } from 'zod'

// Define tools that the LLM can call from inside the sandbox
const weatherTool = toolDefinition({
  name: 'fetchWeather',
  description: 'Get weather for a city',
  inputSchema: z.object({ location: z.string() }),
  outputSchema: z.object({ temperature: z.number(), condition: z.string() }),
}).server(async ({ location }) => {
  // Your implementation
  return { temperature: 72, condition: 'sunny' }
})

// Create the execute_typescript tool and system prompt
const { tool, systemPrompt } = createCodeMode({
  driver: createNodeIsolateDriver(),
  tools: [weatherTool],
})

const result = await chat({
  adapter: yourAdapter,
  model: 'gpt-4o',
  systemPrompts: ['You are a helpful assistant.', systemPrompt],
  tools: [tool],
  messages: [
    { role: 'user', content: 'Compare weather in Tokyo, Paris, and NYC' },
  ],
})

The LLM will generate code like:

const cities = ['Tokyo', 'Paris', 'NYC']
const results = await Promise.all(
  cities.map((city) => external_fetchWeather({ location: city })),
)
const warmest = results.reduce((prev, curr) =>
  curr.temperature > prev.temperature ? curr : prev,
)
return { warmestCity: warmest.location, temperature: warmest.temperature }

API Reference

createCodeMode(config)

Creates both the execute_typescript tool and its matching system prompt. This is the recommended entry point.

Config:

  • driver — An IsolateDriver (Node, QuickJS, QuickJS Bun, or Cloudflare)
  • tools — Array of ServerTool or ToolDefinition instances. Exposed as external_* functions in the sandbox
  • timeout — Execution timeout in ms (default: 30000)
  • memoryLimit — Memory limit in MB (default: 128, supported by the Node, QuickJS, and QuickJS Bun drivers)
  • getSnippetBindings — Optional async function returning dynamic bindings
createCodeModeTool(config) / createCodeModeSystemPrompt(config)

Lower-level functions if you need only the tool or only the prompt. createCodeMode calls both internally.

Advanced

These utilities are used internally and exported for custom pipelines:

  • stripTypeScript(code) — Strips TypeScript syntax using sucrase (edge-safe, no native binary).
  • toolsToBindings(tools, prefix?) — Converts tools to ToolBinding records for sandbox injection.
  • generateTypeStubs(bindings, options?) — Generates TypeScript type declarations from tool bindings.

Driver Selection Guide

DriverBest ForNative DepsBrowserMemory Limit
@tanstack/ai-isolate-nodeServer-side Node.js appsYes (isolated-vm)NoYes
@tanstack/ai-isolate-quickjsBrowser, edge, or no-native-dep environmentsNo (WASM)YesYes
@tanstack/ai-isolate-quickjs-bunBun servers (native QuickJS via bun:ffi)NoNoYes
@tanstack/ai-isolate-cloudflareCloudflare Workers deploymentsNoN/AN/A

Custom Events

Code Mode emits custom events during execution that you can observe via the TanStack AI event system:

EventDescription
code_mode:execution_startedEmitted when code execution begins
code_mode:consoleEmitted for each console.log/error/warn/info call
code_mode:external_callEmitted before each external_* function call
code_mode:external_resultEmitted after a successful external_* call
code_mode:external_errorEmitted when an external_* call fails

Models eval (development)

The benchmark lives in a separate workspace package so @tanstack/ai-code-mode does not depend on @tanstack/ai-isolate-node (avoids an Nx build cycle). See models-eval/package.json (@tanstack/ai-code-mode-models-eval).…

Description from the npm listing.

  • ai
  • ai-sdk
  • typescript
  • tanstack
  • code-mode
  • agents
  • llm
  • tool-calling
  • sandbox
  • isolate
  • code-execution
  • tanstack-intent

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

@tanstack/ai-code-mode weekly downloads on npm, last 90 days: 54,065 weekly downloads as of Oct 18, 2026, +54.5% over 90 days.@tanstack/ai-code-modeWeekly downloads on npm · Last 90 days54,065downloads / week+54.5% over 90 days020K40K60K80K100KJul 20Aug 4Aug 19Sep 3Sep 18Oct 3Oct 18downloads / weekobservedarchived (Internet Archive)no observationsJul 22, 2026 – Oct 18, 2026 · 89 observations · Updated Oc…pluginstats.com
@tanstack/ai-code-mode weekly downloads on npm, last 90 days: 54,065 weekly downloads as of Oct 18, 2026, +54.5% over 90 days.

7/30/90-day growth

@tanstack/ai-code-mode weekly downloads growth on npm: +5.6% over 7 days, +77.3% over 30 days, +54.5% over 90 days.@tanstack/ai-code-modeWeekly downloads growth on npm54,065downloads / week now7-day growth+2,870 weekly downloads+5.6%30-day growth+23,564 weekly downloads+77.3%90-day growth+19,076 weekly downloads+54.5%Growth vs. nearest observation to each baseline date · Updated Oct 18, 2026pluginstats.com
@tanstack/ai-code-mode weekly downloads growth on npm: +5.6% over 7 days, +77.3% over 30 days, +54.5% over 90 days.

Ranking history

@tanstack/ai-code-mode npm ranking history: currently #578 (by weekly downloads).@tanstack/ai-code-modenpm ranking · by weekly downloads · Last 90 days#578current rank#200#300#400#500#600Jul 22Aug 6Aug 21Sep 5Sep 20Oct 5Oct 20rankOct 17, 2026 – Oct 20, 2026 · 4 observations · Updated Oct 18, 2026pluginstats.com
@tanstack/ai-code-mode npm ranking history: currently #578 (by weekly downloads).

Listing placement

All npm2,320 listings · 116 pages · 1,162 shown · page 29, #18 (overall #578)
All npm: every listing in weekly downloads order

Listing placement

AI SDKs259 listings · 13 pages · page 2, #10 (overall #30)
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 (544)
Recent weekly downloads observations for @tanstack/ai-code-mode
Date (UTC)Weekly downloadsChange vs. previous
54,065+11.7K
42,338-3.8K
46,171+4.2K
42,015-10.5K
52,538-6.6K
59,0910
59,091+7.9K
51,195-1.1K
52,291-5.6K
57,923-6.4K
64,330-3.6K
67,912-5K
72,928-9.2K
82,110—

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