Tips > AI & LLM Integration

Add Memory to Conversational Workflows with Window Buffer Memory

By default, each LLM call in n8n is stateless -- the model has no awareness of previous messages in the conversation.

By default, each LLM call in n8n is stateless. The Window Buffer Memory sub-node adds multi-turn memory by keeping a sliding window of recent messages and injecting them into every new prompt. Attach it to an AI Agent node, set a Context Window Length, and give each conversation a stable Session ID so separate threads keep independent history.

What is Window Buffer Memory in n8n?

By default, each LLM call in n8n is stateless -- the model has no awareness of previous messages in the conversation. The Window Buffer Memory sub-node fixes this by maintaining a sliding window of recent messages that get injected into each new prompt, enabling multi-turn conversations.

Real-world example: A Slack bot that remembers the last 10 messages in a conversation thread so users can ask follow-up questions without repeating context.

How do you configure Window Buffer Memory on an AI Agent node?

AI Agent node with memory configuration:

Setting Value
Agent Type Tools Agent
Memory Type Window Buffer Memory
Context Window Length 10 (messages)
Session ID {{ $json.thread_ts }}

The Session ID is critical -- it determines how conversations are tracked. Using Slack's thread_ts means each thread maintains its own independent memory.

// Conversation flow example:

User: "What were our Q1 sales numbers?"
AI: "Q1 sales totaled $2.3M, up 15% from Q4..."

User: "How does that compare to the same quarter last year?"
AI: "Compared to Q1 last year ($1.8M), this represents a 28% YoY increase..."
// ↑ The model knows "that" refers to Q1 sales because of conversation memory

User: "Break it down by region"
AI: "Here's the Q1 regional breakdown: North America $1.1M, EMEA $720K..."
// ↑ Still maintains context about Q1 sales discussion

What's the difference between Window, Summary, and Token Buffer Memory?

Warning: Memory and Cost. Each message in the buffer is sent as part of the prompt, consuming tokens. A 10-message window with long messages can add significant token cost. For cost-sensitive workflows, reduce the window to 5 or use the Summary Buffer Memory sub-node, which compresses older messages into a summary.

Window Buffer Memory:   [msg1, msg2, ..., msg10]  → All sent verbatim
Summary Buffer Memory:  [summary_of_msg1-8, msg9, msg10]  → Compressed
Token Buffer Memory:    [as many messages as fit in N tokens] → Token-capped

Memory transforms one-shot Q&A into genuine conversational assistants that feel natural to interact with.

Related: Use Manual Trigger During Development Instead of Webhook or Schedule · Flatten Deeply Nested API Responses

Showcase builds

19 complete workflows from my own projects, each with its n8n workflow JSON to import. Showcase entries link the file at the end of the article.

See the showcase builds

Keep reading

190 entries grouped by topic, from first workflow to queue mode. Free, no signup.

Browse the encyclopedia

Need it built?

I design, build and run n8n systems for clients. Every engagement starts with a $1,500 diagnostic audit, credited toward the build.

Book an introductory call