tanstack-ai

Generate streaming text and orchestrate tool calls across multiple LLM providers.

Updated Apr 4, 2026
One-click install
npx skills add https://github.com/TaherMustansir1929/zainy-water-v3 --skill tanstack-ai-tahermustansir1929
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tanstack-ai
Source: https://github.com/TaherMustansir1929/zainy-water-v3/tree/main/.agents/skills/tanstack-ai
Command: npx skills add https://github.com/TaherMustansir1929/zainy-water-v3 --skill tanstack-ai-tahermustansir1929

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TanStack AI reduces the complexity of integrating multiple LLM providers and building streaming-first chat, agentic, and multimodal features by offering a single, adapter-based SDK with structured output and observability tools. It removes the burden of provider-specific formats, manual streaming handling, and ad-hoc tool orchestration so developers can focus on product UX and business logic.

Core Features & Use Cases

  • Provider-agnostic adapters: Swap OpenAI, Anthropic, Gemini, Ollama and other adapters with the same API to support multi-provider strategies and fallbacks.
  • Streaming-first generation: Stream text with configurable strategies (batch, punctuation, word boundary, composite) for progressive UIs.
  • Tool calling & agent loops: Built-in tool calling with approval workflows and max-iteration controls for safe agentic automation.
  • Structured output & validation: Convert Zod schemas to JSON Schema for typed responses and reliable data extraction.
  • Use Case: Implement a real-time chat UI that streams model responses, calls search/summarize tools when needed, and validates returned data into typed objects for downstream processing.

Quick Start

Install the @tanstack/ai package and a provider adapter, then call generate with your adapter and messages to stream and validate responses.

Frequently Asked Questions about tanstack-ai

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a streaming chat UI with tool calling in React?

To build a streaming chat UI, use a provider-agnostic AI SDK to stream text generations with configurable strategies and orchestrate tool calls. This enables progressive UI rendering and automated tool execution across React environments.

How do I validate structured LLM output using Zod schemas?

Validate structured LLM output by converting Zod schemas to JSON Schema for typed responses. This approach ensures reliable data extraction and validates returned model outputs into typed objects for downstream processing.

Can I switch between OpenAI and Anthropic without changing my application code?

Yes, you can switch between OpenAI, Anthropic, Gemini, and Ollama without changing application code. Provider-agnostic adapters handle provider-specific formats, enabling multi-provider strategies and fallbacks using a single API.

What is the best way to implement agent loops with approval workflows?

Implement agent loops safely by using an AI SDK with built-in tool calling that supports approval workflows and max-iteration controls. This ensures safe agentic automation and prevents infinite tool execution loops.

How do I control text streaming speed for progressive UIs?

Control text streaming speed for progressive UIs by applying configurable streaming strategies such as batch, punctuation, word boundary, or composite. These options manage how text chunks are delivered to the client UI.

Does this AI SDK support Solid and vanilla JavaScript environments?

Yes, the AI SDK supports Solid and vanilla JavaScript environments alongside React. It provides a provider-agnostic, streaming-first API for building chat, agentic workflows, and multimodal features across these frameworks.