Hi everyone.
I'm starting my first project with Mastra.
I love the idea of the working memory, progressively capturing more and more knowledge about the user. I think it's great.
I'm trying to figure out the best pattern to use it in a multi-agent system.
My project will have multiple agents, each dedicated to different tasks. The user will interact with a single chatbot UI, but behind the scene, the incoming messages will be seamlessly dispatched to the right agent.
My question is: how do you integrate the working memory and user profile in that pattern? Configuring the instructions on each agent to ensure the user profile is properly captured seems like a poor design solution. I'd have to duplicate instructions across agents and also start assigning multiple responsibilities per agent.
I would prefer having a dedicated agent which receives a copy of all communication and is responsible to updating the profile for all other agents (think 1 write, multiple reads, just like DBs and replicas). But that patterns doesn't seem to fit the Mastra concepts either. For one thing, messages end up being duplicated in the working memory because 2 agents process the same request.
Any recommendations?