Question regarding session management for chatbots with multiple users

I have a general question regarding session management on chat agents created using Streamlit. I have chat agents created and deployed using Streamlit & LangChain/LlamaIndex. I have it deployed on a K8S infrastructure for managing scaling as the user community continues to grow. Although I haven’t seen evidence of users stepping on each other’s conversation history managed using in-memory ConversationBufferMemory() in LangChain or ChatMemoryBuffer() in LlamaIndex, I am concerned that because multiple users are connecting to the same chatbot instance they might step on each other’s conversation history in the memory. What is the best approach to do session management through streamlit? Should I be using some kind of storage (like Redis or DynamoDB) with the session_id and user name to store each user’s conversation history? How does streamlit handle multiple users connecting to the same instance?

Hi @hz6yc3

Session state can be used to store user data between re-runs and it is specific for each user session. Please refer to the Streamlit Docs for more info: Session State - Streamlit Docs

But if cases where you’d want data to be accessible across multiple user sessions, then storing in databases would be needed. For that please refer to: Connecting to data - Streamlit Docs

Hope this helps!

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