Skip to content
TheAgent Ecosystem
AI Agents

n8n Redis Chat Memory: Persistent Memory for Your AI Agent

Store agent history in Redis so it survives restarts and queue mode.

Muhammad Qasim HammadAI-assisted8 min read1,569 words

AI-drafted, reviewed by Muhammad Qasim Hammad on July 11, 2026. See our AI disclosure.

Agent Memory: Persistent Chat Memory
Table of contents
  1. What is Redis Chat Memory in n8n, and when do you need it?
  2. How do you configure the Redis Chat Memory node?
  3. Why choose Redis over Simple Memory or Postgres?
  4. What does Redis chat memory cost to run?
  5. Which memory setup should you actually use?

You wired a chat agent in n8n, restarted the instance, and the conversation started over from nothing. Or you switched on queue mode and every worker remembered a different history. Both problems are the same missing piece: memory that lives outside the workflow process. Redis Chat Memory is n8n's answer, a fast external store for an agent's conversation history that survives restarts and is shared across workers.

This is a setup guide and a decision guide. It covers the exact node fields, how the session key isolates one conversation from another, what Session Time To Live does, and when Redis is the right backend instead of the in-process Simple Memory node.

What is Redis Chat Memory in n8n, and when do you need it?#

Redis Chat Memory is a sub-node that stores an AI agent's conversation history in a Redis database instead of the workflow process. You reach for it when a chat has to survive an n8n restart, when several queue-mode workers must share one history, or when you want old sessions to expire on their own without a cleanup job.

The default memory node, Simple Memory, keeps the last few turns in the workflow process itself. That is perfect for a quick prototype and it needs zero setup, but the history is gone the moment the process restarts, and in queue mode a different worker can pick up the next message with no idea what was said. Redis moves that same window into an external store every worker can read, so the conversation stays durable and consistent no matter which process handles the next turn.

Think of it as two independent decisions. One is how much history you carry, which the Context Window Length controls. The other is where that history lives, which the backend controls. Redis changes only the second decision. A common mistake is to assume that moving memory to Redis makes the agent remember more; it does not. It makes the same window durable and shareable, and that is usually exactly what a real chatbot needs once it leaves your laptop.

Checklist of signals that Redis is the right chat-memory backend for an n8n agentIf any of these are true, the in-process window is not enough and an external store earns its keep.

How do you configure the Redis Chat Memory node?#

Add the Redis Chat Memory sub-node to your AI Agent, attach a Redis credential, then set three fields. Session Key names the memory bucket, Context Window Length caps how many past turns are re-sent, and Session Time To Live sets how many seconds a conversation survives before Redis expires it. Bind the session key to a per-user value.

The single most important field is the Session Key. It decides which conversation a stored history belongs to, so if every user shares one static key their chats bleed into each other. Bind it to an expression that is unique per user or per chat, for example {{ $json.sessionId }} or the chat ID from your trigger, and each person gets a private thread inside the same Redis database. Multiple Redis Chat Memory nodes in one workflow read the same instance by default, so the key is the only thing keeping threads apart.

Four steps to add and configure the Redis Chat Memory node on an n8n AI agentFour steps from a bare agent to a durable, per-user conversation memory.

Context Window Length works exactly as it does on Simple Memory: a value of 10 keeps the last 10 user-and-assistant exchanges, counted as turns rather than individual messages. Raising it improves recall of recent context and increases the input tokens you pay for on every call. The memory-types breakdown shows why that window, not the storage backend, is the real driver of your token bill.

Session Time To Live is the field Redis gives you that Postgres does not. Set it to 3600 and a conversation that goes quiet for an hour is deleted automatically, which is ideal for support chats or anonymous widgets where old sessions have no lasting value. Leave it empty and the history persists until you remove it yourself. The general memory guide covers the shared node wiring; TTL is the Redis-specific lever on top of it.

Why choose Redis over Simple Memory or Postgres?#

Pick Redis when you need durability, speed, and automatic expiry together. Simple Memory is in-process and vanishes on restart. Postgres Chat Memory is durable too, but it keeps rows until you delete them. Redis holds the window in memory, returns it in well under a millisecond, and can expire a stale session by itself.

The honest framing is that Redis and Postgres solve the same problem, durability, with different trade-offs. Postgres is the right call when the conversation is business data you want to keep, query, and back up alongside the rest of your app. Redis wins when the history is transient session state that should be fast and self-cleaning, which is what most chat agents actually want. Here is the three-way choice as a reference:

BackendSurvives restartQueue-mode safeAuto-expiryBest for
Simple MemoryNoNoNoPrototypes, single-process chats
Redis Chat MemoryYesYesYes, via TTLFast, transient session memory
Postgres Chat MemoryYesYesNo, manual deleteHistory you want to keep and query
Comparison of Redis Chat Memory and Simple Memory across persistence, queue mode, expiry, and setupSame window of turns, different home. Redis moves it out of the process so it survives and scales.

If your workflow already runs in queue mode across multiple workers, an external backend is not optional. In-process memory cannot follow a conversation that lands on a different worker each turn, so Redis or Postgres becomes the only way the agent stays coherent under load. Between the two, Redis tends to win for chat because its speed and TTL match the shape of a conversation, while Postgres suits records you plan to keep.

What does Redis chat memory cost to run?#

Almost nothing. Redis Cloud's free Essentials tier gives you 30 MB, 30 connections, and 100 operations per second, enough for thousands of short chat windows since you store only the last N turns per session. Self-hosting Redis on a small VM you already run costs $0 extra. The bill is still LLM tokens.

A worked example makes the scale clear. A single stored turn is roughly 200 tokens of text, so a 10-turn window for one user is about 2 KB in Redis. At 30 MB free you can hold on the order of 15,000 such windows before running out of room, and TTL quietly reclaims space as old sessions expire, so you rarely approach the ceiling in practice. All of that is modeled from published limits, not a measured benchmark, but the arithmetic is easy to check yourself.

Stat cards showing 30 MB free tier, about 2 KB per session, zero self-hosted cost, and modeled token costStorage is near-free at any realistic chat volume; the recurring cost is tokens, not Redis.

Compare that to the token side and the storage cost stops mattering. Re-sending a 10-turn window of about 2,600 input tokens on Claude Haiku 4.5 at $1 per million input tokens is roughly 0.0026 dollars per call. Run a thousand of those calls and you have spent about 2.60 dollars on tokens against 0 dollars on Redis. Whenever you tune for cost, tune the Context Window Length, not the backend.

Which memory setup should you actually use?#

Start with Simple Memory, then move to Redis the moment persistence or scale matters. If you are prototyping a single-process chat, the built-in window is enough and needs no credential. Switch to Redis Chat Memory when the conversation must survive restarts, when queue mode spreads work across workers, or when sessions should expire on a timer.

The mistake to avoid is starting with the heaviest option. You do not need Redis to demo an agent, and you do not need a vector store for conversation memory at all, since vector-backed memory solves recall-by-topic, a different problem. Wire Simple Memory first, confirm the agent behaves, then swap in Redis Chat Memory with the same Context Window Length once durability or queue mode forces your hand. The swap is a node change, not a rewrite, because the agent contract stays identical.

Decision flowchart for choosing Simple Memory, Redis Chat Memory, or Postgres Chat Memory in n8nStart with the in-process window, escalate to Redis for durability and expiry, and pick Postgres only when history is data you keep.

Frequently asked questions

Does n8n have a Redis Chat Memory node?
Yes. Redis Chat Memory is a built-in sub-node you attach to an AI Agent. It stores the conversation history in a Redis database and exposes three fields: Session Key, Context Window Length, and Session Time To Live. It needs a Redis credential pointing at Redis Cloud or a self-hosted instance.
How is Redis Chat Memory different from Simple Memory?
Simple Memory keeps the window inside the workflow process, so it is lost on restart and not shared across queue-mode workers. Redis Chat Memory keeps the same window in an external store, so the conversation is durable and every worker reads the same history.
What does Session Time To Live do?
It sets how many seconds a conversation stays in Redis after its last activity. Once the timer lapses, Redis deletes the session automatically. Set it to 3600 to drop chats idle for an hour, or leave it empty to keep history until you remove it yourself. Postgres has no equivalent auto-expiry.
Is Redis chat memory free?
Effectively yes for most agents. Redis Cloud's free Essentials tier provides 30 MB, which holds thousands of short chat windows, and self-hosting on a VM you already run costs nothing extra. Your real spend is LLM tokens, which the Context Window Length controls.
Does Redis memory work in n8n queue mode?
Yes, and that is a main reason to use it. In queue mode each message can be handled by a different worker, and in-process memory cannot follow the conversation. An external store like Redis lets every worker read and write the same history, so the agent stays coherent under load.

Sources

Primary references and vendor documentation used while drafting and reviewing this article.

  1. n8n Redis Chat Memory node docs
  2. n8n Simple Memory (window buffer) node docs
  3. Redis Cloud Essentials plan details (free 30 MB tier)
  4. Anthropic Claude pricing (Haiku 4.5, used in the modeled token math)

Written by

Muhammad Qasim Hammad
Muhammad Qasim Hammad
AI agents & automationFounder · Cart Gaze LLCPMP-certified PM

Muhammad Qasim Hammad is an AI agent and automation expert and the founder of Cart Gaze LLC (cartgaze.com). He builds product for the love of it: when an idea lands, a working prototype is usually running within hours, built with the same AI agents and automations he sells. He puts his own output at roughly 20× what it was before agents, and the Agentic OS behind this site is the working proof, documented in public with the tools he actually ran and what they really cost.

AI & Automation Services

Want a pipeline like this running in your business?

I'm Qasim — I design and ship AI agents and n8n automations for solo operators and small teams. Tell me what's eating your team's week, and I'll scope a fix.

Related reading