So i was building a google ai agent to assist me in google email, calendar, sheets, and i found the problem of the AI agent not recognizing any of the gmail tool i want it to use, these tools get bypassed all the way till the end.
My query input:
send an email to [email protected] and ask him for a meeting today afternoon
Output:
“response”:
“json\n{\n "name": "Send_Email",\n "arguments": {\n "emailAddress": "[email protected]",\n "subject": "Request for Meeting Today Afternoon",\n "emailBody": "<div>Hello,<br><br>I hope this email finds you well. I wanted to schedule a meeting today afternoon. Please let me know a convenient time for you.<br><br>Looking forward to your response.<br><br>Best regards,<br>Geng</div>"\n }\n}\n”
From my experience giving arbitrary tasks to agents and just attaching some tools to them doesn’t get you consistent results and is not reliable.
Sometimes it works, sometimes it doesn’t, sometimes it gets into long prompt loops and gets pricey. Also you are limiting your control over the logic flow.
You should really use AI for the things it is good for: Analysis of text and Generating text. Logic can be handled based on the outputs with simple if/switch/loop nodes.
For example this workflow does pretty much what your AI agent is supposed to do but you are not relying on the AI to properly use the tools
Also html is sometimes too complex for the AI without proper context that it is going to be used in an email. Making the AI output simple Markdown and converting it to HTML with the Markdown node is much more reliable, consistent and efficient on the LLM token usage.
You are right. AI sometimes doesn’t understand the situation. If you are planning to use AI for this kind of situations, you should give strict prompt. Still it is a machine. So it needs to be guided. It doesn’t know you are doing this request from n8n and will use that response directly in agent tool. @D_automation as you mentioned, I solve that problem for specific situation with strict prompt and get strict json format. that way I could get necessary response for processing.
Hi @D_automation
it seems that the model deepseek-r1-distill-qwen-32b is still to be considered unstable and doesn’t work properly with tools.
I suggest trying other models available in Groq or using another LLM (OpenAI/Anthropic)
I changed to GPT-4o (openrouter) and successfully carried out the attempt!!
Great thanks to @Ventsislav_Minev@ofs and n8n team for giving priceless advices. I would try out the manual workflow for prompt as well tho, thank you guys so much here ! ! !