Hey all!
I'm using the supervisor pattern for a multi-turn support chat.
The supervisor classifies intent and delegates to specialized sub-agents (Agent A, Agent B, Agent C). Each sub-agent has its own tools, memory with working memory (thread-scoped)
The issue: Mastra creates a new thread ID for every delegation
Example:
User: "Find record X" → Supervisor delegates to Agent A → agent searches, finds entityId: 401881, saves to working memory, responds
User: "Now update it" → Supervisor delegates to Agent A again → fresh thread → working memory is empty → agent hallucinates entityId: 1
The "fresh thread per invocation" memory isolation means sub-agents can't maintain state between delegations. Entity IDs resolved on turn 1 are gone on turn 2.
We tried messageFilter to clean forwarded context, and direct routing (bypassing supervisor for follow-ups with a persistent thread), but each approach has trade-offs
Questions:
Is there a way to reuse the same thread for a sub-agent across multiple delegations?
Is the supervisor pattern designed for multi-turn conversational sub-agents, or primarily for single-turn tasks?
For ~15 tools total, would a single agent be the recommended approach instead?
Or we are doing something completely wrong?
Thanks!