Window Memory

Stores the last N messages in a sliding window buffer, giving AI agents conversation context across messages. Optionally persists memory across workflow runs using workflow state.

When to Use

Use Window Memory for:

  • Prototyping chatbots where you need basic conversation continuity
  • Short conversations where recent context is sufficient (customer support, Q&A)
  • Lightweight deployments where you don't want external vector database dependencies

For long-term memory with semantic recall, use Qdrant Memory instead.

Configuration

Window Memory is a sub-node — it connects to an AI Agent's Memory handle, not to the main data flow.

SettingTypeDefaultDescription
windowSizenumber20Number of recent messages to keep. Older messages are dropped from the window.
sessionKeystringScope key for per-user or per-thread memory. Use bindings like thread:{{ input.body.thread_id }}.
persistentbooleantrueWhen enabled, memory is saved to workflow state (SQLite) and survives workflow restarts. Disable for volatile in-memory only.

How It Works

  1. When the agent starts processing a message, it calls load() on the memory provider
  2. Window Memory returns the last windowSize messages from the session
  3. These messages are prepended to the LLM's conversation context
  4. After the agent responds, the new user message and assistant response are saved via save()
  5. If the window exceeds windowSize, the oldest messages are dropped

Example

Connect Window Memory to an AI Agent for a simple chatbot:

  1. Add an AI Agent node
  2. Add a Window Memory node
  3. Connect Window Memory to the agent's Memory handle (dashed purple edge)
  4. Set windowSize to 10 and persistent to true
  5. Set a sessionKey binding to scope memory per user: user:{{ "{{ webhook.body.user_id }}" }}

The agent will remember the last 10 messages per user across workflow runs.

Session Keys

Session keys isolate memory between different users or conversation threads. Without a session key, all messages share one global buffer.

Common patterns:

  • user:{{ "{{ webhook.body.user_id }}" }} — per-user memory
  • thread:{{ "{{ webhook.body.thread_id }}" }} — per-thread memory
  • Static value (e.g. global) — shared memory for all requests

Common Gotchas

  • Window size vs token limits: A large window (50+ messages) can exceed the LLM's context window. Start with 10–20 and increase as needed.
  • Persistent mode: When enabled, memory survives workflow restarts but uses workflow state storage. For high-traffic deployments, consider Qdrant Memory instead.
  • No semantic search: Window Memory only returns recent messages. It cannot recall relevant information from older conversations. Use Qdrant Memory for semantic recall.

See Also

On this page