Integration

Memory for n8n agents

This page shows how to add Harny memory to an n8n AI Agent so each person's facts stay dated and separate.

Jump to the code

What the framework does not keep

  • Which value is current. Harny keeps dated memories, so a changed value with a newer timestamp becomes the current value. The earlier value stays answerable by date.
  • When a fact happened. Harny takes a timestamp for each memory, and recall can be limited to what was true as of a date with queryTimestamp.
  • One person across sources. Harny keeps one private memory per user, and each person's memory is separate from every other person's.

The pattern: HTTP requests

Call the Memory API from your workflow with HTTP requests: one call for recall and one for ingest. The code block shows the recall call: the method, the URL, the headers and the body. Send your app key in the Authorization header, and keep it out of the browser: call from a server.

Take the user id from the workflow data, not from the model. Send it in the X-Harny-User header.

POST https://api.harny.ai/v1/memory/recall
Authorization: Bearer {{ $env.HARNY_APP_KEY }}
X-Harny-User: {{ $json.userId }}
Content-Type: application/json

{ "query": "{{ $fromAI('question') }}", "identity": "{{ $json.userId }}" }

What recall returns

Ranked memory with dated sources and source labels. Results carry the id, the time it happened (occurredAt) and sources with a sourceId, a date and a label.

  • POST https://api.harny.ai/v1/memory/ingest takes id, content, label and timestamp.
  • POST https://api.harny.ai/v1/memory/recall takes query and identity, and returns results with sources.

Example: your agent asks “what is the Acme pilot budget?” and gets this back. Your code hands the model the content and the source label, so it can say who said it and when.

{
  "asOf": "2026-07-29T00:00:00Z",
  "results": [
    {
      "rank": 1,
      "occurredAt": "2026-07-28T16:00:00Z",
      "content": "Acme pilot budget: currently 40k.",
      "sources": [
        { "sourceId": "call-8821", "label": "Email from Nadia" }
      ]
    }
  ]
}

When to use which

  • Use n8n's own workflow state for the steps of a workflow run and for the data the workflow passes between nodes.
  • Add Harny when a fact about a person must stay dated, change over time, or be recalled for that person across later runs.

Frequently asked questions

Is a package needed?

The Memory API is a plain HTTP API. It takes an app key in the Authorization header and a user id in the X-Harny-User header.

Where does the user id come from?

The user id comes from the workflow data for the person the workflow is running for, not from the model. Send it in the X-Harny-User header.

Go on. Get Harny.

The first 500 monthly-active end users are free for good. Create an app key and make your first call in minutes.