N8n Agent returns the second tool output instead of the actual LLM response (empty reply problem)

Hi everyone,

I’m facing a strange issue with the n8n Agent node when using it with Google Gemini, Simple Memory, and a custom tool.

Inside the Agent execution, the LLM (Gemini) actually generates the correct response on the first call.
However, the Agent runs a second internal step (Simple Memory’s saveContext tool), and this second step returns no text.

The problem:
n8n treats the last tool output as the final result of the Agent — which means the workflow receives an empty message, instead of the actual LLM response.

So the flow only sees the output of saveContext (action + chatHistory) and not the original text response generated by the model.

My setup:

  • Chat Model: Google Gemini

  • Memory: Simple Memory (session key per WhatsApp user)

  • Tool: send_message

  • Agent: Normal Agent configuration

  • The memory tool runs automatically after the LLM generation

What I need:

How can I ensure that the Agent returns only the actual model response, not the memory tool output?

You’re running into a common issue with the n8n Agent node. The Agent, by design, returns the last tool’s output. To get the LLM’s response, you’ll need to adjust your workflow.

Try this: add a “Set” node *after* the Agent node. In the “Set” node, you can select the `response` from the Agent node output and set it to the `message` field. This ensures you’re only passing the LLM’s initial response downstream.