You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 4.1 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # Multi Agent Orchestration, Distributed Agent Runtime Example
  2. This repository is an example of how to run a distributed agent runtime. The system is composed of three main components:
  3. 1. The agent host runtime, which is responsible for managing the eventing engine, and the pub/sub message system.
  4. 2. The worker runtime, which is responsible for the lifecycle of the distributed agents, including the "semantic router".
  5. 3. The user proxy, which is responsible for managing the user interface and the user interactions with the agents.
  6. ## Example Scenario
  7. In this example, we have a simple scenario where we have a set of distributed agents (an "HR", and a "Finance" agent) which an enterprise may use to manage their HR and Finance operations. Each of these agents are independent, and can be running on different machines. While many multi-agent systems are built to have the agents collaborate to solve a difficult task - the goal of this example is to show how an enterprise may manage a large set of agents that are suited to individual tasks, and how to route a user to the most relevant agent for the task at hand.
  8. The way this system is designed, when a user initiates a session, the semantic router agent will identify the intent of the user (currently using the overly simple method of string matching), identify the most relevant agent, and then route the user to that agent. The agent will then manage the conversation with the user, and the user will be able to interact with the agent in a conversational manner.
  9. While the logic of the agents is simple in this example, the goal is to show how the distributed runtime capabilities of autogen supports this scenario independantly of the capabilities of the agents themselves.
  10. ## Getting Started
  11. 1. Install `autogen-core` and its dependencies
  12. ## To run
  13. Since this example is meant to demonstrate a distributed runtime, the components of this example are meant to run in different processes - i.e. different terminals.
  14. In 2 separate terminals, run:
  15. ```bash
  16. # Terminal 1, to run the Agent Host Runtime
  17. python run_host.py
  18. ```
  19. ```bash
  20. # Terminal 2, to run the Worker Runtime
  21. python run_semantic_router.py
  22. ```
  23. The first terminal should log a series of events where the vrious agents are registered
  24. against the runtime.
  25. In the second terminal, you may enter a request related to finance or hr scenarios.
  26. In our simple example here, this means using one of the following keywords in your request:
  27. - For the finance agent: "finance", "money", "budget"
  28. - For the hr agent: "hr", "human resources", "employee"
  29. You will then see the host and worker runtimes send messages back and forth, routing to the correct
  30. agent, before the final response is printed.
  31. The conversation can then continue with the selected agent until the user sends a message containing "END",at which point the agent will be disconnected from the user and a new conversation can start.
  32. ## Message Flow
  33. Using the "Topic" feature of the agent host runtime, the message flow of the system is as follows:
  34. ```mermaid
  35. sequenceDiagram
  36. participant User
  37. participant Closure_Agent
  38. participant User_Proxy_Agent
  39. participant Semantic_Router
  40. participant Worker_Agent
  41. User->>User_Proxy_Agent: Send initial message
  42. Semantic_Router->>Worker_Agent: Route message to appropriate agent
  43. Worker_Agent->>User_Proxy_Agent: Respond to user message
  44. User_Proxy_Agent->>Closure_Agent: Forward message to externally facing Closure Agent
  45. Closure_Agent->>User: Expose the response to the User
  46. User->>Worker_Agent: Directly send follow up message
  47. Worker_Agent->>User_Proxy_Agent: Respond to user message
  48. User_Proxy_Agent->>Closure_Agent: Forward message to externally facing Closure Agent
  49. Closure_Agent->>User: Return response
  50. User->>Worker_Agent: Send "END" message
  51. Worker_Agent->>User_Proxy_Agent: Confirm session end
  52. User_Proxy_Agent->>Closure_Agent: Confirm session end
  53. Closure_Agent->>User: Display session end message
  54. ```
  55. ### Contributors
  56. - Diana Iftimie (@diftimieMSFT)
  57. - Oscar Fimbres (@ofimbres)
  58. - Taylor Rockey (@tarockey)