using `writer.custom()` for UI framework integration
Hey team! 👋
I'm trying to implement tool streaming with custom events following the docs here:
https://mastra.ai/en/docs/streaming/tool-streaming#using-the-writer-argument
The docs show using
writer.custom()
for UI framework integration:
However, I'm getting TypeError: writer?.custom is not a function
at runtime.
Environment:
- @mastra/core@0.21.1
(all Mastra packages on 0.21.x)
- Verified with npm list @mastra/core
- all dependencies properly deduplicated
What I found:
Looking at node_modules/@mastra/core/dist/tools/stream.d.ts
, the ToolStream
class only has a write()
method, not custom()
:
Questions:
1. Is writer.custom()
available in 0.21.1, or is this a docs issue?
2. If it's coming in a future release, when can we expect it? (0.21.2, 0.22.0?)
Thanks! 🙏Tool Streaming | Streaming | Mastra
Learn how to use tool streaming in Mastra, including handling tool calls, tool results, and tool execution events during streaming.
5 Replies
I dont know if its related, but I think its similiar to the issue I reported over here https://discord.com/channels/1309558646228779139/1427185080144498709 .
In short, try with alpha for all Mastra packages and see if its gonna work.
But keep in mind maybe its unrelated.
@spo0nman
I see that @mastra/core 0.22.0 • Public • Published 7 minutes ago ... it seems to have
writer.custom()
yeah, seems the released new package
here are full details.
Ward's Finding: transformNetwork() filters custom events (network routing issue) AgentStreamToAISDKTransformer does preserve custom events
my Issue: using agent.stream() (not network), so I should hit the good transformer BUT crashing with: Cannot use 'in' operator to search for 'type' in undefined This happens before it can check for data- prefix
📝 Created GitHub issue: https://github.com/mastra-ai/mastra/issues/9120
GitHub
[DISCORD:1430420806990561311] using
writer.custom()
for UI framew...This issue was created from Discord post: https://discord.com/channels/1309558646228779139/1430420806990561311 Hey team! 👋 I'm trying to implement tool streaming with custom events following th...