AI SDK 3.2: Agents, Embeddings, and a Refined Developer Experience

Vercel has released AI SDK 3.2, a significant update that expands the toolkit for building AI-powered applications. The release focuses on four key areas: laying the groundwork for agentic workflows, broadening model provider support, introducing a unified API for embeddings, and improving the overall developer experience with new utilities and performance optimizations.

Building Multi-Step Agents

As AI models tackle more complex, multi-step tasks, the need for structured agentic workflows grows. AI SDK 3.2 introduces foundational support for building these workflows. For instance, an application designed to analyze product feedback can now orchestrate a sequence of tool calls: first, cleaning the raw input data, then performing sentiment analysis, and finally sending the results to a collaborative platform like Slack. This is achieved through a straightforward addition of tool definitions within the SDK.

In a basic implementation, the model acts as an agent by calling the cleanFeedback tool on the initial userFeedback input. After processing, it summarizes and determines the sentiment of the cleaned data, which it then passes to the sendMessagetoSlack tool to deliver the final report. This feature marks the initial phase of a larger effort to support more autonomous and complex agent logic in future SDK versions.

Expanded Provider Ecosystem and Model Features

The 3.2 update sees the AI SDK integrate with several new model providers, including Azure OpenAI, Google Vertex, Cohere, and a community-maintained integration for Ollama. The team is also keeping pace with model capability upgrades, adding image input support for providers like Anthropic's Claude models and Google's Vertex and Generative AI offerings.

Further expanding its interoperability, the SDK now includes an adapter that allows developers to use LangChain's AI tools and abstractions alongside the AI SDK's UI and streaming features. A complete and current list of supported providers and their specific capabilities is available in the official documentation.

A Unified Approach to Embeddings

To support use cases like retrieval-augmented generation (RAG), this release extends the AI SDK Core's unified API to include embedding generation for OpenAI, Mistral, Azure OpenAI, and Ollama. The SDK includes a cosineSimilarity helper function, enabling developers to easily measure the semantic distance between embedded content. This capability can be used to compare individual values or to embed large batches of data simultaneously during loading, which is a common pattern in vector search applications.

The combination of vision models and semantic similarity opens the door to novel applications, such as semantic image search. A full code example for this use case is available in the semantic image search template.

Enhanced Tooling and Client-Side Chat

This release also provides more insight into AI model interactions. It introduces better tracking of token usage and errors for streamText and streamObject, along with an onFinish callback that reports the stream's final token usage. Furthermore, the streamObject result can now be accessed as a promise, giving developers a type-safe way to work with the final generated object.

A significant shift in this version is the split of the AI SDK UI package by framework. While the 3.2 release is backwards compatible, the SDK recommends migrating to dedicated packages like @ai-sdk/react, @ai-sdk/vue, @ai-sdk/svelte, or @ai-sdk/solid to benefit from a reduced bundle size.

A key outcome of this refactoring is the new ability to build generative UI chatbots entirely on the client-side within React projects using useChat and streamText. This setup supports both client and server-side tool execution. By omitting the execute parameter in a streamText call, a tool is designated for client-side handling. Developers can then use onToolCall within useChat to define client-side functions for these tools.

The new toolInvocations utility provides access to the tools the model has called, enabling both state management and conditional rendering of UI components in response to specific tool calls. The addToolResult function serves to pass user-provided information back to the language model, which is essential for building rich, interactive client-side experiences. These tools combined provide functionality on par with the server-side streamUI function but for client-side architectures.