This course uses AI SDK v6. If you're coming from v5, here are the key breaking changes to be aware of.
convertToModelMessages is now asyncIn v5, convertToModelMessages was synchronous:
// v5const modelMessages = convertToModelMessages(messages);
In v6, it's async and must be awaited:
// v6const modelMessages = await convertToModelMessages(messages);
@ai-sdk/mcpMCP-related imports have moved to a dedicated package:
// v5import { createMCPClient } from 'ai';import { StdioMCPTransport } from 'ai/mcp-stdio';// v6import { createMCPClient } from '@ai-sdk/mcp';import { StdioMCPTransport } from '@ai-sdk/mcp/mcp-stdio';
Output.object for structured generationv6 introduces Output.object as the new way to generate structured objects with generateText and streamText:
import { Output } from 'ai';const result = await generateText({model: openai('gpt-4o'),prompt: 'Generate a recipe',output: Output.object({schema: z.object({name: z.string(),ingredients: z.array(z.string()),}),}),});console.log(result.object); // typed object
generateObject and streamObject still work in v6.
ToolLoopAgent for agentic workflowsv6 adds ToolLoopAgent for multi-step tool calling:
import { ToolLoopAgent } from 'ai';const agent = new ToolLoopAgent({model: openai('gpt-4o'),instructions: 'You are a helpful assistant',tools: { myTool },});
This replaces manual while loops with maxSteps.
This isn't exhaustive—check the AI SDK changelog for full details.