Rag agent unusual behaviour

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?

1 Like

@Ankit_Singh

We should be able to work on the system prompt to resolve the issue. Do you have a sample workflow to share?

Try changing the LLM to gpt4 not mini and share your prompt/flow if that doesn’t fix things..the mini models are not reliable for tool based agents in my experience but as it’s happening every 7th run sounds like something in your flow/loop/prompt …