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
Mastra Triager
📝 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!
Abhi Aiyer
Abhi Aiyer4w ago
Hi @Nageswara, we'll take a look we shouldn't be dropping these
Ward
Ward3w ago
@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?
Nageswara
NageswaraOP3w ago
yes.
craigtsmith
craigtsmith3w ago
@Nageswara did you find a work-around for this?
Nageswara
NageswaraOP3w ago
i started sending data-* events manually from all the tools for the time being. hoping that the mastra team will address this soon.
Obsidians
Obsidians3w ago
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.
Ward
Ward3w ago
we are working on this!
Ward
Ward3w ago
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...

Did you find this page helpful?