Multi AI Agent Memory Bleed Issues

Hi everyone,

I’m running into an issue with my AI agents. In my workflow I have two different AI agents,

  1. AI Assistant (handles conversations with leads and books calls) [Lets call it Agent 1]

  2. AI Summarizer (summarizes chat history to provide team member summary of the conversation) [Lets call it Agent 2]

I’m using supabase/postgres to store the chat history. The AI Agent Memory is using Postgres.

The issue is that both agents are linked to the same chat memory and Agent 2’s user message + output is being stored in the chat memory. Then we run into problems where Agent 1 will message the lead their summary by mistake since its reading the prompts from Agent 2.

My questions are:

Is it possible to read the memory but prevent it to adding to it?
Or can I attach two different memories 1 for reading, and 1 for writing?

If that’s not possible I was thinking should I pull the chat memory in a different node, and feed it to the AI summary agent and not link it to memory directly? Think that would work?

Thanks in advance.

Hello @Suroy

I think you’re looking for the Chat Memory Manager node:

With this node, you can get/insert/delete messeges depending on your use case..

Check it out, it should help you control your agents memory..

Ah that does sound like what I’m looking for!

I looked at replacing the memory in the AI Agent and didn’t see that as a memory option.

So I created the memory manager node,

Would I add it like this?

Would it do the same thing as adding a supabase Get many rows tool directly to the agent? If so are there any benefits of one method over the other?

TIA

i cant see the whole workflow logic but yes i think (also notice there are 2 branches in AI summary node, you will need a merge node), also as you mentioned in your case, you want to read the memory but not add to it.

So I think you need to add it somewhere after (agent 1), then configure it with the correct key mapping to get the messages you need, and then do your summarization (agent 2)

This way, you won’t add anything to Agent 1’s memory, you’re only reading from it..

So would it be something like this:

I used the summarize node so I could add a separator (commas) do I need to add a separator and if so is there a best one to use for the AI?

You can enable the Group Messages option to get a 1-item array for the messages:

Then use any AI node (such as Basic LLM Chain) to ask a model to summarize the messages:

The prompt would look something like this:

So the whole idea is that you’ve separated the memory from the first agent and the second agent.

In other words, there isn’t really a second agent, you’re just reading the memory from the first agent, then summarizing that messages, this process has nothing to do with the first agent itself..

I hope everything makes sense now..

2 Likes

Ah thats perfect, thanks for all your help!

1 Like

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