M
Mastra•4d ago
joofsh

Agent responds to updateWorkingMemory tool calls

Running into an issue with workingMemory enabled where the LLM responds to the updateWorkingMemory tool call, even though it has already provided an appropriate response to the user. This creates an poor experience for the user since the LLM is responding to its own question. I see this thread, but it's relatively old and I'm already on a newer version of mastra than it (v0.23.1).
Do I need to upgrade to v1 beta? Or should I be forcing/preventing the additional LLM call in some other way? Trying to avoid disabling workingMemory since it's otherwise a great feature.
GitHub
mastra-ai/mastra
The TypeScript AI agent framework. ⚔ Assistants, RAG, observability. Supports any LLM: GPT-4, Claude, Gemini, Llama. - mastra-ai/mastra
11 Replies
_roamin_
_roamin_•4d ago
Hey @joofsh ! What model are you using? You could try adding more guidance in your agent's instructions, telling it how it must handle the updateWorkingMemory tool call/result. If you happen to have an example that reproduces this behaviour, please share it with us and we'll have a look šŸ˜‰
joofsh
joofshOP•4d ago
Hey @Romain thanks for getting back to me. Good idea, I'll specifically add instructions for handling this tool call. I'm using gemini-2.5-flash, which maybe is the underlying problem? I can switch to gemini-2.5-pro to gain more reasoning?
_roamin_
_roamin_•4d ago
I know gemini-2.5-flash-lite is sometimes problematic with tool calls, but I thought flash was fine. If the addtional instructions don't work, you can try with pro and see if you see the same behaviour. Keep us posted šŸ˜‰
Mastra Triager
Mastra Triager•3d ago
šŸ“ Created GitHub issue: https://github.com/mastra-ai/mastra/issues/10859 šŸ” If you're experiencing an error, please provide a minimal reproducible example whenever possible to help us resolve it quickly. šŸ™ Thank you for helping us improve Mastra!
Abhi Aiyer
Abhi Aiyer•3d ago
Gemini is 2.5 is trash at tool calling!! First thing to see if the problem occurs with a diff model, something like OpenAI to see the behavior difference We did have problems with this in the past but it comes down to the model quirks
joofsh
joofshOP•3d ago
@Abhi Aiyer Thanks, and I generally agree with you. If I didn't have a ton of GCP credits I would use something else šŸ˜…
Abhi Aiyer
Abhi Aiyer•3d ago
hahaha dude i feel you on the credits What mastra version are you on @joofsh
joofsh
joofshOP•3d ago
0.17.5 . In the process of upgrading to 1.0 beta though. Fwiw, I added additional guidance in my prompt telling it to not respond to updateWorkingMemory tool calls and that seems to have worked for now
Abhi Aiyer
Abhi Aiyer•3d ago
Awesome!
_roamin_
_roamin_•3d ago
Thanks for upgrading, let us know how it goes šŸ˜‰
joofsh
joofshOP•3d ago
what can I say, I like to live dangerously šŸ˜Ž

Did you find this page helpful?