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! 🙏
Was this page helpful?