microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
32.38k stars 4.72k forks source link

[Issue]: How to Store Multiple Autogen Agents and Histories in Azure for Multi-User Environment #3302

Open chenna-nefer opened 2 months ago

chenna-nefer commented 2 months ago

Describe the issue

I created an agentic workflow using Autogen, where multiple agents are stored in global variables and used as required. This worked well locally, but now I'm moving to a multi-user environment and setting up authentication for multiple users. I'm facing challenges on how to store these agents and their histories in Azure for each user.

What I’ve Tried:

Blob Storage: Successfully stored chat history in .pkl files in Azure Blob Storage. MongoDB: Attempted to use MongoDB for storing chat histories and agent configurations but struggled to store the agents themselves.

How can I efficiently manage the storage and retrieval of these multiple autogen agents and chat histories in Azure to ensure scalability and persistent storage? Are there best practices or existing solutions for storing multiple agents and their configurations in a database like MongoDB or any other recommended storage solutions?

Steps to reproduce

No response

Screenshots and logs

No response

Additional Information

No response

giannisha commented 2 months ago

Hi @chenna-nefer. This doesn't seem so an Autogen issue. Can you give some context on how you are running your agentic workflow on Azure? Have you packaged it in a web api (e.g. Flask) or sth like Prompflow ?

chenna-nefer commented 2 months ago

Hi @giannisha

I’m running the agentic workflow on Azure packaged as a Flask web API.

Additional Context:

Setup: Multiple agents managed and stored in global variables, now transitioning to a multi-user environment. Storage Attempts: Blob Storage: Successfully storing chat histories in .pkl files. MongoDB: Facing issues with storing agents due to unserializable registered functions. Challenges:

Efficiently storing and retrieving agents and chat histories for multiple users. Ensuring scalability and persistent storage. Questions:

Best practices for storing multiple agents and their configurations in a database like MongoDB or other solutions? Should I consider dynamically creating agents each time a user interacts with them, storing only the message history and state?

giannisha commented 2 months ago

@chenna-nefer thanks for the extra info! What do you want to accomplish by keeping the same agent instance?

This seems to me a more logical approach. You can consider also dependency-injector to better handle singleton and transient instances in your Flask api.

Should I consider dynamically creating agents each time a user interacts with them, storing only the message history and state?