How n8n AI Agent Memory Works
An n8n AI agent keeps two kinds of memory. Session memory is already on, episodic memory needs setup, and Simple Memory stores chat history in a workflow.
- published
What memory means for an n8n AI agent
An agent that forgets everything between messages is a poor assistant. The n8n ai agent memory system has two parts. One is already on. The other you switch on yourself. A quick look at the n8n AI agent helps before you dig into memory.
The docs say each conversation with an agent is a session that n8n stores. The agent itself is a loop. The docs say an agent runs a reasoning loop until it produces a final response. The docs say each agent has a language model, instructions, and capabilities you configure. Memory sits beside those parts and feeds the loop what came before.
Session memory: the memory that is already on
The first kind of memory needs no work from you. The docs say session memory is on by default and needs no setup. It keeps the current conversation. The docs say session memory keeps the current conversation and episodic memory recalls earlier sessions.
So the agent can draw on earlier messages in the same conversation.
This answers a common worry. Is memory something you have to set up, or does it just work? Session memory just works. The agent remembers what you said earlier in the same conversation without any setting on your part.
Episodic memory: recalling earlier conversations
Session memory stops at the edge of one conversation. The docs say episodic memory recalls earlier sessions.
Episodic memory does ask one thing of you. The docs say episodic memory needs an OpenAI credential to store and retrieve memories. Without that credential, the agent cannot file anything away for later. With it, the agent can pull up what happened in past sessions.
The docs say an agent can reuse a session so it remembers earlier messages. That is the other route to recall. Reusing a session keeps one thread going, while episodic memory reaches back across many threads.
The Simple Memory node when an agent runs inside a workflow
There is a third piece, and it belongs to a different spot. The docs say the Simple Memory node persists chat history in your workflow. It keeps that chat history inside the workflow itself.
The node has two settings worth knowing. The docs say the Simple Memory Session Key is the key used to store the memory in the workflow data.
The docs say Context Window Length sets the number of previous interactions Simple Memory considers. A short window keeps the agent focused on the last few exchanges. A long window lets it reach further back.
The agent can also act on the outside world while it remembers. Tools are the part that does that, and you can read about them in what an n8n AI agent can do with tools.
When memory does not behave: queue mode
Simple Memory has one hard limit. The docs say not to use Simple Memory when running n8n in queue mode. The docs say Simple Memory fails in queue mode because calls may not reach the same worker.
Queue mode spreads work across workers. A memory stored on one worker is not there when the next call lands on another. If a client runs n8n in queue mode, plan on a different memory approach for agents in workflows.
Where memory fits alongside the agent's other parts
Memory is one part of a bigger machine. The agent has a model, instructions and capabilities. It runs its loop until it has a final answer. Memory feeds that loop the past. Tools give it hands. Instructions tell it what it is for.
One caution from the docs before you ship anything. The docs say agents are in Preview, can make mistakes, and may change their behavior. Build with that in mind, and check the agent's memory behavior before you hand the workflow to a client.