TanStack AI

Build type-safe streaming, tool-calling, and multimodal apps across AI providers.

Source repo
TanStack/ai
Stars
★ 3.4k
Last updated
1d ago @tanstack/[email protected]
FARS reviewed
Nov 08, 2026 +65 new
License
MIT
Primary language
TypeScript

At a glance

How it runs
Library / SDKFramework
Works with
Universal · cross-platformOpenAI API · Claude APICodex · Claude Code (Partial support)
Cost
Free software; you pay for model usage
Setup effort
Medium · a few setup steps
You'll need
TypeScriptpnpmSelected provider and framework packagesShell / CLINetwork access
Typical use
A React, Vue, Svelte, Solid, or Preact team adding streaming chat with typed messages and tool calls to an existing application.
Not a fit if
  • Teams wanting a ready-hosted chat product; you build the app, server, and deployment
  • Teams committed to a single vendor model and unwilling to manage adapter packages
Website
tanstack.com/ai/latest ↗ set on GitHub
Maintenance
Commits in the last 30 dayslast commit 2026-12-02latest release @tanstack/[email protected] (2026-11-20)+2.0 ★/day over 7 days
Source review
60/100 · Some gaps

What does this agent do, and when should you use it?

TanStack AI is a TypeScript SDK built around composable activities and provider adapters for streaming chat, tool-calling agents, structured output, realtime voice, and media generation. Its core @tanstack/ai package supplies APIs such as chat() and toolDefinition(), while separate adapters connect OpenAI, Anthropic, Gemini, Ollama, Grok, Groq, ElevenLabs, BytePlus, fal.ai, and OpenRouter. The client layer includes the headless @tanstack/ai-client package and native bindings for React, Solid, Vue, Svelte, and Preact. It handles text, images, audio, video, and documents, with structured results backed by JSON Schema, Zod, ArkType, or Valibot. The library runs inside the adopter's frontend or server application rather than as a hosted product; model access, credentials, hosting, and costs remain tied to the selected adapters. It is a fit for TypeScript teams that value provider portability and typed contracts and are prepared to own application integration and deployment.

An application passes messages to chat() and selects a model through an activity adapter such as openaiText(); toServerSentEventsResponse() can expose the resulting stream as a server-sent events response. toolDefinition() declares a shared input and output schema, then attaches a server or client implementation with .server() or its client counterpart. Supplying outputSchema makes a chat call produce an object constrained through JSON Schema, Zod, ArkType, Valibot, or plain JSON Schema. Generation clients use a shared pattern to call image, audio, video, speech, transcription, and summarization services, while realtime adapters handle voice sessions and token minting. Code Mode lets a model write and execute TypeScript in an isolated sandbox to orchestrate tools with loops, branches, and parallel calls. Devtools, typed observability events, usage and error reporting, and OpenTelemetry traces expose messages, tool calls, and stream chunks for inspection.

  1. A React, Vue, Svelte, Solid, or Preact team adding streaming chat with typed messages and tool calls to an existing application.
  2. A TypeScript backend team that wants server and client tools to share one toolDefinition() input and output contract.
  3. A product team that expects to switch among OpenAI, Anthropic, Gemini, Ollama, or another documented adapter.
  4. A developer who needs model responses validated as Zod, ArkType, Valibot, or JSON Schema objects instead of free-form prose.
  5. A multimodal application combining image, video, speech, transcription, audio, or summarization workflows under one generation-client pattern.
  6. An advanced AI application that needs realtime voice, Code Mode orchestration, devtools, or OpenTelemetry observability.

Key setup facts

Pulled from the install and usage notes below. The project README has the current values.

Install / run
  • pnpm add @tanstack/ai @tanstack/ai-openai
  • pnpm add @tanstack/ai @tanstack/ai-client @tanstack/ai-react @tanstack/ai-openai
  • pnpm add @tanstack/ai @tanstack/ai-openrouter
Config files
request.json

How do you install or deploy this agent?

Install the core package and OpenAI adapter:

pnpm add @tanstack/ai @tanstack/ai-openai

For React streaming chat, also install the client and React packages:

pnpm add @tanstack/ai @tanstack/ai-client @tanstack/ai-react @tanstack/ai-openai

To reach multiple models through one API entry point, install the OpenRouter adapter:

pnpm add @tanstack/ai @tanstack/ai-openrouter

The supplied material does not state a Node.js version or document provider credential variable names and setup. Those access details must be supplied for the selected adapter before it can make provider calls.

How do you use this agent?

Create a chat stream in a TypeScript server route that supports standard Request, Response, and server-sent events:

import { chat, toServerSentEventsResponse } from '@tanstack/ai'
import { openaiText } from '@tanstack/ai-openai'

export async function POST(request: Request) {
  const body = await request.json()

  const stream = chat({
    adapter: openaiText('gpt-5.2'),
    messages: body.messages,
  })

  return toServerSentEventsResponse(stream)
}

The caller sends a JSON request containing messages to this POST endpoint. This example selects the OpenAI adapter and gpt-5.2; the supplied material does not show credential configuration, error handling, or a deployment command.

For typed structured data, add an outputSchema:

import { chat } from '@tanstack/ai'
import { openaiText } from '@tanstack/ai-openai'
import { z } from 'zod'

const Person = z.object({
  name: z.string(),
  age: z.number(),
})

const person = await chat({
  adapter: openaiText('gpt-5.2'),
  messages: [{ role: 'user', content: 'Ada Lovelace, 36' }],
  outputSchema: Person,
})

Safety boundaries, hardening & integrations

Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.

Declared capability surface (blast radius)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Outbound network access

Makes outbound requests; verify telemetry settings and model data routing on private repos.

What are this agent's strengths and limitations?

Pros
  • Official adapters cover OpenAI, Anthropic, Gemini, Ollama, OpenRouter, Grok, Groq, ElevenLabs, BytePlus, and fal.ai, reducing dependence on one provider.
  • toolDefinition() gives server and client implementations a shared, typed input and output contract.
  • One SDK spans streaming chat, structured output, realtime voice, image, audio, video, speech, transcription, and summarization workflows.
  • It includes React, Solid, Vue, Svelte, Preact, and headless clients, with activity-level tree-shaking.
  • Typed observability events, devtools, and OpenTelemetry support expose streams, tool calls, errors, and usage for inspection.
Limitations
  • Adopters must choose, install, and configure provider and framework packages; the supplied material does not provide a complete credential setup.
  • Capability coverage differs by adapter: some focus on chat, while only certain adapters expose image, video, speech, or realtime features.
  • Teams must maintain a TypeScript application, server endpoints, and deployment environment because this is not a ready-hosted chat product.
  • Code Mode executes model-written TypeScript in an isolated sandbox, but the supplied material does not specify its security policy, permission boundary, or deployment requirements.
  • No supported Node.js version, retry strategy, rate-limit handling, or production recovery configuration is documented in the supplied material.

How does this agent compare with similar options?

The project links to a “TanStack AI vs Vercel AI SDK” guide covering architecture, feature coverage, and tradeoffs. The supplied material does not include that guide's findings, so it does not support claims that either option is better on performance, cost, or functionality.

Key facts side by side with the most closely related agents.

Agent Source review Form / cost Stars Updated Language Full support on
TanStack AI This agent 60 · Some gaps Library / SDKFree + model costs ★ 3.4k 1d ago TypeScript OpenAI API · Claude API
Mirascope 50 · Major gaps Library / SDKFree + model costs ★ 1.5k 1d ago Python Claude API
Rig 70 · Some gaps Library / SDKFree + model costs ★ 9.4k today Rust OpenAI API
OpenAI Agents SDK 76 · Good Library / SDKFree + model costs ★ 31k today Python OpenAI API

How does FollowAgents rate this agent?

FollowAgents source review · FARS-2.1
Some gaps
60/ 100 5-point scale 3.0 / 5
This review covers the source as of Nov 08, 2026. The project has shipped 65 stable release(s) since, which have not been re-reviewed. The score and verdict describe the reviewed version only. Recent releases ↓
Trust 14/29
Reliability 5/14
Adaptability 14/18
Convention 12/18
Effectiveness 10/13
Verifiability 5/8
Why each dimension lost points
Trust14 / 29 · 2.4/5

The docs show tools running on the server or client and explain that needsApproval pauses a call until approval; the permissions guide describes rules for paths, commands, modes, and client-exposed settings. Least privilege is supported by mechanisms and examples, but the sample does not establish that defaults constrain every tool. Data flows and sensitive-data choices are disclosed for browser-submitted history, persistence, and sandbox records, but not for every adapter. Evidence for dependency security, rollback, and external-effect controls is limited. The plugin and README identify the TanStack name, repository, and MIT license, while publisher identity remains unknown as specified.

Reliability5 / 14 · 1.8/5

The README, skills, and docs provide many traceable API, installation, and troubleshooting pointers. The migration skill asks readers to check installed versions and source, and the docs state that stateless approvals do not guarantee replay or cross-instance recovery. API names and version examples vary across the sample, while dependency availability and failure handling are only partly covered, so these criteria do not earn higher scores. Properties requiring execution were not scored.

Adaptability14 / 18 · 3.9/5

The skills cover adding AI, migration from existing SDKs, multiple frameworks, models, and media, with trigger phrases and package mapping. The main skill recommends the product broadly for TypeScript projects without an SDK, while also saying to respect an existing SDK and the user's request; the trigger scope is therefore somewhat broad. Environment guidance covers Node, pnpm, Nx, and framework packages, but does not establish support for every deployment environment.

Convention12 / 18 · 3.3/5

The README clearly organizes installation, quick starts, capabilities, adapters, frameworks, and advanced documentation; skills add migration steps, install commands, examples, and cautions. MIT is explicit in metadata. The sample does not show a stable release changelog or clear maintenance ownership. API names and example versions are not fully consistent across files, which lowers the score.

Effectiveness10 / 13 · 3.8/5

The README quick starts, package map, approval guidance, and migration steps are usable for ordinary development, and the adapter-by-activity design describes practical value. The broad feature set requires users to navigate multiple packages, skills, and remote docs; the sample provides no systematic cost or complexity comparison, so cost-benefit is moderate.

Verifiability5 / 8 · 3.1/5

README claims receive partial corroboration from package exports, skill mappings, and concrete approval and persistence docs. The docs specify states, input constraints, and limitations, generally separating mechanisms from advice. The packet is a limited sample and provides neither execution results nor complete implementation for line-by-line verification, so the assessment remains conservative.

Risks and how to mitigate them
  • This is a static sample review; it cannot establish dependency security, runtime correctness, or complete data-handling behavior.
  • The permissions plugin requires application configuration: the docs say tools without a matching rule run without asking, and bypass mode turns off prompts.
  • Approval resumption depends on full message history sent by the client; the docs state that stateless mode provides no replay, exactly-once, or cross-instance guarantees.
Evidence confidence: Low Reviewed Nov 08, 2026 Reviewed revision c32f6417f40d New commits since this review; the score may not cover them
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/tanstack-ai.svg)](https://followagents.com/en/agents/tanstack-ai)
<a href="https://followagents.com/en/agents/tanstack-ai"><img src="https://followagents.com/badge/tanstack-ai.svg" alt="FARS review"></a>

Recent releases

Latest entries from the project's GitHub Releases. Notes are quoted from upstream as written, not rewritten or tested by FollowAgents.

  1. Release notes excerpt
    Minor Changes - [#2197](https://github.com/TanStack/ai/pull/2197) [009b480](https://github.com/TanStack/ai/commit/009b480b9b88c074f1a52ea8eacd8de5ea6432fc) - Users of a local harness can sign in with their own ChatGPT or SuperGrok plan. Add login: codexPlanLogin() or login: grokBuildPlanLogin() to the provider in providerKeys, and /connect:codex or /connect:grok-build runs the device sign-in of the vendor CLI. …
    View on GitHub ↗
  2. Release notes excerpt
    Minor Changes - [#2197](https://github.com/TanStack/ai/pull/2197) [009b480](https://github.com/TanStack/ai/commit/009b480b9b88c074f1a52ea8eacd8de5ea6432fc) - Users of a local harness can sign in with their own ChatGPT or SuperGrok plan. Add login: codexPlanLogin() or login: grokBuildPlanLogin() to the provider in providerKeys, and /connect:codex or /connect:grok-build runs the device sign-in of the vendor CLI. …
    View on GitHub ↗
  3. Release notes excerpt
    Patch Changes - Updated dependencies \[[4b00243](https://github.com/TanStack/ai/commit/4b002432487ce34547162b6f3f0492b4b936aa61), [009b480](https://github.com/TanStack/ai/commit/009b480b9b88c074f1a52ea8eacd8de5ea6432fc)]: - @tanstack/[email protected] - @tanstack/[email protected] - @tanstack/[email protected] - @tanstack/[email protected]
    View on GitHub ↗

FAQ

Do I have to use OpenAI?
No. Documented adapters include Anthropic, Gemini, Ollama, OpenRouter, Grok, Groq, ElevenLabs, BytePlus, and fal.ai, and the SDK supports runtime adapter switching.
Does the package include hosting or model usage?
It is described as an SDK, not a hosted service. Model access, deployment, and charges depend on the chosen provider; only the OpenRouter entry explicitly mentions per-request cost tracking.
Can tools run in the browser?
toolDefinition() can attach server or client implementations to the same contract. The material does not prescribe where sensitive operations or permissions should be placed.
Can it run without a frontend framework?
Yes. A Server Only quick start is listed for endpoints, scripts, and backend services, and @tanstack/ai-client provides a headless client.
Does it integrate with Codex and Claude Code?
The Agent Skills documentation explicitly says TanStack AI skills can be installed into Codex, Claude Code, and other coding agents. The supplied material does not show that these integrations expose every SDK capability, so compatibility is assessed as partial.
Was this page helpful?
View on GitHub ↗ Install ↓

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related concepts