Memory for AI agents

I deploy AI agents to clients and I want that depending on who is connected, the AI ​​agent finds the corresponding memory, and that the user can therefore access their previous messages etc. Do you know how to do this?

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

If you are using a chat memory manager like below, you can input a sessionid into the memory manager. That way, each client can have their own sessionid, which you can store for example in an Airtable that contains client_id and sessionid on each row, and thus retrieve the correct memory as required.
image

Do you have an exemple of a workflow with ai agent and this memory nodes, to see me exactly how to do it ? Thank you

Chat with OpenAI Assistant (by adding a memory) | n8n workflow template :ok_hand:

Thank you for your answer, but how do you know which session ID to assign based on the user? Because I need to know who is connected to the chatbot to find their ID session?

The sessionid can be anything as long as it is unique. In fact, you can make the sessionid and clientid identical if you wish :sunglasses:

yes but in your workflow did you need to send the client name or client id to retrieve the session id that match with the client ?

it all depends on how you store it, since you are the one who sets the session id on the memory node. You can either store a lookup table yourself or use the client id itself as a session id.

Yes but how can I know the client ID ?

Send it to the webhook, like so:

fetch("WEBHOOK URL", { 
  "method": "POST",
  "headers": {
    "Content-Type": "application/x-www-form-urlencoded"
  },
  "body": {
    "client_id": "1234767",
    "client_name": "John"
  }
})
.then(response => {
  console.log(response);
})
.catch(err => {
  console.error(err);
});

Thank you !