M
Mastraβ€’4w ago
Vulcano

Client SDK for AI-SDK: Chunk Transformers not handling workflow-step-output

Source: https://github.com/mastra-ai/mastra/blob/main/client-sdks/ai-sdk/src/transformers.ts. Is there any reason workflow-step-output is not explicitly handled here? I believe writer.write(...) chunks from (nested) workflow steps do not reach the frontend because of this.
21 Replies
Mastra Triager
Mastra Triagerβ€’4w ago
πŸ“ Created GitHub issue: https://github.com/mastra-ai/mastra/issues/10260 πŸ” If you're experiencing an error, please provide a minimal reproducible example to help us resolve it quickly. πŸ™ Thank you @Vulcano for helping us improve Mastra!
Abhi Aiyer
Abhi Aiyerβ€’3w ago
Hey @Vulcano we are addressing a bunch of missing transforms now
Vulcano
VulcanoOPβ€’3w ago
@Abhi Aiyer awesome thanks!
Ward
Wardβ€’3w ago
In latest release the workflow-step-output should be passed to the frontend if you use data- syntax. We've also have a bugfix for writer.custom that it always bubbles to the stream, no matter where you do it (will go out early next week). https://github.com/mastra-ai/mastra/issues/10260 https://github.com/mastra-ai/mastra/pull/10309 I believe 10260 fixes your issue, if not please let us know. I might have not understood the issue
GitHub
Client SDK for AI-SDK: Chunk Transformers not handling workflow-ste...
This issue was created from Discord post 1440648045082578974: Source: https://github.com/mastra-ai/mastra/blob/main/client-sdks/ai-sdk/src/transformers.ts. Is there any reason workflow-step-output ...
GitHub
feat: ensure data chunks from writer.custom() bubble up through sub...
Description Related Issue(s) Type of Change Bug fix (non-breaking change that fixes an issue) New feature (non-breaking change that adds functionality) Breaking change (fix or feature that wo...
Vulcano
VulcanoOPβ€’3w ago
Thanks @Ward, is this by any chance in a beta somewhere already so I can run my tests?
Abhi Aiyer
Abhi Aiyerβ€’3w ago
Hey @Vulcano i think we'll be able to release this later today
Vulcano
VulcanoOPβ€’3w ago
Sick okay, ill test it tomorrow then (Amsterdam timezone πŸ˜‰ )
Aman Zishan
Aman Zishanβ€’3w ago
I think i'm facing the same issue; will tool-ouput be also fixed ? @Abhi Aiyer
Ward
Wardβ€’3w ago
please use writer.custom if you want to write a custom data- partial. It should work from any primitive in any nesting @Aman Zishan it should if you use .custom
Vulcano
VulcanoOPβ€’3w ago
@Ward does that mean now or always? For me it definitely did not work when I resumed a deeply nested workflow (in a toolcall from an agent haha, so all kinds of bubbling). I will make a repro or smth soon
Aman Zishan
Aman Zishanβ€’3w ago
I tried that and looks like it does not work for resuming a workflow (starting does work ; even nested events) Could it be that writable stream is not passed when a workflow is resumed as seen here? https://github.com/mastra-ai/mastra/blob/b61b93f9e058b11dd2eec169853175d31dbdd567/packages/core/src/workflows/workflow.ts#L1210
GitHub
mastra/packages/core/src/workflows/workflow.ts at b61b93f9e058b11dd...
The TypeScript AI agent framework. ⚑ Assistants, RAG, observability. Supports any LLM: GPT-4, Claude, Gemini, Llama. - mastra-ai/mastra
Aman Zishan
Aman Zishanβ€’3w ago
Cause for me custom events works for simple workflows but does not emit events when they are nested and resumed @Ward Let me know if you want me to open a new thread in any case πŸ™Œ
Ward
Wardβ€’3w ago
i'll do it for you, seems like a bug. @Vulcano the writer.custom should have been fixed in the latest @mastra/core version
Vulcano
VulcanoOPβ€’3w ago
@Ward 0.24.5 doesnt have it fixed yet for me so I will make a repro, maybe its a different issue then
dero
deroβ€’3w ago
Hi @Vulcano We did this fix yesterday https://github.com/mastra-ai/mastra/pull/10447 it should fix issues you are having but with writer.custom usage. It should be out in the next latest release slated for today.
GitHub
fix/workflow step output data chunks by TheIsrael1 Β· Pull Request ...
fix(ai-sdk): propagate custom data chunks from nested workflows in branches to root stream changeset Description Fixes #10260 Fixes #10433 Related Issue(s) Type of Change Bug fix (non-breaking...
Aman Zishan
Aman Zishanβ€’3w ago
I am now able to consume these event chunks, quick question: Are these custom events not persisted in mastra storage? these are mainly used for rendering custom UI right? when i inspects mastra messages these message parts are not saved in DB; although when streams they are correctly added as part in messages using useChat
Vulcano
VulcanoOPβ€’3w ago
@dero very nice, I will try it out whenever that drops πŸ‘
Abhi Aiyer
Abhi Aiyerβ€’3w ago
Hi @Aman Zishan correct we don’t store these data parts, though I’m not sure if we should or not
Aman Zishan
Aman Zishanβ€’3w ago
This ui-dojo https://ui-dojo.mastra.ai/ai-sdk/generative-user-interfaces-with-custom-events example demonstrates utilising custom data parts for rendering UI in chat, if those parts are not persisted within the message parts as expected by ai-sdk DataUIPart standard which is being followed here by data- it's kind of pointless right πŸ€” For a better UX user should be able to see the chat time rendered component when that chat is loaded? If it's not default stored i feel like it should be an option? especially when those chunks are specifically used to render something within the chat
Abhi Aiyer
Abhi Aiyerβ€’3w ago
Well im convinced! Thanks @Aman Zishan !
Abhi Aiyer
Abhi Aiyerβ€’3w ago
GitHub
Persist data- events in mastra Β· Issue #10477 Β· mastra-ai/mastra
This issue was created from Discord post 1442841150250811515: My setup leverages chatRoute and useChat from ai-sdk, i use data- partial events to expose deeply nested workflow step updates all the ...

Did you find this page helpful?