How to manage sessions on a Make AI Agent?

:bullseye: What is your goal?

I want to setup a Make.com AI Agent with a session managing module. The main goal is to have it terminate the session when the chat hasn’t been active in 5 minutes or when the person types “start over”

:thinking: What is the problem & what have you tried?

I don’t know how to do it and I can’t find a way to get the session manager working. I can’t seem to find a solution to this. What I’ve done so far is that I put on the thread ID the Id of the contact plus today’s date, so every day it creates a new chat. What I really want is what I described on above’s paragraph

:clipboard: Error messages or input/output bundles

I am not getting any error message. This is something I want to set up

:camera_with_flash: Screenshots (scenario flow, module settings, errors)

Welcome to the Make community!

You’ll probably need a Data Store to “save” the user’s last message time, and then at the start of the scenario (after the trigger module), use a module to “load” the user’s last message time from their contact ID.

Have you seen these previous discussions?

Your question may have already been answered here:

You can search this forum for existing answers, and also use the documentation in the Help Centre to get to a solution faster, and also help keep the forum organised. Thanks for your cooperation!

Still require assistance?

If the previous threads above does not answer your question, please edit your question and provide additional details to demonstrate the difference between your question and the duplicate discussions.

If you require help implementing the answers in the previous threads linked above, please reply with more details of what you have tried, including screenshots.

Hope this helps! If you are still having trouble, please provide more details.

@samliew
P.S.: investing some effort into the tutorials in the Make Academy will save you lots of time and frustration using Make!

1 Like

It’s different from what I’ve seen here. I want to change the Thread ID given one of these two conditions:

  • User says “Start over“
  • User does not chat for 5 minutes

I made a solution on the screenshot I shared that basically what it does is that it creates a new thread ID for the same user every day, but that’s a provisional solution.

I haven’t seen anybody creating this here, and I don’t know how is this achievable

Can you provide a scenario share so we can build on what you already have?

Here it is my friend! thanks for your support

So the main module I want to set up is this one. The other ones are because users have a limit os usage on this bot, but that’s something I manage on another scenario. The main problem I want to solve is to always have the same thread ID for a single user, then change it if the person types “Start over“ or the chat session closes (user doesn’t type within 5 minutes or something like that)

@Gonzalo_Zerpa You need some sort of Data Store (Airtable/Google Sheets) for this so you can search IDs then route for no record, record exists, and or other. Pass thread and so on. I hope this helps you!

I know it’s possible with data stores and so, but I don’t know like what’s the standard. I can imagine a way to do this, but I really don’t know if that’s like the actual solution or if someone has already done that before

Use a Data Store (Airtable or Sheets), you can also use Make.com Data Store as a session table by user ID.

You’ll need to store thread_id and last_message_at for each user somewhere. So you can search the user’s record.

Conditions:

A. If a user decides to “start over” or it has been >5 minutes since last_message_at, create a new thread and overwrite the record in the Data Store.

B.Use the stored thread_id and update last_message_at from the Data Store.

In this way, each user will have a unique record and will reset based on those specific conditions.

I hope that makes sense to you now!

1 Like

Start with the discussions listed here, How to manage sessions on a Make AI Agent? - #2 by samliew

I noticed you haven’t even looked at them yet.

1 Like

So the other posts that were quoted on this post don’t solve the problem I’m trying to solve: all of them solve the continuity issue, where the AI is capable of getting past message from a single chat and doesn’t get stuck on the first message.

The problem I was trying to solve was this one: when given a condition, even if it’s the same user who is typing, start a new Thread (let’s say a new chat with the AI). This would allow to optimize the token usage, because you don’t want the AI remembering the last 100 messages sent.

For a simple Q&A chatbot it doesn’t matter, but when the Agent you are building is going to be used several times by the same user, even daily, you wouldn’t want it to remember all the past executions, only the ones on the current chat.

So this was my solution: create a session adminsitrator using Make.com’s datastore:

And this is the flowchart used to administrate the Thread ID

So in the end the solution was to assign a new thread ID when the conditions are met. It works the same for every condition, so if someone wants to use this, they just have to change the first condition block

2 Likes

Excellent! The use the the Data Store is definitely the “best practice” way, as it reduces the lag/response time due to it being on Make’s servers. I’m glad you managed to come up with that solution that suits your use-case.

That flowchart looks amazing, may I ask which software you used to create the diagram?

If you have a follow-up question, please start a new thread. Thanks!

@samliew

1 Like

I used draw.io! it’s a really nice tool. I use it for like everything from university´s tasks to work. It’s really easy to use also, I love it

1 Like