M
Mastraโ€ข2w ago
Aman Zishan

Question: are data- events persisted in mastra when used with ai-sdk?

My setup leverages chatRoute and useChat from ai-sdk, i use data- partial events to expose deeply nested workflow step updates all the way to the supervisory agent stream generative UI. But upon fetching messages from storage and converting to UIMessages i don't see the emitted events persisted and hence the components are not rendered when i refresh the chat. I'm on v1 beta
6 Replies
Mastra Triager
Mastra Triagerโ€ข2w ago
๐Ÿ“ Created GitHub issue: https://github.com/mastra-ai/mastra/issues/10477 ๐Ÿ” If you're experiencing an error, please provide a minimal reproducible example whenever possible to help us resolve it quickly. ๐Ÿ™ Thank you for helping us improve Mastra!
Ward
Wardโ€ข2w ago
@Aman Zishan currently we do not persist them, but we actually should. This woudl help with ui creation as you mentioned
Aman Zishan
Aman ZishanOPโ€ข2w ago
Agreed, right now it feels weird to see them dissappear on load; i had a convo here as well https://discord.com/channels/1309558646228779139/1440648045082578974 @Ward should i raise a feature request so i can track the timeline? It works very nicely with UI creation; no need to bloat the agent context will non functional tool calls just to render a component in client. If those events could be persisted would be really great
_roamin_
_roamin_โ€ข2w ago
Hey @Aman Zishan ! You can actually just follow the github issue above ๐Ÿ˜‰ (https://github.com/mastra-ai/mastra/issues/10477)
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 ...
arpitBhalla
arpitBhallaโ€ข7d ago
Are you planning to keep it in same message with parts type data-*?
Aman Zishan
Aman ZishanOPโ€ข7d ago
I would expect the behaviour to be same as when its streamed so we can avoid a post process after stream. Just like how tool-call is persisted

Did you find this page helpful?