Packages
Vercel AI SDK v7.0.181 and @ai-sdk/xai v5.0.49: stoppedBy Loop Diagnostics, onWarning Hooks, and MCP Input Fixes
Vercel shipped ai@7.0.181 alongside @ai-sdk/xai@5.0.49 and @ai-sdk/gateway@4.0.154 on November 23, 2026. The updates add stoppedBy loop termination reasons, per-call onWarning hooks, and MCP tool-input preservation for TypeScript AI apps running on Node.js 22+.
8 min read
Vercel AI SDK v7.0.181 and @ai-sdk/xai v5.0.49: stoppedBy Loop Diagnostics, onWarning Hooks, and MCP Input Fixes
Executive Summary
On November 23, 2026, Vercel published ai@7.0.181 alongside synchronized workspace releases including @ai-sdk/gateway@4.0.154, @ai-sdk/workflow@2.0.113, @ai-sdk/workflow-harness@1.0.192, @ai-sdk/vue@4.0.181, and @ai-sdk/xai@5.0.49 / 3.0.154 on GitHub Releases. Distributed on npm under the Apache 2.0 license with a strict Node.js 22+ (ESM-only) runtime floor, ai@7.0.181 focuses on agentic loop observability and MCP/tool-call fidelity rather than breaking API overhauls.
For TypeScript teams building streaming chat interfaces and multi-step tool loops, the release resolves two practical production blind spots: generateText and streamText now expose stoppedBy to report why a tool loop terminated, onWarning surfaces per-call and prompt-conversion warnings inline, and @ai-sdk/xai stops dropping mcpServer and xSearch arguments into empty objects (GitHub Releases).
Adoption Telemetry and Version Changelog
According to npm metadata updated November 24, 2026, and comparative ecosystem tracking by Upstash and Strapi, the ai package maintains a broad footprint in the JavaScript/TypeScript AI stack:
| Package / Ecosystem Metric | Verified Value | Source |
|---|---|---|
| Latest Core Version | ai@7.0.181 (Nov 23, 2026) |
GitHub Releases |
Weekly npm Downloads (ai) |
18,472,668 (~18.5M/wk, Oct 2026 snapshot) |
Upstash |
| npm Package Footprint | 3 direct dependencies, 5,928 dependents, 1,675 versions |
npm (ai) |
GitHub Stars (vercel/ai) |
27,395 (Oct 2026 snapshot) |
Upstash |
| Minimum Runtime Floor | Node.js 22+ (ESM-only; CommonJS dropped in v7) | Strapi |
| License | Apache 2.0 | TanStack AI Docs |
| Provider Surface | ~38–44 first-party provider packages (50+ community) |
TanStack AI Docs / Strapi |
(Note: Upstash's October 19, 2026 snapshot and Strapi's 2026 guide report ~18.5M weekly downloads for ai compared to ~29M for openai, ~2.4M for langchain, and 553,088 for @tanstack/ai; current-day real-time weekly counts on npmjs.com were not returned in snippets.)
What Shipped on November 23, 2026
The November 23 release wave (verified via GitHub Releases and Releasebot) spans core loop diagnostics, xAI MCP tool-call preservation, and companion adapter bumps:
ai@7.0.181(afterai@7.0.180earlier the same day):- Per-call
onWarningcallback (d834c5b): Adds anonWarningcallback at the call level and includes prompt-conversion warnings directly inside step warnings, preventing silent parameter drops when switching between providers. stoppedBytermination metadata (7760e33): AddsstoppedBytogenerateTextandstreamTextresults, theonEndlifecycle hook, and the streamfinishpart so callers can distinguish whether aToolLoopAgentorstopWhenrule halted execution versus the model finishing naturally.- Steering message delivery accounting (
28d17e6): Reports why a run ended for steering messages sent after completion, and counts steering messages as delivered whenprepareStepconverts their text into message parts or attaches provider options. - Extraction telemetry cleanup (
797dc02): StripsproviderOptionsfrom text and file parts in extraction telemetry while preserving arbitrary JSON state and the options actually transmitted to the upstream provider. - Gateway dependency bump (
f2732a6): Updates@ai-sdk/gatewayfrom4.0.153to4.0.154(which also gained headquarters-country provider filtering on November 23 per Releasebot).
- Per-call
@ai-sdk/xai@5.0.49&@ai-sdk/xai@3.0.154:mcpServerandxSearchinput preservation (6f56c29,61ce23e,b8cb0cd): Fixes a bug wheremcpServerandxSearchtool calls returned an empty{}object ininput, preserving the actual MCP and search arguments for logging, UI rendering, and replay.
- Companion Framework & Harness Patches:
@ai-sdk/workflow@2.0.113,@ai-sdk/workflow-harness@1.0.192,@ai-sdk/vue@4.0.181,@ai-sdk/svelte@5.0.180,@ai-sdk/rsc@3.0.180,@ai-sdk/tui@1.0.181,@ai-sdk/tool-web-fetch@1.0.30, and@ai-sdk/tool-bash@1.0.34all shipped synchronized dependency updates on November 23.
Security Hygiene, Breaking Changes, and Internals
Security tracking via HVTracker (checked November 22, 2026 on 7.0.179) lists zero published advisories affecting the ai@7.x line. However, teams upgrading from v5/v6 or integrating v7.0.181 into production pipelines face four architectural and dependency boundaries:
- Node.js 22+ and Pure ESM (
ai@7.x): Version 7 dropped CommonJS entirely and raised the runtime floor to Node.js 22 (following Node 20's April 2026 EOL noted in Strapi). Monorepos still compiling CommonJS ("module": "commonjs") or running older serverless Node runtimes cannot adopt7.xwithout updating their build target. - Deprecation of Vercel AI Elements (
November 2026): According to Vercel's AI Elements documentation, the AI Elements frontend component project is scheduled for deprecation at the end of November 2026, prompting frontend teams to evaluate whether to vendor existing shadcn-based chat components or migrate to headless UI hooks. - Telemetry Redaction & Provider Options (
797dc02): StrippingproviderOptionsfrom text and file parts in extraction telemetry prevents provider-specific routing metadata or secret-adjacent headers from leaking into OpenTelemetry/trace spans while keeping runtime behavior intact. - Loop Control, Steering, and Durable Execution: Vercel AI SDK recommends
ToolLoopAgentwithstopWhen(defaulting tostepCountIs(20)inv6/v7migration docs) andtoolApproval(replacing the deprecatedneedsApprovalflag) for human-in-the-loop pauses, whileWorkflowAgent/@ai-sdk/workflowhandles durable execution across suspended runs (Strapi). With7.0.181,stoppedByand post-run steering delivery reporting (28d17e6) close the observability gap whenprepareSteprewrites injected user steering messages mid-loop.
import { generateText, stepCountIs, tool } from 'ai';
import { openai } from '@ai-sdk/openai';
import { z } from 'zod';
const result = await generateText({
model: openai('gpt-6.1-sol'),
stopWhen: stepCountIs(5),
onWarning: (warning) => {
console.warn('[ai-sdk warning]', warning);
},
tools: {
lookupStatus: tool({
description: 'Check service health by ID',
inputSchema: z.object({ serviceId: z.string() }),
execute: async ({ serviceId }) => ({ serviceId, status: 'healthy' }),
}),
},
prompt: 'Check health for billing-api and summarize.',
});
// New in ai@7.0.181: inspect exact loop termination reason
console.log({ text: result.text, stoppedBy: result.stoppedBy });
Ecosystem Comparison and Upgrade Checklist
TypeScript teams evaluating ai@7.0.181 in late 2026 typically compare it against TanStack AI (1.0), LangChain JS (1.x), and OpenAI Agents SDK (@openai/agents). Using verified specs from TanStack AI Docs, Upstash, and Strapi:
| Capability | Vercel AI SDK (ai@7.0.181) |
TanStack AI (1.0) |
LangChain JS (1.x) |
|---|---|---|---|
| License & Runtime | Apache 2.0; Node 22+ (ESM-only) | MIT; framework-agnostic TS | MIT; Node 20.x–24.x |
| Wire Protocol | Proprietary UI Message Stream (AG-UI via @ag-ui/vercel-ai-sdk) |
Native bidirectional AG-UI | Custom streams (@ai-sdk/langchain bridge available) |
| Type Safety & Bundles | Per-provider packages (~38–44) |
Per-model types; per-activity adapters | Compositional (@langchain/core + providers) |
| MCP Client Support | @ai-sdk/mcp (stable; Streamable HTTP / stdio; no server notifications yet) |
@tanstack/ai-mcp (multi-server pools, generated types, lazy tools) |
@langchain/mcp-adapters (MultiServerMCPClient) |
| Code Isolate Mode | Experimental @ai-sdk/code-mode (QuickJS, Node 22+) |
6 isolate drivers (Node, QuickJS WASM/Bun, Cloudflare, Daytona, E2B) | Sandbox integrations |
| Durable Agent Runs | Workflow SDK on Vercel (@ai-sdk/workflow) |
Detach, journal, takeover, reaper on any sandbox | LangGraph.js checkpointers |
Core API Mapping: Vercel AI SDK vs. TanStack AI
For teams weighing whether to stay on ai@7.0.181 or adopt TanStack AI 1.0 for a greenfield TypeScript app, TanStack AI's migration documentation maps the core primitives directly:
- Model & Text Calls:
streamText()/generateText()map tochat()/chat({ stream: false }), whilegenerateObject()/Output.object()map tochat({ outputSchema }). - Middleware & Lifecycle:
wrapLanguageModel(),onFinish, andprepareStepmap tomiddleware: [...]withonFinishandonConfig. - Stream Serialization & React UI:
result.toUIMessageStreamResponse()pairs withuseChatfrom@ai-sdk/react(returning a 4-statestatus:submitted,streaming,ready,error), whereas TanStack AI usestoServerSentEventsResponse(stream)andfetchServerSentEvents('/api/chat')with native AG-UI events and built-in reconnection (Upstash). - Persistence & Resumable Streams: Vercel AI SDK leaves chat persistence as a custom pattern (
saveChat/loadChat) and requires Redis plusresumable-streamroutes for stream resumption, whereas TanStack AI bundleswithPersistencemiddleware and automatic client reconnection (TanStack AI Docs).
Upgrade and Pinning Checklist for ai@7.0.181
- Verify Node.js & ESM Compatibility: Confirm all CI runners, Dockerfiles, and serverless functions target Node.js 22+ and pure ESM before bumping
aito^7.0.181. - Pin Synchronized
@ai-sdk/*Packages: Always upgradeai,@ai-sdk/gateway(4.0.154),@ai-sdk/workflow(2.0.113), and framework bindings (@ai-sdk/react,@ai-sdk/vue@4.0.181) together so UI Message Stream chunk types stay aligned. - Adopt
stoppedBy&onWarningin Observability: Wireresult.stoppedByinto agent-loop alerting to catch silentstepCountIs()truncations, and logonWarningto surface unsupported provider parameters during model swaps. - Update
@ai-sdk/xaiif Using MCP orxSearch: Upgrade to@ai-sdk/xai@5.0.49(or3.0.154on v3) if your traces or approval UIs inspectmcpServerorxSearchtool inputs. - Plan Around AI Elements Deprecation: Because Vercel's AI Elements project is scheduled for deprecation at the end of November 2026 (AI Elements Docs), audit any
@ai-sdkUI components you depend on and vendor or replace them before locking in long-term frontend templates.
Frequently Asked Questions
What does stoppedBy return in ai@7.0.181?
stoppedBy is exposed on generateText and streamText results, the onEnd callback, and the stream finish part (7760e33), letting applications distinguish between a natural model stop and a stopWhen / step-count termination (GitHub Releases).
Can I use Vercel AI SDK v7 in a CommonJS project or on Node.js 20?
No. Version 7 dropped CommonJS support entirely and requires Node.js 22+ (following Node 20's April 2026 end-of-life) (Strapi). Projects pinned to Node 20 or CommonJS must stay on an earlier major branch or migrate to ESM on Node 22+.
What did @ai-sdk/xai@5.0.49 fix for MCP?
Prior to 5.0.49 (and 3.0.154), mcpServer and xSearch tool calls returned an empty {} object in their input field. The November 23 patch preserves the actual call arguments in input (GitHub Releases).
Should new TypeScript projects pick Vercel AI SDK or TanStack AI?
According to TanStack AI's own comparison, stay on or choose Vercel AI SDK when you want the largest adoption base (~18.5M weekly npm downloads, ~38–44 first-party providers) or already speak its UI Message Stream (@ai-sdk/react). Choose TanStack AI if you want native bidirectional AG-UI, per-model type narrowing, or built-in resumable streams without writing Redis persistence routes.
Are there any known security advisories in ai@7.0.181?
Security tracking on HVTracker (checked November 22, 2026 for 7.0.179) reports zero published advisories on the 7.x line, and 7.0.181 further hardens telemetry by stripping providerOptions from extraction spans (797dc02) (GitHub Releases).
Sources
- GitHub Releases — vercel/ai (
ai@7.0.181,ai@7.0.180,@ai-sdk/xai@5.0.49,@ai-sdk/workflow@2.0.113,@ai-sdk/vue@4.0.181, published Nov 23, 2026): https://github.com/vercel/ai/releases - npm — ai package (
3dependencies,5,928dependents,1,675versions, updated Nov 24, 2026): https://www.npmjs.com/package/ai - TanStack AI Docs — TanStack AI vs Vercel AI SDK (Feature & protocol comparison for
ai@7.xand TanStack AI1.0): https://tanstack.com/ai/latest/docs/comparison/vercel-ai-sdk - Releasebot — Vercel Release Notes (Nov 23, 2026): https://releasebot.io/updates/vercel
- Upstash — Vercel AI SDK vs TanStack AI: A Detailed Comparison (Oct 19, 2026): https://upstash.com/kb/vercel-ai-sdk-vs-tanstack-ai-comparing-type-safety-tools-streaming-and-performance
- Omid Saffari — Vercel AI SDK: What It Is, What It Costs, and How to Start (Nov 24, 2026): https://omidsaffari.com/blog/vercel-ai-sdk
- Strapi — LangChain vs Vercel AI SDK vs OpenAI SDK: 2026 Guide (Jan 29, 2026): https://strapi.io/blog/langchain-vs-vercel-ai-sdk-vs-openai-sdk-comparison-guide
- HVTracker — Vercel AI SDK Trust Score & Safety Signals (Nov 22, 2026): https://hvtracker.net/agents/vercel-ai-sdk/
- Vercel AI Elements Docs — The Vercel AI Frontend Stack (Deprecation notice for end of Nov 2026): https://elements.ai-sdk.dev/docs/vercel-ai-frontend