Menu

Why did my AI chat stop? Using stoppedBy from AI SDK 7 in a React chat
📰

Why did my AI chat stop? Using stoppedBy from AI SDK 7 in a React chat

DEV Community: nextjs·Cuelark·9 days ago
#FavOPhBG
#devtonextjs#devto#dev#tool#model
Long article (1296 words) — no AI summary yet.
Reading 0:00
15s threshold

By the Cuelark Team. Details come from the Vercel AI SDK release notes and docs, checked on 27 November 2026. We didn't call a real model. Everything below ran against MockLanguageModelV4 from ai/test on [email protected] , so this tests the wiring your app sees, not how any model behaves.

A tool-calling chat can end for very different reasons. The model gave its answer. Your step limit kicked in halfway through a task. A tool is waiting for the user to approve it. Or the model called a tool that only the browser can run. Until now you had to guess which one happened from finishReason , and that field only describes the last model call. A loop that hits its step limit still says tool-calls .

[email protected] , published November 23 (UTC), adds stoppedBy to the generateText and streamText results, the onEnd callback, and the final finish stream part. Per the AI SDK loop control docs it has four values:

model : the model finished without tool calls that keep the loop going.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.