Chunks in Agent.network()
Is there any way to know what agent publishes a delta-chunk to network?
I catch 'agent-execution-event-text-delta' and stream it to frontend. But I don't want to show in my UI all agents, only chosen
Why I'm not publishing 'routing-agent-text-delta'?
Because, inner agents - show nice markdown, but routing agent - shows something real bad looking mess((
11 Replies
📝 Created GitHub issue: https://github.com/mastra-ai/mastra/issues/9567
GitHub
[DISCORD:1433526558903238686] Chunks in Agent.network() · Issue #9...
This issue was created from Discord post: https://discord.com/channels/1309558646228779139/1433526558903238686 Is there any way to know what agent publishes a delta-chunk to network? I catch 'a...
Hey @Tony Burns ! You're saying you're not seeing
routing-agent-text-delta?I see it, but response throws broken markdown. Inner agents make beautiful headers and lists, but routing - something strange
Would you mind sharing a repro example with us? THanks 🙏
Hi @Tony Burns , before the
agent-execution-event-text-delta events in the stream, you'll get agent-execution-start, which signifies the beginning of an agent execution in the network stream, it contains the id of the agent being executed, you should be able to find it in chunk.payload.agentIdHi @Taofeeq . Thank you for your answer. I've already thought about it. But there is a problem. What if many users send their requests. How to check which request in which state? Should I keep an object in memory to save states? Or mastra already has any mechanism for that?
I'm not sure I fully understand what you mean by many users send their requests
This is one agent.network() for all users of product. So 10 users ask network to answer. Five requests reached the needed agent (for example: final report agent) which started to text-delta which I want to pass to frontend UI, and five are not reached. How can I separate chunks which should reach UI from chunks which shouldn't ?
should I keep in memory myself all events for every user's request?
When you start a stream with agent.network() that stream will be one user's request, and all the primitives associtaed with it. All the chunks in that stream are associated to that task submitted by that user. I don't think you'd need to do any separation there, if I'm understanding correctly what you're trying to do.
Yep, you understood correctly. But I cannot set a flag in script showing the streaming agent because it would influence to all users's requests. That flag should be inside network() function inside Mastra. Or I should set an object {user1: 'agentStreaming1', user2: 'agentStreamingN'} to really know the case
Hmm. Maybe we are talking about something different after all. I'm not sure I understand exactly what you mean by users in this instance and how they exist in the same stream call. Could you elaborate a little bit more on how you're using the agent network?