← Back to blog

n8n Agent Memory: An Editorial Exercise in Isolation and Recall

Practise n8n agent memory with Postgres-backed sessions: check recall across separate executions and identify the documentation needed before session-specific deletion.

Two separate mailboxes hold a copper fox and violet crane to represent n8n agent memory sessions.

Checked against the cited sources on .

Your n8n agent memory exercise

This editorial exercise asks you to check n8n agent memory across separate executions using two fictional users and Postgres Chat Memory. The target is recall within the matching session without revealing the other session’s invented fact. The exercise has not been executed or validated.

Start with an already working n8n chat workflow containing an AI Agent and a configured chat model, plus usable Postgres credentials. n8n documents Postgres Chat Memory as database-backed chat-history storage and points to separate authentication guidance. Initial credential setup, building the agent and production deployment are outside this exercise.

n8n’s 2026 Production AI Playbook recommends user-based session IDs for recalling interactions across executions. We think session separation is worth practising before adding more elaborate agent behaviour.

Sources: n8n-docs/docs/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorypostgreschat.md at main · n8n-io/n8n-docs · GitHub, Production AI Playbook: Complex Agent Patterns – n8n Blog

Configure the n8n agent memory node and inputs

Two distinct keys and separate storage compartments represent Postgres Chat Memory session inputs.
Different keys represent the fictional sessions configured against the exercise’s test storage.

For n8n AI agent memory with PostgreSQL, use Postgres Chat Memory. n8n documents a configurable session key, a history table created if absent and a context window measured in previous interactions. Add or inspect that memory connection, choose a dedicated disposable test table and record your settings.

Use the following editorial inputs and constraints. Process one input item per execution because n8n documents that expressions in memory sub-nodes resolve against the first input item. Keep the table, model and context-window setting unchanged throughout.

Suggested fictional inputs and fixed exercise settings
ItemSuggested valuePurpose
Alice session keyexercise-aliceIdentify Alice’s conversation
Bob session keyexercise-bobIdentify Bob’s conversation
Alice’s invented factMy project mascot is a copper fox.Seed Alice’s recall
Bob’s invented factMy project mascot is a violet crane.Seed Bob’s recall
Test tableDedicated disposable tableKeep exercise data separate
Context windowRecord your chosen settingKeep the comparison consistent

Sources: Postgres Chat Memory | Nodes | n8n Docs

Alternate sessions across separate executions

Alternating copper and violet envelopes represent separate executions for Alice and Bob.
Alternating envelopes show the suggested pattern of returning to each session in separate executions.

Use this suggested sequence to examine n8n agent memory. These prompts and completion criteria are editorial suggestions. Record each resolved session key, execution identifier, prompt and observed response; do not replace an unexpected answer with the answer you hoped to see.

  1. Run Alice’s invented fact with exercise-alice.
  2. In a separate execution, run Bob’s invented fact with exercise-bob.
  3. Return to exercise-alice and ask: What is my project mascot?
  4. Return to exercise-bob in another execution and ask the same question.
  5. Ask Alice’s session: What is Bob’s project mascot? Then ask Bob’s session about Alice’s mascot, without supplying either answer.
  6. Record matching recall, missing context and any disclosure of the other session’s fact.

n8n warns that multiple Postgres Chat Memory nodes share a memory instance by default and instructs users to assign different session IDs for separate instances. Distinct keys are a configuration mechanism, not authenticated user authorization or a guarantee against disclosure.

Sources: n8n-docs/docs/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorypostgreschat.md at main · n8n-io/n8n-docs · GitHub, Production AI Playbook: Complex Agent Patterns – n8n Blog

Investigate recall and visible history separately

A display frame and a storage drawer distinguish visible chat history from Agent memory.
The display and drawer separate two questions: what the chat shows and what context the Agent receives.

If n8n agent memory responses surprise you, use these suggested diagnostic checks before changing several settings at once. In our view, inspecting the resolved session key is a better first move than rewriting the prompt.

Suggested checks for unexpected observations
ObservationInspect firstRecord
Other session’s fact appearsResolved keys and accidental reuseActual key in each execution
Own fact is missingKey consistency and context windowSettings and intervening interactions
Multi-item input was usedFirst-item expression resolutionRepeat with one input item

Visible chat history needs a separate check. In the unpinned Chat Trigger master-branch snapshot cited here, whose default node version is 1.5, restoring the chat widget’s history is distinct from supplying the Agent with memory. Its builder hint also requires a memory connection to the trigger when restoring history from memory; this snapshot does not establish behaviour for every released version.

Sources: Postgres Chat Memory | Nodes | n8n Docs, n8n-docs/docs/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorypostgreschat.md at main · n8n-io/n8n-docs · GitHub, n8n/packages/@n8n/nodes-langchain/nodes/trigger/ChatTrigger/ChatTrigger.node.ts at master · n8n-io/n8n · GitHub

Document deletion readiness and finish the exercise

An unused eraser beside a closed drawer represents checking deletion scope before changing memory.
The unused eraser keeps deletion at the documentation-readiness stage while its scope remains unresolved.

Make deletion a documentation-readiness task only. n8n documents Chat Memory Manager operations for retrieving, inserting and deleting messages, including the last N or all messages. The Chat Memory Manager documentation cited here does not establish a complete session-specific Postgres deletion procedure, authorization boundary or verification method. Separately, the general Postgres node documentation warns that Delete without a row-selection condition removes all rows; it is not a memory-schema recipe.

Before attempting deletion, obtain the version-matched documentation listed below. We would keep deletion blocked until session selection and verification are explicit.

Complete the exercise by retaining the records for both users, marking each target behaviour as observed or failed, and recording unresolved questions. Reflect on what you observed versus what remains unproven: this small exercise establishes no production security, restart-survival, retention-duration, backup-erasure or durable-storage guarantees.

Sources: Chat Memory Manager | Nodes | n8n Docs, n8n-docs/docs/integrations/builtin/app-nodes/n8n-nodes-base.postgres/README.md at main · n8n-io/n8n-docs · GitHub

Put this into practice

Hands-on n8n challenges

Pick a challenge and build a working workflow in your own n8n environment, with five progressive tips per challenge.

Try a hands-on challenge

For your team

Custom n8n training programs for one team or department, run on your own n8n instance with your own tools and data.

Training for your team

n8n skills assessment

A free quiz of about 20 minutes: 30 questions in 10 skill areas and a level from Beginner to Expert. On AI Adoption Score, another project by the author of this site.

Get your n8n level