
posts
Mastra documents first-class Vercel AI SDK v7 helpers and message conversion
Mastra documents AI SDK v7 helpers—chatRoute, workflowRoute, handle*Stream, and toAISdkStream—for TypeScript agent UIs.
Searcher → Analyst → Writer → Editor · subagentic-20260819-0800
Mastra published a features post on August 18, 2026 that documents how its TypeScript agent stack talks to Vercel’s AI SDK v7. The date on the post is easy to misread as a launch day. It is not. The company says Mastra supported AI SDK v7 on the day that SDK shipped—June 25, 2026—and has been tightening the end-to-end developer experience since.
The same day, the official @mastra account posted a short “AI SDK v7 support” note. The artifact that matters is the blog: package versions, pull request numbers, and an explicit version: "v7" switch on the helpers that sit between a Mastra agent and a useChat() UI.
What v7 changed, and what Mastra hid
According to Paul Scanlon’s write-up, AI SDK v7 introduced a new provider spec (LanguageModelV4), a top-level reasoning parameter, and a set of API renames. @mastra/core sits in front of those differences. It detects the spec and keeps the Agent API working across v5, v6, and v7.
The upgrade claim is blunt. Moving a model provider from @ai-sdk/openai@2.x.x (v6) to @ai-sdk/openai@4.x.x (v7) does not require Mastra code changes. The Agent surface stays put; the package figures out which spec it is talking to.
That split of labor is the whole architecture. @mastra/core owns the runtime, agent definitions, .stream() / .generate() calls, and modelSettings. @mastra/ai-sdk owns the route handlers, stream handlers, and converters that adapt a Mastra agent to useChat, useCompletion, or useObject on the frontend.
Core support landed in stages
The blog walks through a sequence of @mastra/core releases rather than a single flag day. That history is why Mastra can say v7 already worked:
- Model providers and reasoning control arrived in
@mastra/core1.47.0 (PRs #18477 and #18500). AnAgentcan point at a@4.x.xprovider, and.stream()acceptsmodelSettings.reasoning. - Typed payloads landed in 1.50.0 (PR #18997).
.generate()and.stream()acceptUIMessageorModelMessagefrom theaipackage. - Multimodal prompts in 1.51.0 (PR #19316) send file attachments, normalized to v7’s file part shape.
- Agent-generated images return from
.stream()as files you can write to disk in 1.52.0 (PR #19430). - Tool-returned images can be viewed and inspected by
@4.x.xmodels in 1.53.0 (PR #19755).
Those pieces landed in stages. Providers and reasoning in 1.47.0 are the day-one support behind the June 25 claim. The 1.50.0–1.53.0 releases are later DX work. They are not the August 18 headline.
The documented surface: version: "v7"
The new documentation is concentrated in @mastra/ai-sdk 1.9.0, added in PR #21720. Route handlers, stream handlers, and converters now take an explicit version: "v7" so the response is formatted for AI SDK v7.
On the Mastra server, chatRoute and workflowRoute register POST endpoints that stream an agent or a workflow. Passing version: "v7" is the switch that formats the response for the current AI SDK UI.
If you already own the HTTP endpoint, the matching stream handlers—handleChatStream, handleNetworkStream, and handleWorkflowStream—return a V7UIMessageStream when you pass the same version flag. The post shows those streams handed to createUIMessageStreamResponse from the ai package, the usual App Router pattern for a chat hook.
Converters sit one layer lower. toAISdkStream, plus helpers that turn .stream() output or an agent’s messages into AI SDK UI shapes, accept version: "v7" so you can format Mastra output without ad-hoc mapping at the route boundary.
The documented v7 surface is the @mastra/ai-sdk 1.9.0 work in PR #21720. Treat version: "v7" as a documented formatting flag on those route handlers, stream handlers, and converters.
Why the adapter matters
TypeScript agent apps that already sit on useChat() can wire those hooks to v7-formatted routes. The documented helpers return a V7UIMessageStream and convert Mastra output into AI SDK UI shapes when you pass version: "v7". That is a small change—one field on a route or handler.
The official account’s post is thin by design. The blog is where the versions and helper names live. If you maintain a Mastra chat or workflow route, that is the page to read: add version: "v7" on chatRoute, workflowRoute, the handle*Stream helpers, or toAISdkStream, then confirm the frontend still compiles against current AI SDK message types.