▶ Stepthrough All tutorials Blog Glossary Prompts Videos Visual guides Start Learning Free

What is agent memory?

Updated · By Robert Breen

Agent memory is how an AI agent keeps track of earlier messages so it can follow a conversation, for example knowing what "save those" refers to. In n8n it is a sub-node on the AI Agent, such as Simple Memory, that stores recent messages per conversation, identified by a session ID.

Why it matters for a small business

Without memory, every message to an agent starts from zero. That's fine for one-shot jobs but breaks anything conversational: follow-up questions, corrections ("call that one office supplies"), or a customer who replies to an earlier answer.

Memory also has to be kept separate per conversation. If two customers' threads shared one memory, the agent could mix up their details. The session ID is how a memory node tells conversations apart, and picking the right one is a design decision, not a default to ignore.

In a real lesson: AI Email Responder: Draft Gmail Replies Automatically with n8n

In the AI email responder lesson for Greenline Pest Control, a made-up pest control company, you add Simple Memory under the agent so that if Dana writes back, it remembers what it already told her. You leave the defaults and click Execute workflow.

It fails with No session ID found. The memory node is looking for a chat session ID, and an email from a Gmail trigger doesn't have one. You open Session ID, choose Define below and paste {{ $json.threadId }}. Every Gmail conversation has its own thread ID, so memory now keeps one conversation per customer.

The voice-over points out that this beats the common quick fix of deleting the memory node. In chat-based builds like the receipt extractor, the default works because n8n's chat supplies a session automatically, and Simple Memory keeps the last 5 messages of each chat.

Customer email to Greenline Pest Control asking if they cover Maple Grove for ants in the kitchen
Customer email to Greenline Pest Control asking if they cover Maple Grove for ants in the kitchen

Try this lesson free or read the step-by-step guide.

Common confusions

Agent memory vs ChatGPT memory

ChatGPT memory saves facts about you across all your chats. Agent memory in n8n holds the recent messages of one conversation, keyed by a session ID.

Agent memory vs a knowledge base

Memory is what was said in this conversation. A knowledge base is reference information the agent can look up, like prices and policies.

Tips

  • With a chat trigger, the default session usually works. With email, forms or webhooks, set the session ID to something that identifies the conversation, like a thread ID or an email address.
  • Simple Memory lives inside n8n and keeps a short window; for conversations that must survive long gaps or restarts, look at a database-backed memory option.
  • Keep the window short. Long histories cost more and can distract the agent.

Where you use it: free lessons

Visual guide

Agent memory in a few slides, with the same guide written out as text.

All visual guides

Frequently asked questions

What does "No session ID found" mean in n8n?
The memory node can't find an ID for the conversation, usually because the trigger isn't a chat. Set Session ID to Define below and use a field that identifies the conversation, such as the Gmail thread ID.
Does every agent need memory?
No. A one-shot job, like handling a single form submission, works without it. Add memory when people will reply or refer back to earlier messages.

All AI glossary terms, A to Z · Free prompt templates