# CrewAI memories : multi-users environment + conversational history

**URL:** <https://community.crewai.com/t/crewai-memories-multi-users-environment-conversational-history/4237>\
**Category:** Crews\
**Tags:** memory\
**Created:** [February 27, 2025, 12:51pm UTC](https://community.crewai.com/t/crewai-memories-multi-users-environment-conversational-history/4237 "2025-02-27T12:51:44Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicolas\_szczepaniak](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/nicolas_szczepaniak/32/2553_2.png) [@nicolas\_szczepaniak](https://community.crewai.com/u/nicolas_szczepaniak)\
**Post date:** [February 27, 2025, 12:51pm UTC](https://community.crewai.com/t/crewai-memories-multi-users-environment-conversational-history/4237/1 "2025-02-27T12:51:44Z")

</div>

Hello,

I have some (potentially basic) questions about memory, but I’m having trouble finding clear answers in the documentation or threads.

I’m not sure if anyone has already looked into these topics.

**what I understand so far:**

- **Short-term memory & entity memory** : Allow agents to maintain context, share their results, and collaborate within a **single crew execution**.
- **Long-term memory** : Stores various results from the crew or agents over time and retrieves them for improvement purposes.

1️⃣ **Maintaining context across multiple executions**

It is mentioned that combining these different memory types enables the crew to maintain context **within a single execution as well as across multiple executions** (essentially within a conversation). However, when I queried the CrewAI codebase with a cursor chatbot about memory, it mentioned that the primary goal of these memory systems is **not** to maintain a conversational history or contextual memory between the user and the crew.

- Given this, **would it be advisable to complement CrewAI’s memory system with another conversation history tracking**? (For example: passing the last 30 messages between the user and the assistant to the crew) in order to ensure a consistent **conversation context** for each user, with a minimum contextual window.

2️⃣ **Memory isolation in multi-user environments**

In a multi-user setup, are CrewAI’s memory systems **isolated per user**?

For instance, if:

- **User A** states that they are looking for a **primary residence in France** , and
- **User B** states that they are looking for a **secondary residence in Spain** ,
- If both requests happen **at the same time** or **close to each other** , could there be a risk of **context mixing** between A and B?

Would this lead to **execution issues** , where Crew A and Crew B could mix their context and tasks results, causing incorrect answers to be given to users?

- Is it relevant to **implement a filtering system** based on `user_id` or `session_id` when handling CrewAI memory?
- Alternatively, would it be best to run **one execution per instance** , ensuring that there is only **one active crew per user at a time** , and resetting **short-term and entity memory** after each execution? Several Cloud Run instances with 1 execution at a time for example.
- This way, STM and entity memory would only persist for **a single execution per user** , reducing the risk of cross-contamination.

Thanks for your help !

---

<div class="post-metadata">

**Author:** ![zinyando](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/zinyando/32/4435_2.png) [@zinyando](https://community.crewai.com/u/zinyando)\
**Post date:** [February 27, 2025, 2:13pm UTC](https://community.crewai.com/t/crewai-memories-multi-users-environment-conversational-history/4237/2 "2025-02-27T14:13:33Z")

</div>

The built in memory system is not the best for conversational chat type applications. You probably need 2 types of additional memory like you mentioned:

1. Chat history - conversation history between your user and chatbot saved to a persistent storage/database. Like you said, you would pass eg the last 30 messages
2. Long term memory - for this you need something like [https://mem0.ai/](https://mem0.ai/) or [https://getzep.com/](https://getzep.com/)

I wrote a blog post that uses these patterns, you can use it as a starting board and improve from there

1. [http://zinyando.com/building-a-conversational-chatbot-with-crewai-groq-chromadb-and-mem0/](http://zinyando.com/building-a-conversational-chatbot-with-crewai-groq-chromadb-and-mem0/)
2. [Building conversational chatbots with knowledge using CrewAI and Mem0](https://www.zinyando.com/building-conversational-chatbots-with-knowledge-using-crewai-and-mem0-2)

---

<div class="post-metadata">

**Author:** ![nicolas\_szczepaniak](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/nicolas_szczepaniak/32/2553_2.png) [@nicolas\_szczepaniak](https://community.crewai.com/u/nicolas_szczepaniak)\
**Post date:** [February 27, 2025, 5:18pm UTC](https://community.crewai.com/t/crewai-memories-multi-users-environment-conversational-history/4237/3 "2025-02-27T17:18:27Z")

</div>

Hello @zinyando,

Thanks for your answer and the blog posts. I had the opportunity to test **mem0** thanks to this 🙂

Okay, I understand that adding additional memory sources can be useful for providing more context to the crew about its conversation with a user.

Do you have any information on how **CrewAI memories (short-term, long-term, entity)** are **isolated per user**?

If multiple users interact with the crew at the same time, how can we ensure that there are **no conflicts in retrieving information**? (For example, the crew might use the result of a task performed for **User 1** as context while processing a task for **User 2** ).

Right now, it seems that there is **no filtering by user or session** when the crew retrieves memory elements. The inputs and results from all users appear to be mixed together.

Should we implement **filtering by user\_id or session\_id** to avoid conflicts between different users’ contexts and informations?

Thanks again for your response!

---

<div class="post-metadata">

**Author:** ![zinyando](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/zinyando/32/4435_2.png) [@zinyando](https://community.crewai.com/u/zinyando)\
**Post date:** [February 27, 2025, 5:22pm UTC](https://community.crewai.com/t/crewai-memories-multi-users-environment-conversational-history/4237/4 "2025-02-27T17:22:01Z")

</div>

There is no isolation per user for the CrewAI memory types. So they won’t work for what you want to do

---

<div class="post-metadata">

**Author:** ![nicolas\_szczepaniak](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/nicolas_szczepaniak/32/2553_2.png) [@nicolas\_szczepaniak](https://community.crewai.com/u/nicolas_szczepaniak)\
**Post date:** [March 5, 2025, 2:07pm UTC](https://community.crewai.com/t/crewai-memories-multi-users-environment-conversational-history/4237/5 "2025-03-05T14:07:58Z")

</div>

@zinyando I guess passing for each user the user preferences and conversations history should do the job.

Thanks for your answers

---

<div class="post-metadata">

**Author:** ![Gyanesh\_Kumar](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/gyanesh_kumar/32/516_2.png) [@Gyanesh\_Kumar](https://community.crewai.com/u/Gyanesh_Kumar)\
**Post date:** [March 6, 2025, 4:31pm UTC](https://community.crewai.com/t/crewai-memories-multi-users-environment-conversational-history/4237/6 "2025-03-06T16:31:32Z")

</div>

Have you looked at MemGPT open source Python Package

> **[GitHub - letta-ai/letta: Letta (formerly MemGPT) is a framework for...](https://github.com/letta-ai/letta)**
>
> Letta (formerly MemGPT) is a framework for creating LLM services with memory.

Also here’s an example [MemGPT + AutoGen](https://memgpt.readme.io/docs/autogen)

---

<div class="post-metadata">

**Author:** ![komal\_gupta](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/komal_gupta/32/3274_2.png) [@komal\_gupta](https://community.crewai.com/u/komal_gupta)\
**Post date:** [April 2, 2025, 9:45am UTC](https://community.crewai.com/t/crewai-memories-multi-users-environment-conversational-history/4237/7 "2025-04-02T09:45:06Z")

</div>

HI @nicolas_szczepaniak

Have you got any solution for user management for short term memory of crew built in crewai. platform  
Or are you using any custom solution to work around session management logic and on every crew all for each user retrieving data from database and passing it to agent as an in out.  
I am trying to work on this, if you can share your research idea then It would be helpful.

---

<div class="post-metadata">

**Author:** ![cristian\_di\_febo](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/cristian_di_febo/32/3639_2.png) [@cristian\_di\_febo](https://community.crewai.com/u/cristian_di_febo)\
**Post date:** [July 1, 2025, 8:18am UTC](https://community.crewai.com/t/crewai-memories-multi-users-environment-conversational-history/4237/8 "2025-07-01T08:18:25Z")

</div>

Hi @zinyando,  
How do you suggest implementing a multi-user environment? I am using FastAPI to reach the endpoint. From there, I am running a flow which will start a new crew every time, but I am getting a mixing-data problem when multiple users call the endpoint.

---

<div class="post-metadata">

**Author:** ![zinyando](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/zinyando/32/4435_2.png) [@zinyando](https://community.crewai.com/u/zinyando)\
**Post date:** [July 1, 2025, 8:22am UTC](https://community.crewai.com/t/crewai-memories-multi-users-environment-conversational-history/4237/9 "2025-07-01T08:22:17Z")

</div>

Can you tell me a bit more about what you are trying to achieve, what you have so far and the errors that you are getting. Information like whether you are using http requests or websocket will help, the memory providers etc

---

<div class="post-metadata">

**Author:** ![cristian\_di\_febo](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/cristian_di_febo/32/3639_2.png) [@cristian\_di\_febo](https://community.crewai.com/u/cristian_di_febo)\
**Post date:** [July 1, 2025, 9:32am UTC](https://community.crewai.com/t/crewai-memories-multi-users-environment-conversational-history/4237/10 "2025-07-01T09:32:22Z")

</div>

Thanks @zinyando for the rapid answer. I will try to explain my situation.

A user can upload a file and get back some details, and it works fine for a single user, but when multiple users try to call the API and upload different documents, a user could get back details from the document of another user.

The API done using FastAPI calls the CrewAI Flow:

> loop = asyncio.get\_event\_loop()  
> resultFlow = await loop.run\_in\_executor(None, kickoff, inputs)

I am using asyncio to avoid the 504 http error and the answer will be sent back througth websocket.

The kickoff method will run the flow:

> dataCollector\_flow = DataCollectorFlow()  
> result = dataCollector\_flow.kickoff(inputs)

At some point the flow will call the Crew:

> crew = DataCollectorCrew().crew()  
> result = await crew.kickoff\_async(inputs=inputs)

In the Crew I tried to disable the memory or use an external memory with mem0 (using a different userId for each execution), but in both case I am getting the same problem.

---

<div class="post-metadata">

**Author:** ![cristian\_di\_febo](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/cristian_di_febo/32/3639_2.png) [@cristian\_di\_febo](https://community.crewai.com/u/cristian_di_febo)\
**Post date:** [July 1, 2025, 10:15am UTC](https://community.crewai.com/t/crewai-memories-multi-users-environment-conversational-history/4237/11 "2025-07-01T10:15:04Z")

</div>

I am using PDFSearchTool. Could this be a problem related to the tool’s cache behaviour?

Looking at the logs, I notice some incorrect behaviour on the part of the tool.

For example, if we have three users (A, B and C), each of whom uploads three different documents (mutually X, Y, Z). After user A uploads document X, for all subsequent users, the PDFSearchTool always returns the content of document X, ignoring the documents uploaded by the other users.

I also tried to disable the cache in the Crew and in the Agent, but didn’t work.

---

<div class="post-metadata">

**Author:** ![zinyando](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/zinyando/32/4435_2.png) [@zinyando](https://community.crewai.com/u/zinyando)\
**Post date:** [July 1, 2025, 12:03pm UTC](https://community.crewai.com/t/crewai-memories-multi-users-environment-conversational-history/4237/12 "2025-07-01T12:03:31Z")

</div>

I don’t know how users will use your app but have you tried running the uploads as a background job instead if processing is taking too much time. This allows the request to complete ie no more 504, then you can send the results back to the user when the processing is finished.

You could use WebSocket for that is you want, you just need to make sure you send the right results to the right connection. This is not really a CrewAI problem but more of a software engineering/architecture problem.

---

<div class="post-metadata">

**Author:** ![cristian\_di\_febo](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/cristian_di_febo/32/3639_2.png) [@cristian\_di\_febo](https://community.crewai.com/u/cristian_di_febo)\
**Post date:** [July 1, 2025, 12:23pm UTC](https://community.crewai.com/t/crewai-memories-multi-users-environment-conversational-history/4237/13 "2025-07-01T12:23:27Z")

</div>

> [@zinyando](#):
>
> ould use WebSocket for that is you want, you just need to make sure you send the right results to the right connection

What you described is exactly how it works, as it currently stands.

In the CrewAI logs, I can see that the response from the pdfSearchTool, after the first document, always remains the same even for different documents, as if the tool were retrieving data from a cache. So I don’t know if I’m using the tool incorrectly.
