VRSEN / agency-swarm

The only reliable agent framework built on top of the latest OpenAI Assistants API.
https://vrsen.github.io/agency-swarm/
MIT License
2.74k stars 727 forks source link

Insufficient support managing multiple threads when several users interact with the same agency simultaneously. #163

Closed orenneiberg closed 1 month ago

orenneiberg commented 3 months ago

I have encountered a limitation in the Agncy class, specifically within the get_completion method. This method interacts with the Assistant API but does not currently support managing multiple threads effectively when several users interact with the same agency simultaneously.

The core of the issue lies in the inability to manage conversation threads and shared states uniquely for each user. This leads to potential conflicts or incorrect handling of state when multiple users interact with the agency concurrently.

Proposed Change: I propose adding an enhancement to the get_completion method allowing it to accept a thread_id argument. This would enable:

Thread-specific interaction history management: By passing a unique thread_id per user session, the library can maintain separate interaction histories, ensuring that responses and states are correctly handled on a per-user basis.

State management enhancement: Alongside the thread management, modifying the shared state handling to be thread-specific would prevent users from affecting each other’s state during concurrent interactions.

Example: Here's a simple example of how the enhanced method could be called: response = agency.get_completion(prompt="Hello, how can I assist you today?", thread_id=user_session_id)

SwapnaliDhotre12 commented 3 months ago

Great suggesstion! I faced the same issue and was thinking of using async thread instead of thread in agency class

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 30 days with no activity. Please upgrade to the latest version and test it again.

github-actions[bot] commented 1 month ago

This issue was closed because it has been inactive for 14 days since being marked as stale. If the issue still persists, please reopen.