Persistent Memory in
n8n AI Workflows
n8n's AI Agent node is powerful — but every workflow run starts with a blank slate. Here's how to connect it to Kronvex so your agents remember users, past interactions, and accumulated knowledge across every run.
Why n8n agents forget
n8n's built-in "Window Buffer Memory" node keeps context within a single workflow execution. The moment the run ends — triggered by a webhook, a cron job, or manually — the memory is gone. The next run knows nothing about previous conversations.
For automations that interact with the same user over time (support bots, sales follow-ups, onboarding sequences), this is a fundamental limitation. Kronvex solves it with three HTTP Request nodes that take under 5 minutes to set up.
Prerequisites
- An n8n instance (cloud or self-hosted)
- A Kronvex account — get a free API key here
- Your Kronvex Agent ID (shown in the dashboard after creating an agent)
Store your API key as an n8n credential: Credentials → New → Header Auth, Name: Kronvex, Header Name: X-API-Key, Value: kv-your-key.
Node 1 — Store a memory
After your AI generates a response (or at any point where you want to store context), add an HTTP Request node:
| Field | Value |
|---|---|
| Method | POST |
| URL | https://api.kronvex.io/api/v1/agents/YOUR_AGENT_ID/remember |
| Authentication | Header Auth → Kronvex credential |
| Body (JSON) | {
"content": "{{ $json.userMessage }}",
"memory_type": "episodic",
"session_id": "{{ $json.userId }}"
} |
The session_id field scopes memories per user — critical for multi-user workflows. Use any stable user identifier: email, user ID, phone number.
Memory types:
episodic— what happened ("User said they prefer email over calls")semantic— facts ("User is a freelance designer, 3 years experience")procedural— patterns ("User always responds within 2 hours")
Node 2 — Recall memories
At the start of your workflow (before the AI node), add a recall node to load relevant context:
| Field | Value |
|---|---|
| Method | POST |
| URL | https://api.kronvex.io/api/v1/agents/YOUR_AGENT_ID/recall |
| Authentication | Header Auth → Kronvex credential |
| Body (JSON) | {
"query": "{{ $json.userMessage }}",
"top_k": 5,
"session_id": "{{ $json.userId }}"
} |
The response contains a memories array. Each memory has content, memory_type, and a score (0–1 relevance). Access them in later nodes with {{ $json.memories[0].content }}.
Node 3 — Inject context (recommended)
Instead of manually formatting memories, use the /inject-context endpoint which returns a ready-to-use context string formatted for LLM prompts:
| Field | Value |
|---|---|
| Method | POST |
| URL | https://api.kronvex.io/api/v1/agents/YOUR_AGENT_ID/inject-context |
| Authentication | Header Auth → Kronvex credential |
| Body (JSON) | {
"query": "{{ $json.userMessage }}",
"top_k": 5,
"session_id": "{{ $json.userId }}"
} |
The response has a context string ready to prepend to your system prompt. In your AI Agent node's system message:
You are a helpful assistant. {{ $('Inject Context').item.json.context }} Answer the user's question based on the context above.
Full workflow pattern
Here's the recommended node order for a webhook-triggered AI workflow:
userId + userMessageProduction tips
- Always pass
session_id— without it, all users share the same memory pool - Store selectively — only remember information that matters long-term. Don't store every word; summarize instead
- Use TTL for temporary context — add
"ttl_days": 30to memories that should expire (e.g., support ticket context) - Error handling — add a Continue On Fail on the /recall node so a memory outage never breaks your workflow
- Rate the n8n HTTP credential — set up a dedicated Kronvex agent per n8n environment (dev/staging/prod)
- GDPR — all data stays in EU (Frankfurt). For GDPR deletion requests, use
DELETE /agents/{id}/memoriesto wipe a user's session