ai-sdk

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

Updated May 23, 2026
One-click install
npx skills add https://github.com/BMS-kmusial/bms-stream-monitor --skill ai-sdk-bms-kmusial
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-sdk
Source: https://github.com/BMS-kmusial/bms-stream-monitor/tree/main/packages/code-reviewer/.agents/skills/ai-sdk
Command: npx skills add https://github.com/BMS-kmusial/bms-stream-monitor --skill ai-sdk-bms-kmusial

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? AI SDK APIs change frequently, and outdated knowledge leads to deprecated parameters, broken type errors, and incorrect model IDs. This Skill forces verification against current documentation and source code so generated AI features compile and run correctly. ## Core Features & Use Cases - Verified API Usage: Searches bundled docs in node_modules/ai/docs and ai-sdk.dev instead of relying on stale training knowledge. - Agent and Chatbot Construction: Builds ToolLoopAgent-based agents with type-safe useChat integration via InferAgentUIMessage. - Migration Error Resolution: Maps deprecated APIs like maxTokens, maxSteps, parameters, and generateObject to their current replacements. - Use Case: A developer asks to add a streaming chat endpoint with tool calling to a React app; the Skill checks the installed ai package docs, fetches current model IDs from the AI Gateway, and produces type-safe code that passes typecheck. ## Quick Start Ask the assistant to build a streaming chat agent with tool calling using the AI SDK and have it verify the current APIs against the installed ai 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 agent with the AI SDK?

Use the ToolLoopAgent pattern with a model, instructions, and a tools map. Search node_modules/ai/docs for the current agent creation API, then export an InferAgentUIMessage type for type-safe consumption with useChat.

How do I fix deprecated AI SDK parameters like maxTokens or maxSteps?

Replace maxTokens with maxOutputTokens and maxSteps with stopWhen: isStepCount(n). Tool definitions now use inputSchema instead of parameters, and generateObject is replaced by generateText with the output option.

Does useChat still manage input state in the AI SDK?

No, useChat no longer manages input state internally. Manage input with useState, configure a DefaultChatTransport, and call sendMessage({ text: input }) on submit.

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

Fetch https://ai-gateway.vercel.sh/v1/models and filter by provider prefix using jq. Never rely on memorized model IDs; always pick the highest version number from the live list.

Why does my AI SDK code fail typecheck after upgrading?

Upgrades rename APIs such as toDataStreamResponse to toUIMessageStreamResponse and tool-invocation parts to typed tool-{toolName} parts. Grep the common-errors reference for the failing property before searching source code.