Encountering an issue with my RAG agent

Hello everyone,
I’m running n8n locally using Docker, and I’m encountering an issue with my RAG agent. Specifically, the agent consistently skips tool calls on every 7th user query. This pattern repeats every time.

Context:
My agent is configured with three tools, and for each relevant user query, it’s supposed to call all three tools. However, after every 6 successful tool calls, the 7th query is answered using only memory (i.e. based on previous responses), without invoking any tools. This behavior is incorrect.

After resetting the memory session, the issue repeats again in the same pattern—on the 7th query, the agent responds using its memory instead of calling the tools.

I’m using GPT-4o-mini as the main agent.
Can anyone help me fix this?

Add a Manual Memory Flush or Tool Enforcement

  • Try adding a logic step (like an IF or SET) before the tool execution node to force a tool call on every query, regardless of memory context.
  • Alternatively, you can clear memory manually or reset tool call context every few queries using a counter or flag stored in n8n (e.g. in a Set node or IF node based on $runIndex or $json.counter).

Check for Memory or Tool Token Limits

  • GPT-4o-mini might skip tool calls when internal token or memory thresholds are hit. It could think it “knows the answer” based on memory.
  • To test this, reduce context length, disable memory temporarily, or force tool use by setting force_call: true in tool setup if available.

Hope this helps, cheers mate