Insert context in Postgres Chat Memory

Hello everyone!

Describe the problem/error/question

I want to “insert” a context for my AI Agent. Im using Postgres as chat memory.

Example: my AI must schedule a meeting with the user. it works normally. But i have other workflow that sends a reminder to the user about 2h before the date.

This workflow sends the message that i wrote and pre-defined. How can I “insert” this exact message to the specific user chat memory in postgres? So that the AI know about that reminder in a next conversation.

Sorry for my bad english, was I clear?

If you are storing the sessions in a database, you could simply retrieve the last session from that user and insert into the prompt for context.

Have you built something already? If yes, then please share your workflow here so we can assist you further.

yes, i have built something, but its just the AI Agent, nothing special.



Actually i tried to Insert a row in the database with the exactly same structure that the AI Agent generate every message, but it seems to not work. When I ask to the Agent “do you sent this: (then i paste the message that i inserted)?”, and the answer is No.


even the n8n recognize the insertion

Solution if someone else needs: theres a node called “Chat Memory Manage”, use it do insert the context

2 Likes

Very good. Thanks for sharing the solution you’ve found :muscle:

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