n8n
n8n is a workflow automation platform with a first-class AI Agent node.
The agent is good at acting; what it lacks is memory across executions.
Every workflow run starts from zero. Korely fixes that: attach HTTP
Request nodes to your AI Agent workflow, point them at
https://api.korely.ai/v1 with your kor_live_
key, and the agent saves what matters at the end of a conversation and
finds it again on the next run, the next day, or from a completely
different workflow.
No community package required. The n8n HTTP Request node is built-in, ships with n8n Cloud and self-hosted, and speaks JSON over HTTPS — exactly what the Korely REST API expects.
What you get
- Memory across executions. Each n8n execution is
stateless by design. With Korely attached, the agent persists
decisions, summaries, and facts via
POST /v1/memoriesand recalls fact-assembled context withGET /v1/contextin any later run. - Memory across workflows. The memory store is shared. A chat workflow saves a memory; a scheduled digest workflow reads it; the Korely dashboard shows it to you so you can inspect what agents have stored.
- The full REST surface. Store memories, run semantic search, pull structured context, query typed facts, manage agents and end users — all via standard HTTP calls from n8n nodes.
Prerequisites
You need a Korely API key (kor_live_…). Sign up at
korely.ai/agents — a Hobby account is free and
enough to follow this guide.
Step 1: store the credential
In n8n, create a Header Auth credential (or use a generic HTTP credential) with:
Name: AuthorizationValue: Bearer kor_live_YOUR_KEYYou will reference this credential in every HTTP Request node that calls Korely, keeping the key out of individual nodes.
Step 2: build the workflow
The smallest memory-enabled agent uses four nodes:
Chat Trigger ──▶ Recall node ──▶ AI Agent ──▶ Save node ──▶ (reply) │ Chat Model: your model- Add a Chat Trigger node.
-
Add an HTTP Request node called Recall.
Point it at
GET /v1/context— the recall path that assembles the user's active typed facts plus relevant memories into a single block, ready to drop into a prompt:Method: GETURL: https://api.korely.ai/v1/contextAuthentication: Header Auth → select your Korely credentialQuery params: query = {{ $json.chatInput }}user_id = {{ $json.sessionId }}token_budget = 800 -
Add an AI Agent node. In its system message, inject
the pre-formatted
contextblock from the previous node:You have persistent memory. Here is what is known about the user:{{ $('Recall').item.json.context }}Use this context before answering. When the conversation produces adecision or durable fact, the workflow will save it automatically. -
Add a second HTTP Request node called Save,
wired after the AI Agent:
Method: POSTURL: https://api.korely.ai/v1/memoriesAuthentication: Header Auth → select your Korely credentialBody (JSON): {"content": "{{ $('AI Agent').item.json.output }}","user_id": "{{ $('Chat Trigger').item.json.sessionId }}","agent_id": "n8n-chat"}
Step 3: smoke-test the connection
Verify the credential and endpoint are wired correctly before connecting a full agent. In a standalone HTTP Request node:
# from your terminal — same call the node makescurl -X POST https://api.korely.ai/v1/memories/search \ -H "Authorization: Bearer kor_live_YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{"query": "test", "limit": 3}'
A 200 response with a results array confirms the key works
and the endpoint is reachable. Then trigger the workflow from the Chat
Trigger panel and check that the Save node returns a memory
id.
Make the agent use memory on its own
The recall-then-save pattern above is deterministic — the workflow always searches and always saves. You can also give the AI Agent awareness of when to save by adding a decision step. A short excerpt for the agent system message:
You have persistent memory through Korely.- Prior context retrieved from memory is in your system prompt.- When a conversation produces a decision, a summary, or a durable fact, say [SAVE] at the end of your reply so the workflow persists it.- Never ask permission to search or save. Just do it.
In n8n, add an IF node after the AI Agent that checks
whether the output contains [SAVE], and route only those
branches to the Save HTTP Request node.
Example: save in one run, recall in the next
Two separate executions of the same workflow. First conversation, the Save node persists the memory; new session the next day, the Recall node finds it. No state passes between the runs except Korely.
# Execution 1 — Tuesday
You › We picked the Berlin venue for the team offsite. October
14 to 16, budget 6,000 EUR, Dana owns the agenda.
→ Save node POST /v1/memories
body: {
"content": "Offsite decision: Berlin, Oct 14-16. Budget: 6,000
EUR. Agenda owner: Dana.",
"user_id": "session-abc123",
"agent_id": "n8n-chat"
}
← {"id": "mem_7c3e91a2", "content": "Offsite decision: ..."}
Agent › Saved the offsite decision: Berlin, October 14-16,
6,000 EUR budget, Dana on the agenda. Anything else to capture?
# Execution 2 — Wednesday, brand-new session
You › Where did we land on the offsite?
→ Recall node GET /v1/context
params: query=offsite venue decision user_id=session-xyz token_budget=800
← {"context": "## Relevant memories\n- Offsite decision: Berlin,
Oct 14-16. Budget: 6,000 EUR. Agenda owner: Dana.",
"tokens": 28, "sources": ["mem_7c3e91a2"]}
Agent › You decided on Berlin, October 14 to 16, with a 6,000
EUR budget. Dana owns the agenda. Want me to create a task to
book the venue?
What comes back from /v1/context is pure retrieval: Korely
assembles the user's active typed facts — with contradictions already
resolved, so superseded facts never appear — plus the most relevant
memories found by semantic vector search. No generative model composes
output on the read path; your agent's own chat model does the reasoning.
That is also why read quotas are an order of magnitude more generous than
write quotas.
When you want raw search hits
GET /v1/context is the recall path for most agents — it hands
you one assembled block to drop straight into a prompt. When you instead
want individual scored memories — to rank, filter, or show them
yourself — call POST /v1/memories/search. It runs semantic
vector search and returns a results array, each item a
{ id, score, snippet, user_id, agent_id, metadata }
object:
curl -X POST https://api.korely.ai/v1/memories/search \ -H "Authorization: Bearer kor_live_YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{"query": "offsite", "user_id": "USER", "limit": 5}'
In n8n, map the snippet field before joining the hits into a
prompt — the items are objects, not strings:
{{ $('Search').item.json.results.map(r => r.snippet).join('\n') }}.
Beyond chat
Nothing here is chat-specific. Swap the Chat Trigger for any other trigger and the same HTTP Request nodes work:
- Schedule Trigger: a nightly agent calls
GET /v1/memorieson a user and saves a digest summary back withPOST /v1/memories. - Webhook or email trigger: before drafting a reply,
the agent searches past context for the sender's name with
POST /v1/memories/search. - Form trigger: intake forms become structured memories
keyed by
user_id, retrievable in any later workflow.
Troubleshooting
| Symptom | Fix |
|---|---|
| HTTP 401 Unauthorized |
Body is
{"code":"invalid_key","message":"Invalid or missing API key"}.
Check the Authorization header is exactly
Bearer kor_live_YOUR_KEY with no extra spaces or
quotes. Verify the credential is selected in the HTTP Request node.
|
| HTTP 429 Too Many Requests |
The body tells you which limit you hit:
{"code":"quota_exceeded","message":"Monthly memory write limit reached (1000). Upgrade to add more."}
means you have spent your monthly write quota — there is no
Retry-After on a quota 429, so waiting will not help;
upgrade your plan instead. A burst rate-limit 429 does carry a
Retry-After header (integer seconds) — add a Wait node
for that many seconds before retrying. Hobby allows 25,000 queries
and 1,000 writes per month.
|
| Search returns empty results on first run |
No memories exist yet for that user_id. The first
run saves; the second run recalls. Check the Save node executed
successfully and returned a memory id.
|
| Agent answers without using retrieved context | Make sure the Recall node output is interpolated into the AI Agent's system message, not just passed as user input. The agent ignores context it cannot see in the prompt. |
| HTTP 422 Unprocessable Entity |
The request body is missing a required field. Check that
content is present for writes, and query
for searches. The response body names the field:
{"code":"invalid_request","message":"content: Field required"}.
|
For the full REST endpoint reference, see the
API reference. For how facts,
supersession and time work, see
temporal facts.
Something not working? Email
[email protected] with your n8n
version (Cloud or self-hosted) and a screenshot of the HTTP Request
node settings. We read every message.