Tool Suspension chunks inside Workflows dropped when using AI SDK

I'm using an agent inside a workflow step that calls a tool that gets suspended.
The workflow is hosted using workflowRoute and consumed on the frontend via AI SDK.
The tool-input-available chunk is correctly received on the frontend, but the tool-call-suspended chunk that contains data to display on the frontend is not received.
While debugging I found that in transformWorkflow if the payload type is workflow-step-output only data-* chunks and chunks listed in isMastraTextStreamChunk are transformed - others are dropped.
tool-call-suspended is not part of that list.
This bug seems to be present in the Stable and the Beta release. I discovered it using the Stable release.
There might be other chunk types that are not included in the list.
Maybe this could be prevented if the same chunk types covered by convertMastraChunkToAISDKv5 were also used in isMastraTextStreamChunk via a shared reference (e.g. an enum). But I don't know if every convertable chunk also counts as a text stream chunk or if there are edge cases for which this is not the case.
GitHub
The TypeScript AI agent framework. ⚡ Assistants, RAG, observability. Supports any LLM: GPT-4, Claude, Gemini, Llama. - mastra-ai/mastra
GitHub
The TypeScript AI agent framework. ⚡ Assistants, RAG, observability. Supports any LLM: GPT-4, Claude, Gemini, Llama. - mastra-ai/mastra
Was this page helpful?