AI SDK 6 Beta
Get started with the Beta version of AI SDK 6.
AI SDK 6 is in beta — while more stable than alpha, AI SDK 6 is still in active development and APIs may still change. Pin to specific versions as breaking changes may occur in patch releases.
Why AI SDK 6?
AI SDK 6 is a major version due to the introduction of the v3 Language Model Specification that powers new capabilities like agents and tool approval. However, unlike AI SDK 5, this release is not expected to have major breaking changes for most users.
The version bump reflects improvements to the specification, not a complete redesign of the SDK. If you're using AI SDK 5, migrating to v6 should be straightforward with minimal code changes.
Beta Version Guidance
The AI SDK 6 Beta is intended for:
- Trying out new features and giving us feedback on the developer experience
- Experimenting with agents and tool approval workflows
Your feedback during this beta phase directly shapes the final stable release. Share your experiences through GitHub issues.
Installation
To install the AI SDK 6 Beta, run the following command:
APIs may still change during beta. Pin to specific versions as breaking changes may occur in patch releases.
What's New in AI SDK 6?
AI SDK 6 introduces several features (with more to come soon!):
Agent Abstraction
A new unified interface for building agents with full control over execution flow, tool loops, and state management.
Tool Execution Approval
Request user confirmation before executing tools, enabling native human-in-the-loop patterns.
Structured Output (Stable)
Generate structured data alongside tool calling with generateText and streamText - now stable and production-ready.
Reranking Support
Improve search relevance by reordering documents based on their relationship to a query using specialized reranking models.
Image Editing Support
Native support for image editing (coming soon).
Agent Abstraction
AI SDK 6 introduces a powerful new Agent interface that provides a standardized way to build agents.
Default Implementation: ToolLoopAgent
The ToolLoopAgent class provides a default implementation out of the box:
The agent automatically handles the tool execution loop:
- Calls the LLM with your prompt
- Executes any requested tool calls
- Adds results back to the conversation
- Repeats until complete (default
stopWhen: stepCountIs(20))
Configuring Call Options
Call options let you pass type-safe runtime inputs to dynamically configure your agents. Use them to inject retrieved documents for RAG, select models based on request complexity, customize tool behavior per request, or adjust any agent setting based on context.
Without call options, you'd need to create multiple agents or handle configuration logic outside the agent. With call options, you define a schema once and modify agent behavior at runtime:
The options parameter is type-safe and will error if you don't provide it or pass incorrect types.
Call options enable dynamic agent configuration for several scenarios:
- RAG: Fetch relevant documents and inject them into prompts at runtime
- Dynamic model selection: Choose faster or more capable models based on request complexity
- Tool configuration: Adjust tools per request
- Provider options: Set reasoning effort, temperature, or other provider-specific settings dynamically
Learn more in the Configuring Call Options documentation.
UI Integration
Agents integrate seamlessly with React and other UI frameworks:
Custom Agent Implementations
In AI SDK 6, Agent is an interface rather than a concrete class. While ToolLoopAgent provides a solid default implementation for most use cases, you can implement the Agent interface to build custom agent architectures:
This approach enables you to experiment with orchestrators, memory layers, custom stop conditions, and agent patterns tailored to your specific use case.
Tool Execution Approval
AI SDK 6 introduces a tool approval system that gives you control over when tools are executed.
Enable approval for a tool by setting needsApproval:
Dynamic Approval
Make approval decisions based on tool input:
Client-Side Approval UI
Handle approval requests in your UI:
Auto-Submit After Approvals
Automatically continue the conversation once approvals are handled:
Structured Output (Stable)
AI SDK 6 stabilizes structured output support for agents, enabling you to generate structured data alongside multi-step tool calling.
Previously, you could only generate structured outputs with generateObject and streamObject, which didn't support tool calling. Now ToolLoopAgent (and generateText / streamText) can combine both capabilities using the output parameter:
Output Types
The Output object provides multiple strategies for structured generation:
Output.object(): Generate structured objects with Zod schemasOutput.array(): Generate arrays of structured objectsOutput.choice(): Select from a specific set of optionsOutput.text(): Generate plain text (default behavior)
Streaming Structured Output
Use agent.stream() to stream structured output as it's being generated:
Support in generateText and streamText
Structured outputs are also supported in generateText and streamText functions, allowing you to use this feature outside of agents when needed.
When using structured output with generateText or streamText, you must
configure multiple steps with stopWhen because generating the structured
output is itself a step. For example: stopWhen: stepCountIs(2) to allow tool
calling and output generation.
Reranking Support
AI SDK 6 introduces native support for reranking, a technique that improves search relevance by reordering documents based on their relationship to a query.
Unlike embedding-based similarity search, reranking models are specifically trained to understand query-document relationships, producing more accurate relevance scores:
Structured Document Reranking
Reranking also supports structured documents, making it ideal for searching through databases, emails, or other structured content:
Supported Providers
Several providers offer reranking models:
Image Editing Support
Native support for image editing and generation workflows is coming soon. This will enable:
- Image-to-image transformations
- Multi-modal editing with text prompts
Migration from AI SDK 5.x
AI SDK 6 is expected to have minimal breaking changes. The version bump is due to the v3 Language Model Specification, but most AI SDK 5 code will work with little or no modification.
Timeline
AI SDK 6 Beta: Available now
Stable Release: End of 2025