New Tool Radar

AI Agents & Automation

How to Add Simple Memory to an n8n AI Agent Bound to the Chat Session

Attach Simple Memory to an n8n AI Agent node and bind it to the chat session ID so the agent remembers the last few messages in a conversation.

Schematic diagram with three steps: Attach Simple Memory, Bind the session key, then Ask a follow-up.

Without memory, every n8n agent execution starts blank and the agent forgets the previous message. Simple Memory is the built-in fix for a chat agent: it keeps the last few messages of the conversation so the agent can refer back to them.

Before you start

You need a working n8n AI Agent node with a Chat Trigger. Note that Simple Memory lives inside the n8n process, and the node itself warns that it is not compatible with Queue Mode or Multi-Main setups, so use a persistent memory node for those setups instead.

Attach Simple Memory and set the session key

On the AI Agent node, open the Memory slot and attach Simple Memory, which is a Window Buffer memory node. Set the Session Key to the Chat Trigger sessionId value so each chat keeps its own memory. The default Context Window Length is 5, which keeps the last 5 interactions; raise it toward 20 for a real conversation that refers back to earlier turns.

Check the memory with a follow-up question

In the chat panel, ask a first question that names a detail, for example a product name or an order number. Then ask a follow-up that only makes sense if the agent remembers that detail, such as asking for its price without naming it again. If the agent asks you to repeat the detail, check the Session Key first: a wrong key gives every chat the same memory or a fresh one each time.

Worked example: A six-turn chat with a fictional bookshop agent

Maple Books is a fictional bookshop. Its agent uses Simple Memory with a context window of 20. The test chat shows what the agent should remember.

Turn User message Agent should remember
1 I want a book about bicycle repair. Topic: bicycle repair
2 Something under 30 dollars. Budget: under 30 dollars
3 Is it in stock? It refers to a bicycle repair book under 30 dollars
4 Who wrote it? It refers to the same book
5 Add it to my list. It refers to the same book
6 What was the budget again? Under 30 dollars

Expected result (UNTESTED): turns 3 to 6 are answered without asking the user to repeat the topic or the budget, because the last 5 interactions are in memory. We checked the n8n tutorial, which records the Simple Memory default of 5 interactions and the sessionId binding, but we did not run the chat on a live n8n instance.

Limits

Simple Memory only keeps the last few messages, so a long conversation still loses early details. It does not survive a restart in the way a database-backed memory node does, and it is not compatible with Queue Mode or Multi-Main setups. For durable memory across days, use Postgres, Redis or another persistent memory node.

Sources

See all