Skip to content
PluginStats

@tanstack/ai-code-mode weekly downloads statistics

By tanstack (53 listings) · npm · AI SDKs

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

View on npm Fresh · Dec 6, 2026

@tanstack/ai-code-mode has 142,105 recorded weekly downloads on npm, a decrease of 19.2% over the past 30 days, ranking #581 of 3,247 tracked listings.

Weekly downloads
142,105
Official API · Dec 5, 2026
7-day growth
+4.8%
+6.5K weekly downloads
30-day growth
-19.2%
-33.8K weekly downloads
90-day growth
+512%
+118.9K weekly downloads
Rank
#581
▼ 8 in 7 days

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 { openaiText } from '@tanstack/ai-openai'
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: openaiText('gpt-6.1-sol'),
  systemPrompts: ['You are a helpful assistant.', systemPrompt],
  tools: [tool],
  messages: [
    { role: 'user', content: 'Compare weather in Tokyo, Paris, and NYC' },
  ],
  threadId: 'thread-1',
})

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: 142,105 weekly downloads as of Dec 5, 2026, +512% over 90 days.@tanstack/ai-code-modeWeekly downloads on npm · Last 90 days142,105downloads / week+512% over 90 days050K100K150K200K250KSep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
@tanstack/ai-code-mode weekly downloads on npm, last 90 days: 142,105 weekly downloads as of Dec 5, 2026, +512% over 90 days.

7/30/90-day growth

@tanstack/ai-code-mode weekly downloads growth on npm: +4.8% over 7 days, -19.2% over 30 days, +512% over 90 days.@tanstack/ai-code-modeWeekly downloads growth on npm142,105downloads / week now7-day growth+6,511 weekly downloads+4.8%30-day growth-33,802 weekly downloads-19.2%90-day growth+118,900 weekly downloads+512%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
@tanstack/ai-code-mode weekly downloads growth on npm: +4.8% over 7 days, -19.2% over 30 days, +512% over 90 days.

Ranking history

@tanstack/ai-code-mode npm ranking history: currently #581 (by weekly downloads).@tanstack/ai-code-modenpm ranking · by weekly downloads · Last 90 days#581current rank#200#300#400#500#600#700Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 17, 2026 – Dec 6, 2026 · 45 observations · Updated Dec 5, 2026pluginstats.com
@tanstack/ai-code-mode npm ranking history: currently #581 (by weekly downloads).

Listing placement

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

Listing placement

AI SDKs378 listings · 19 pages · page 2, #15 (overall #35)
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 (592)
Recent weekly downloads observations for @tanstack/ai-code-mode
Date (UTC)Weekly downloadsChange vs. previous
142,105-10.1K
152,225+1K
151,187-7.1K
158,289+10.6K
147,651+13.3K
134,370-4.8K
139,141+3.5K
135,594+10.9K
124,695-4.8K
129,533+981
128,552-784
129,336+9.1K
120,227+2K
118,220—

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 Dec 6, 2026. See the methodology.