So I have a workflow that runs daily, which consists of a main AI Agent, and other sub-agents connected as AI Agent Tools. The problem I have is sometimes the sub-agents will be unable to complete their tasks, but most of the time if they just looked at what yesterdays result was that would work also, so I want to add memory, but I am unclear on how memory actually works, such as session-id, etc. Has anyone used memory in this way, and give me a recipe?
Use Postgres chat memory. All agents within the execution will share the same memory, even if each has its own node connected.
In the beginning of your flow, generate a unique session ID (can be based on todays date), which you will later pass to the memory node. At the end of the flow, you can store the output and the session ID in a new row in a Google Sheet.
AI agents will have a Get Rows Sheets tool connected and will be instructed to ALWAYS query for yesterday’s result, before outputting anything.