how to access sub-agent tool results using ai sdk.
Hi,
We have several agents whose tool results (structured outputs) are displayed on the frontend as intermediate steps. We’re now building a mega-agent that orchestrates these agents and should continue to surface their tool results in the UI. However, the AI SDK stream transformer is dropping those tool results. It currently only forwards data-* custom events from sub-agents, which prevents the tool outputs from coming through. Here are the sub-agent level events (https://mastra.ai/docs/agents/networks#agent-output) and wondering if there is any way of getting access to them. (I am open to writing a custom transformer for the time being)
Agent Networks | Agents | Mastra Docs
Learn how to coordinate multiple agents, workflows, and tools using agent networks for complex, non-deterministic task execution.
9 Replies
📝 Created GitHub issue: https://github.com/mastra-ai/mastra/issues/10238
🔍 If you're experiencing an error, please provide a minimal reproducible example to help us resolve it quickly.
🙏 Thank you @Nageswara for helping us improve Mastra!
Hi @Nageswara, we'll take a look we shouldn't be dropping these
@Nageswara did some research, need some internal discussion to see how we want to surface it. Thanks for bringing it up!
@Nageswara just to be sure, you're using the network route?
yes.
@Nageswara did you find a work-around for this?
i started sending data-* events manually from all the tools for the time being. hoping that the mastra team will address this soon.
I ended up building a whole tree parser for the raw events, which is a bit of a pain. Would love to see better streaming for these deeper nested cases. Otherwise it looks to the user like progress has hung.
we are working on this!
https://github.com/mastra-ai/mastra/pull/10432 should fix it
GitHub
fix network-data by writing the steps in the correct format by ward...
Add support for better data-network structure. Each step is the result of the sub agent,workflow or agent with all necessary tools involved.
Fixes #10238
Summary by CodeRabbit
Chores
Improved st...