Ai Agent using tools repeatedly

Describe the problem

I am new to n8n and trying to build an AI Agent in n8n to handle categorized customer emails using tools like read database, generate draft, and send mail. However, the agent sometimes triggers tools multiple times (e.g. calling send mail before and after drafting), even when the logic in the prompt is clear.

Information on your n8n setup

  • n8n version: 1.99.1
  • Database (default: SQLite): idk
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: windows 11

Hard to say what’s the problem.
Could be the prompt, could be the used model.
You can try to split up into more agents.
e.g. the first agent analyses the input and rates of its relevant. The second agent creates a draft or a real mail. And the node after that sends the mail (no agent, just a send mail node).