Framework · Agent SDKs

Vercel AI SDK

Provide a free, TypeScript-first toolkit that standardises calls to any model provider with a single API for text generation, structured-object generation, streaming UIs, tool-calling, and multi-step agent loops in TypeScript/JavaScript runtimes including browser, Node.js, and Vercel Edge.

Description

The Vercel AI SDK is the Apache-2.0 TypeScript toolkit from Vercel split into AI SDK Core ('A unified API for generating text, structured objects, tool calls, and building agents with LLMs') and AI SDK UI ('A set of framework-agnostic hooks for quickly building chat and generative user interface'). Core exposes generateText, streamText, and the structured-output siblings generateObject / streamObject driven by Zod, Valibot, or JSON Schema. The agent loop is opt-in via stopWhen (default stepCountIs(20)). UI layer ships useChat and useCompletion hooks for React (plus Vue/Svelte equivalents). Designed for edge runtimes alongside Node.js.

Solution

Imperative TypeScript loop. Caller invokes generateText({ model, tools, stopWhen, ... }) or streamText(...). In each step the model either generates text (loop ends) or calls a tool (executed in-process, observation feeds back in for another generation). Loop terminates when stopWhen is satisfied; default cap stepCountIs(20). No graph DSL, no class hierarchy — just async functions, plain objects, and AbortSignal.

Primary use cases

  • TypeScript agents over multiple LLM providers behind one API
  • streaming chat UIs via useChat / streamText
  • Zod-typed structured outputs
  • MCP tool integration in TypeScript

Open the full interactive page

Diagram, neighbourhood map, code examples, related patterns and full provenance.

Related