This guide covers the changes needed when upgrading from AI SDK v4 to v5 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.
If you are on AI SDK v5 and upgrading to v6, see the v6 migration guide instead.
Message format: content to parts
The biggest change. Messages now use a parts array instead of a content string:
You do not need to migrate stored messages manually.
AIChatAgent automatically transforms legacy messages on load via autoTransformMessages(). This handles v4 content strings, tool invocations, reasoning parts, file data, and malformed formats.Import changes
Tool definitions: parameters to inputSchema
Streaming events
v5 addstext-start and text-end events around text deltas, and renames textDelta to delta:
Migration checklist
Migration utilities (deprecated)
These are available but rarely needed since migration is automatic:Further reading
- Official AI SDK v5 migration guide
- v6 migration guide (if upgrading further)