Help: Cannot stream anything from workflows after recent update
Setup:
My endpoint:
The problem:
Without writing hundreds of lines of manual stream transformation code to parse
Question:
Is there a built-in option/flag/way to get
- FE:
hook calling Fastify endpointuseChat - BE: Custom endpoint using
run.streamVNext({ inputData })thentoAISdkFormat(workflowStream, { from: 'workflow' }) - Versions:
@mastra/core@0.23.3,@mastra/ai-sdk@0.2.5
My endpoint:
The problem:
toAISdkFormat with from: 'workflow' only emits data-workflow events (workflow metadata). The text I pipe via writer.write() shows up in workflow-step-output within those data-workflow payloads, but it's never extracted into text-delta events that useChat expects.Without writing hundreds of lines of manual stream transformation code to parse
data-workflow events and extract text from nested workflow-step-output, I can't get text streaming to work. This feels like it should "just work" - I'm using the recommended toAISdkFormat utility and piping agent text to the workflow writer as shown in the docs.Question:
Is there a built-in option/flag/way to get
text-delta events from workflow text output? Or is manual transformation the only path forward? If manual, what's the recommended/simplest approach?