This guide covers the changes needed when upgrading from AI SDK v5 to v6 withDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/cloudflare/agents/llms.txt
Use this file to discover all available pages before exploring further.
@cloudflare/ai-chat.
Installation
Breaking changes
1. convertToModelMessages() is now async
Add await to all calls:
2. CoreMessage removed
Replace CoreMessage with ModelMessage and convertToCoreMessages() with convertToModelMessages():
3. Tool pattern: server-side tools (recommended)
v6 introducesneedsApproval and the onToolCall callback. For most apps, define tools on the server with tool() from "ai" for full Zod type safety:
tools option on useAgentChat and createToolsFromClientSchemas() on the server are still fully supported:
4. generateObject mode option removed
Remove mode: "json" or similar from generateObject calls.
5. isToolUIPart and getToolName now include dynamic tools
In v6, these check both static and dynamic tool parts. For the old behavior, use isStaticToolUIPart and getStaticToolName. Most users do not need to change anything.
Deprecated APIs
| Deprecated | Replacement |
|---|---|
toolsRequiringConfirmation | needsApproval on server tools |
experimental_automaticToolResolution | onToolCall callback |
addToolResult() | addToolOutput() or addToolApprovalResponse() |
Not deprecated:
AITool, createToolsFromClientSchemas(), extractClientToolSchemas(), and the tools option on useAgentChat are supported for SDK/platform use cases where tools are defined dynamically at runtime.Migration checklist
Update packages
aito^6.0.0@ai-sdk/reactto^3.0.0@ai-sdk/openai(and other providers) to^3.0.0
Move tool definitions to server
Move static tool definitions to server using
tool() (recommended for most apps)Further reading
- Official AI SDK v6 migration guide
- Human in the Loop -
needsApprovalandaddToolApprovalResponse - Client Tools -
onToolCalland auto-continuation