--- title: "n8n AI agent memory with the past.dev node" description: "The past.dev community node gives n8n AI agents memory that lasts across sessions: ingest messages with their dates, recall a person's history, delete a data point." canonical: https://past.dev/integrations/n8n last-updated: 2026-10-28 --- # Memory for n8n AI agents Source: https://past.dev/integrations/n8n n8n's memory nodes keep the chat history of one session. The past.dev community node, `n8n-nodes-pastdotdev`, adds memory that lasts across sessions and workflows. It has three operations: Ingest saves text with its date and author, Recall returns one person's memories with dates and source excerpts, and Delete Data Point removes one data point. The AI Agent node can use the node as a tool. You install it on a self-hosted n8n instance from Settings, with no code. ## What n8n's memory nodes store The [Simple Memory node](https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorybufferwindow/) keeps a window of recent messages in instance memory, cleared on restart. The Postgres, Redis and MongoDB variants store the same thing durably: message history, keyed by session. That is the right tool for follow-up questions inside one conversation. - History is scoped to one session. A new session has no access to a previous session's transcript unless the workflow loads it. - Transcripts grow as raw text, with no dates beyond message order. - Two workflows can't share what they learned: each keeps its own transcript. ## Install the past.dev node 1. In n8n, open **Settings › Community Nodes**, select **Install** and enter `n8n-nodes-pastdotdev`. 2. In the [past.dev console](https://app.past.dev), open **Build › API keys** and create a project key. It starts with `past_sk_`. 3. In n8n, add a **Past Dev API** credential and paste the key into **API Key**. Keep **API Host** at `https://api.past.dev`. Community nodes install on a self-hosted n8n instance ([installation guide](https://docs.n8n.io/integrations/community-nodes/installation/)). The credential test lists the project's audiences and uses no credits. A key reaches one project, so add a second credential for a second project. The package is [n8n-nodes-pastdotdev on npm](https://www.npmjs.com/package/n8n-nodes-pastdotdev), and its source and README are in the [pastdotdev/n8n-nodes-pastdotdev repository](https://github.com/pastdotdev/n8n-nodes-pastdotdev). ## The three operations | Operation | What it does | Returns | | --- | --- | --- | | Ingest | Saves one data point: Content, plus Identity (the author), Occurred At, Source ID, Label, Audience, Metadata and Idempotency Key. | `ingestionId`, `sourceId` and `status` | | Recall | Reads the memories that answer Query for one Identity, with optional Level, Limit, time window, Query Time and Sort. | The API response and a `context` field | | Delete Data Point | Deletes one data point by its Source ID, with the memory made from it. | `deleted`, `sourceId` and `operationId` | `context` is one block of plain text with each memory, its date and its sources, ready to put in a prompt. When nothing matches, `results` is empty and `context` is an empty string. A Source ID sent again saves a new revision of the same data point, and Occurred At dates the memory, so map it from the trigger when you can. ## Give the AI Agent node long-term memory 1. Under the AI Agent node's **Tools**, add the past.dev node and choose **Recall**. 2. Set **Query** to `{{ $fromAI('query', 'The question to look up in memory', 'string') }}`, so the model writes the query. 3. Set **Identity** to **By ID** with an expression from the trigger, such as `{{ $('Webhook').item.json.body.userId }}`. 4. Add a second past.dev tool with **Ingest**. Set its Identity the same way, and let the model fill **Content** only. > **Identity** > > The application sets the identity. The model never chooses it. Recall returns what the identity in the request may read, so take the identity from the signed-in user in code, and keep it out of every value that the model fills. In n8n, that means no `$fromAI()` and no "Let the model define this parameter" button on **Identity**. If the model sets the identity, a prompt can make the agent read another person's memory. The repository has three [example workflows](https://github.com/pastdotdev/n8n-nodes-pastdotdev/tree/main/examples) to import: ingest from a webhook, an AI agent with Recall as its tool, and delete a data point. ## Or connect the MCP server The **MCP Client Tool** node gives an AI Agent node the tools of a remote MCP server ([MCP Client Tool](https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolmcp/)). The project's end-user MCP server then gives the agent `recall`, `answer` and `who_am_i`, plus `remember` while the project's write toggle is on, with no tool code to write. 1. Turn on the project's end-user MCP server on **Build › MCP server** in the console. 2. Mint an access link there, or with the account server's `create_mcp_access_link` tool. The link has the form `https://api.past.dev/mcp//link/`. It is one URL that is one identity, and the server answers it with no sign-in step. 3. Keep the link out of shared documents, tickets and chat. The secret in its path is the credential. In the node, set **Endpoint** to the access link, **Server Transport** to **HTTP Streamable** and **Authentication** to **None**, because the secret in the link is the credential. Every execution of the workflow then acts as the link's identity. Anyone who can open the workflow can read the link, so limit who can open it. Every call through the link runs as its identity, with that identity's audiences. Mint one link per install, so that a revoked link stops one agent only. When the agent serves several people, mint one link per end user, and connect each request with the link of the user who makes it. Never share one link between users. `remember` writes to the identity's own private audience, and only that identity recalls it. Send data that the whole project must recall through the ingest call. The [end-user server documentation](/docs/mcp/serving-your-own-users) describes the tools, the links and revocation. ## What you can build in n8n - A support workflow that recalls what a returning customer said and what you promised them, with dates, before the agent replies. - Email triage and chat support as separate workflows that read and write one shared memory. - Memory per client for an agency: one project key per client keeps each client's data apart. - A backfill: ingest a year of tickets with their original timestamps, so each memory keeps its real date. An IF node can check `results` and route on your own rules: answer when the excerpts support it, send documents that disagree to a person, or reply that there isn't enough to go on. See the [quickstart](/docs/memory-api/quickstart) for the API and the [benchmarks](/benchmarks) for how recall is measured. ## Frequently asked questions ### Do I remove the Postgres chat memory node? Keep it. Chat memory keeps the flow of one conversation, and past.dev keeps what should last beyond it. They do different jobs and work well together. ### Can non-developers set this up? Yes. The node is a form: pick an operation, choose the credential and map fields from earlier nodes with expressions. ### Which operations use credits? Each Ingest and each Recall uses credits from your past.dev plan. The credential test and the dropdown lists don't. ## Related - [Memory for Zapier](https://past.dev/integrations/zapier) - [Memory for Dify](https://past.dev/integrations/dify) - [Memory for LangChain](https://past.dev/integrations/langchain) - [Memory for productivity tools](https://past.dev/use-cases/productivity) - [What is agent memory?](https://past.dev/what-is-agent-memory) - [Quickstart](https://past.dev/docs/memory-api/quickstart)