Mastra Workflow Streaming Issue Vercel AI SDK v5 - Need Help!
Following the workflow streaming docs but can't get it working with Vercel AI SDK's useChat hook. My code (from docs):
// Workflow step - pipe agent to writer
const stream = await agent?.stream(messages, { format: 'aisdk' });
await stream.textStream.pipeTo(writer);
// Endpoint - stream workflow
const stream = run.streamVNext({ inputData: { messages }, format: 'aisdk' });
return stream.toUIMessageStreamResponse(); // ❌ not a function
Stream inspection shows:
MastraWorkflowStream:
- Has toUIMessageStreamResponse: false ❌
- Has toDataStreamResponse: false ❌
- Methods: constructor, status, result, usage
Chunks: workflow-start → workflow-step-start → workflow-step-result
(No workflow-step-output with text chunks)
vs Agent stream (works fine):
AISDKV5OutputStream:
- Has toUIMessageStreamResponse: true ✅
- Emits proper text-delta chunks
Questions:
1. How do I convert MastraWorkflowStream to AI SDK format for useChat?
2. Should pipeTo(writer) emit workflow-step-output events? Not seeing them
3. Is there a transformer utility I'm missing?
Env: @mastra/core ^0.20.2, ai ^5.0.64, @ai-sdk/react ^2.0.2 The streaming docs show pipeTo(writer) but not AI SDK integration. What's the proper pattern here? Thanks! 🙏3 Replies
📝 Created GitHub issue: https://github.com/mastra-ai/mastra/issues/8708
GitHub
[DISCORD:1425910672012742768] Mastra Workflow Streaming Issue Verce...
This issue was created from Discord post: https://discord.com/channels/1309558646228779139/1425910672012742768 Following the workflow streaming docs but can't get it working with Vercel AI SDK&...
Unknown User•2w ago
Message Not Public
Sign In & Join Server To View
Hi @Asaf from Sequence ! We have a PR that will fix these issues, it'll probably be available next tuesday 😉 (the PR you can watch for updates https://github.com/mastra-ai/mastra/pull/8672)