ai-sdk

Build AI agents, chatbots, and text generation features using the Vercel AI SDK.

Updated Sep 10, 2026
One-click install
npx skills add https://github.com/sharad07072007/paras --skill ai-sdk-sharad07072007
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-sdk
Source: https://github.com/sharad07072007/paras/tree/main/.agents/plugins/vercel/skills/ai-sdk/upstream
Command: npx skills add https://github.com/sharad07072007/paras --skill ai-sdk-sharad07072007

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ai, @ai-sdk/react, @ai-sdk/gateway, @ai-sdk/devtools, and includes references (resource) components.

What problem does it solve? The Vercel AI SDK evolves rapidly, and outdated knowledge leads to deprecated APIs, type errors, and broken code. This Skill forces verification against current documentation and source code, ensuring generated code uses the latest APIs like ToolLoopAgent, generateText, and useChat correctly. ## Core Features & Use Cases - Up-to-date API guidance: Searches bundled docs in node_modules/ai/docs/ and ai-sdk.dev instead of relying on stale training data. - Common error resolution: Maps deprecated patterns (maxTokens, maxSteps, parameters, generateObject) to their modern replacements. - Type-safe agent patterns: Provides end-to-end type safety between ToolLoopAgent definitions and useChat via InferAgentUIMessage. - Use Case: A developer asks to add a streaming chatbot to a Next.js app. The Skill checks the installed ai package version, fetches current model IDs from the Vercel AI Gateway, and generates code using toUIMessageStreamResponse and DefaultChatTransport. ## Quick Start Ask the assistant to build an AI agent with tool calling using the AI SDK and let it verify the current APIs from the installed package docs.

Frequently Asked Questions about ai-sdk

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

FAQPage Schema
How do I build an AI agent with tool calling using the Vercel AI SDK?

Use the ToolLoopAgent class with a model, instructions, and a tools object where each tool defines an inputSchema and execute function. Consume the agent in React with useChat and InferAgentUIMessage for end-to-end type safety.

How do I generate structured output with the AI SDK?

Use generateText with the output option instead of the deprecated generateObject. Pass Output.object with a Zod schema, or use Output.array, Output.choice, or Output.json depending on the shape you need.

Why is maxTokens not working in generateText?

maxTokens is deprecated and replaced by maxOutputTokens. Similarly, maxSteps is replaced by stopWhen with stepCountIs(n), and tool parameters are now defined with inputSchema instead of parameters.

Does useChat still manage input state automatically?

No, useChat no longer manages input state internally. You must manage input with useState, configure a transport like DefaultChatTransport, and call sendMessage to submit messages.

How do I find current model IDs for the Vercel AI Gateway?

Fetch the model list from https://ai-gateway.vercel.sh/v1/models and filter by provider prefix such as anthropic/ or openai/. Never rely on memorized model IDs, and prefer the highest version number available.

How can I debug AI SDK calls locally?

Install @ai-sdk/devtools and wrap your model with devToolsMiddleware. All runs and steps are captured to .devtools/generations.json, which you can inspect directly or view in the web UI at localhost:4983.