Skip to main content

Buyer guide

AI SDK Production Playbook

Pin the AI SDK and choose how model calls reach the API. Limit agent loops and require tool approvals, then register telemetry before launch.

Reading time
3 min read
Sources
23 cited
In this piece
AI SDK+36 Positive

Before an AI SDK feature takes real traffic, pin the version, cap every agent loop, gate risky tools, and register telemetry. A feature can reach users in an afternoon, and teams report that the production work starts after that. The steps also cover how model calls reach providers, how long runs survive restarts, and the provider tests to pass before launch.

When you need this

  • A prototype built with streamText and useChat is about to take real users.
  • Agents will call tools that change data, send messages, or spend money.
  • The team plans to switch or mix model providers after launch.

Evaluation criteria

  1. Pin the line

    Which version are you on, and who upgrades it?

    Look forPin ai and every @ai-sdk package to exact versions from one minor line. AI SDK 7 needs Node.js 22 or later and ESM; Vercel still publishes patches on the 5 and 6 lines, so a team can finish a launch before taking a major. Name an owner for upgrades.

  2. Choose the model path

    Does a model string route through AI Gateway or straight to the provider?

    Look forAI Gateway is the default global provider, so a plain string such as anthropic/claude-sonnet-5.5 goes through Vercel with gateway billing. Import a provider package with your own keys when traffic must go direct, or set gateway budgets and data controls first; the AI Gateway guide covers both.

  3. Bound every loop

    What stops a tool loop that keeps going?

    Look forSet stopWhen explicitly. ToolLoopAgent defaults to 20 steps, while WorkflowAgent has no default limit. Add AI SDK 7 timeouts per run, step, chunk, and tool. Pass the request's abort signal. One developer calls its absence the most common production bug. A 2026 issue showed generateText returning normally after a mid-loop abort.

  4. Gate risky tools

    Which tool calls need a person or a policy to approve them?

    Look forSet toolApproval on each tool. Require user approval for data changes and use approval functions for policy checks. Enable signed approvals on high-risk tools and test resume. A June 2026 issue broke every signed approval on resume until a fix shipped. On October 23, 2026 Vercel shipped a first-party web fetch tool, @ai-sdk/tool-web-fetch, exported as experimental_createWebFetchTool and requiring Node.js 22.13 or later. Vercel's docs warn that fetched pages are untrusted and can contain prompt injections. Domain limits are opt-in and requireUrlInUserMessage defaults to false, so set allowedDomains or turn on requireUrlInUserMessage, and require approval when the agent can reach private data. The tool blocks private addresses, runs no JavaScript, and rejects PDFs. Before October 22, 2026, toolChoice: 'none' did not stop a tool call the model returned anyway. Versions ai 7.0.149 and 6.0.314 (October 22) and 5.0.281 (October 23) reject such calls before local execution and withhold streamed tool parts. Teams pinned below those versions should upgrade.

  5. Make long runs durable

    What happens to a run when the process restarts mid-task?

    Look forToolLoopAgent keeps state in memory. For runs that outlast a request or wait for approval, use WorkflowAgent on Workflow DevKit. Another option puts SDK calls inside Temporal workflow steps, as Output.ai does. Check the host's function timeout against the longest expected run.

  6. Throttle the UI

    Does the chat stay responsive on long, tool-heavy answers?

    Look forSet experimental_throttle on useChat and test long answers with many tool calls on slower machines. Developers report re-render loops when useChat's messages feed a useEffect, and one team left the SDK for a native implementation after slow UI hooks in a production app.

  7. Trace from day one

    Can you see each step, tool call, and its cost?

    Look forRegister telemetry once at startup with @ai-sdk/otel, which follows the OpenTelemetry GenAI conventions, and send it to your tracing tool. Decide whether spans carry prompt and response content before traces leave your network.

  8. Test each provider

    Does every provider you use behave the same through the SDK?

    Look forUse the test model helpers in ai/test for unit tests, and run a small eval per provider before switching. Public GitHub issues show failures specific to one provider. These include Anthropic rejecting valid Zod schemas, reasoning blocks lost across tool steps, and a Bedrock structured-output change that moved one team's failures from 0 to about 10 of 20.

Questions to ask vendors

  1. Which exact version do we run, and who owns the next major upgrade?
  2. Do model calls go through AI Gateway or straight to providers, and who approved that?
  3. What stop condition, timeout, and abort handling does every agent loop have?
  4. Which tools need approval, and have we tested approvals across a resume?
  5. Which providers have passed our eval since the last upgrade?

Red flags

  • Caret ranges on ai or @ai-sdk packages in production.
  • Agent loops with no explicit stop condition or timeout.
  • Tools that change data with no approval step.
  • Switching providers in production without re-running evals.

Products in this piece

Sources

Official documentation
14
Public source
9
  1. AI SDK docs: Migration guide, AI SDK 7.0Official documentationai-sdk.dev
  2. vercel/ai releases on GitHubOfficial documentationgithub.com
  3. AI SDK docs: Choosing a provider (AI Gateway as the default global provider)Official documentationai-sdk.dev
  4. AI SDK docs: Loop controlOfficial documentationai-sdk.dev
  5. AI SDK docs: Tools and tool callingOfficial documentationai-sdk.dev
  6. AI SDK docs: Tools, including the web fetch toolOfficial documentationai-sdk.dev
  7. vercel/ai release @ai-sdk/tool-web-fetch 1.0.0 (Oct 23, 2026)Official documentationgithub.com
  8. vercel/ai release ai 7.0.149, toolChoice 'none' fix (Oct 22, 2026)Official documentationgithub.com
  9. vercel/ai release ai 6.0.314, toolChoice 'none' fix (Oct 22, 2026)Official documentationgithub.com
  10. vercel/ai release ai 5.0.281, toolChoice 'none' fix (Oct 23, 2026)Official documentationgithub.com
  11. AI SDK docs: WorkflowAgentOfficial documentationai-sdk.dev
  12. AI SDK docs: TelemetryOfficial documentationai-sdk.dev
  13. AI SDK docs: TestingOfficial documentationai-sdk.dev
  14. Vercel blog: AI SDK 7 (Jun 25, 2026)Official documentationvercel.com
  15. Umesh Malik: Vercel AI SDK in production (Jul 21, 2026)Public sourceumesh-malik.com
  16. vercel/ai issue #12878: generateText swallows AbortError in a multi-step tool loop (Feb 26, 2026)Public sourcegithub.com
  17. vercel/ai issue #16334: signed tool approvals fail on resume (Jun 23, 2026)Public sourcegithub.com
  18. Hacker News comment on Output.ai's LLM package, a thin wrapper around the AI SDK with Temporal workflow steps (Apr 9, 2026)Public sourcenews.ycombinator.com
  19. vercel/ai issue #4741: useChat messages as a useEffect dependency cause infinite re-renders (Feb 6, 2025)Public sourcegithub.com
  20. Hacker News comment on replacing the AI SDK with a native implementation in a production app (Feb 20, 2025)Public sourcenews.ycombinator.com
  21. vercel/ai issue #14342: Anthropic structured outputs reject valid Zod schemas (Apr 10, 2026)Public sourcegithub.com
  22. vercel/ai issue #11602: Anthropic reasoning blocks lost in multi-step tool calls (Jan 7, 2026)Public sourcegithub.com
  23. vercel/ai issue #17881: Bedrock native structured output degenerates on claude-sonnet-4-6 (Jul 23, 2026)Public sourcegithub.com