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 3.0 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # Building a Multi-Agent Application with AutoGen and Chainlit
  2. In this sample, we will demonstrate how to build simple chat interface that
  3. interacts with an [AgentChat](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/index.html)
  4. agent or a team, using [Chainlit](https://github.com/Chainlit/chainlit),
  5. and support streaming messages.
  6. ## Installation
  7. To run this sample, you will need to install the following packages:
  8. ```shell
  9. pip install -U chainlit autogen-agentchat autogen-ext[openai] pyyaml
  10. ```
  11. To use other model providers, you will need to install a different extra
  12. for the `autogen-ext` package.
  13. See the [Models documentation](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/models.html) for more information.
  14. ## Model Configuration
  15. Create a configuration file named `model_config.yaml` to configure the model
  16. you want to use. Use `model_config_template.yaml` as a template.
  17. ## Running the Agent Sample
  18. The first sample demonstrate how to interact with a single AssistantAgent
  19. from the chat interface.
  20. ```shell
  21. chainlit run app_agent.py -h
  22. ```
  23. You can use one of the starters. For example, ask "What the weather in Seattle?".
  24. The agent will respond by first using the tools provided and then reflecting
  25. on the result of the tool execution.
  26. ## Running the Team Sample
  27. The second sample demonstrate how to interact with a team of agents from the
  28. chat interface.
  29. ```shell
  30. chainlit run app_team.py -h
  31. ```
  32. You can use one of the starters. For example, ask "Write a poem about winter.".
  33. The team is a RoundRobinGroupChat, so each agent will respond in turn.
  34. There are two agents in the team: one is instructed to be generally helpful
  35. and the other one is instructed to be a critic and provide feedback.
  36. The two agents will respond in round-robin fashion until
  37. the 'APPROVE' is mentioned by the critic agent.
  38. ## Running the Team Sample with UserProxyAgent
  39. The third sample demonstrate how to interact with a team of agents including
  40. a [UserProxyAgent](https://microsoft.github.io/autogen/stable/reference/python/autogen_agentchat.agents.html#autogen_agentchat.agents.UserProxyAgent)
  41. for approval or rejection.
  42. ```shell
  43. chainlit run app_team_user_proxy.py -h
  44. ```
  45. You can use one of the starters. For example, ask "Write code to reverse a string.".
  46. By default, the `UserProxyAgent` will request an input action from the user
  47. to approve or reject the response from the team.
  48. When the user approves the response, the `UserProxyAgent` will send a message
  49. to the team containing the text "APPROVE", and the team will stop responding.
  50. ## Next Steps
  51. There are a few ways you can extend this example:
  52. - Try other [agents](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/agents.html).
  53. - Try other [team](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/teams.html) types beyond the `RoundRobinGroupChat`.
  54. - Explore custom agents that sent multimodal messages.