Store Output from AI Agent to the memory

Hi everyone, I want to store the output information to the memory so that after user have occur the similar issue, AI Agent can refer back to the memory and tell to the user. How can I solve this kind of problem?

You can add simple memory bud, simply press the + button
image

Just Put the “Simple Memory”, so that will store all the information that user have asked?

Yes, but it will be gone if you restart your server.

If like that, have any other method that can store forever? Can be like ask the AI agent store the information to the google sheets and used the google sheets tools to store the memory.

So when have user ask similar question, it will go through the google sheets and see have similar or not

Is that possible to do this way?

Hi @Joe_B

If you want to implement an AI Agent with long term memory, you cannot use simple memory. In that case, to enable your AI Agent to refer back to past issues meaningfully, you can implement conversation history techniques or RAG (Retrieval-Augmented Generation)

1. Use a Persistent Memory Store

  • Instead of just a short buffer, store memory in a long-term memory system:
    • Database (PostgreSQL, MongoDB, Redis)
    • Vector store (embedded semantic memory via Pinecone, etc.)
  • n8n supports memory via MongoDB Atlas Vector Store or built-in memory nodes for this purpose.

2. Retrieve Similar Past Interactions

  • Use a Get / Query node prior to the AI Agent to retrieve relevant past issues.
  • If using embeddings, perform a similarity search to fetch past conversations similar to the current query.

3. Include Retrieved Memory in Prompt Context

  • Use a Function or Set node to compile the memory into the AI prompt:
Past interactions:
[Insert summaries or transcript items...]

New inquiry:
[User’s new message]
  • Feed this into the AI Agent node so the model can reason using historical context.

4. Save New Interactions Back to Memory

  • After AI answers, route data through a Write or Insert node to store the new Q&A for future recall.

Have a look at this tutorial from the n8n Team and see if that helps

1 Like

That’s not about memory anymore, you can refer to what @bridgewaretech said

Alright thanks for your help

Alright, I will try it. Thanks

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.