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.

Getting-Started.mdx 5.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. import Tabs from "@theme/Tabs";
  2. import TabItem from "@theme/TabItem";
  3. # Getting Started
  4. AutoGen is a framework that enables development of LLM applications using
  5. multiple agents that can converse with each other to solve tasks. AutoGen agents
  6. are customizable, conversable, and seamlessly allow human participation. They
  7. can operate in various modes that employ combinations of LLMs, human inputs, and
  8. tools.
  9. ![AutoGen Overview](/img/autogen_agentchat.png)
  10. ### Main Features
  11. - AutoGen enables building next-gen LLM applications based on [multi-agent
  12. conversations](/docs/Use-Cases/agent_chat) with minimal effort. It simplifies
  13. the orchestration, automation, and optimization of a complex LLM workflow. It
  14. maximizes the performance of LLM models and overcomes their weaknesses.
  15. - It supports [diverse conversation
  16. patterns](/docs/Use-Cases/agent_chat#supporting-diverse-conversation-patterns)
  17. for complex workflows. With customizable and conversable agents, developers can
  18. use AutoGen to build a wide range of conversation patterns concerning
  19. conversation autonomy, the number of agents, and agent conversation topology.
  20. - It provides a collection of working systems with different complexities. These
  21. systems span a [wide range of
  22. applications](/docs/Use-Cases/agent_chat#diverse-applications-implemented-with-autogen)
  23. from various domains and complexities. This demonstrates how AutoGen can
  24. easily support diverse conversation patterns.
  25. AutoGen is powered by collaborative [research studies](/docs/Research) from
  26. Microsoft, Penn State University, and University of Washington.
  27. ### Quickstart
  28. ```sh
  29. pip install pyautogen
  30. ```
  31. <Tabs>
  32. <TabItem value="nocode" label="No code execution" default>
  33. ```python
  34. import os
  35. from autogen import AssistantAgent, UserProxyAgent
  36. llm_config = {"model": "gpt-4", "api_key": os.environ["OPENAI_API_KEY"]}
  37. assistant = AssistantAgent("assistant", llm_config=llm_config)
  38. user_proxy = UserProxyAgent("user_proxy", code_execution_config=False)
  39. # Start the chat
  40. user_proxy.initiate_chat(
  41. assistant,
  42. message="Tell me a joke about NVDA and TESLA stock prices.",
  43. )
  44. ```
  45. </TabItem>
  46. <TabItem value="local" label="Local execution" default>
  47. :::warning
  48. When asked, be sure to check the generated code before continuing to ensure it is safe to run.
  49. :::
  50. ```python
  51. import os
  52. import autogen
  53. from autogen import AssistantAgent, UserProxyAgent
  54. llm_config = {"model": "gpt-4", "api_key": os.environ["OPENAI_API_KEY"]}
  55. assistant = AssistantAgent("assistant", llm_config=llm_config)
  56. user_proxy = UserProxyAgent(
  57. "user_proxy", code_execution_config={"executor": autogen.coding.LocalCommandLineCodeExecutor(work_dir="coding")}
  58. )
  59. # Start the chat
  60. user_proxy.initiate_chat(
  61. assistant,
  62. message="Plot a chart of NVDA and TESLA stock price change YTD.",
  63. )
  64. ```
  65. </TabItem>
  66. <TabItem value="docker" label="Docker execution" default>
  67. ```python
  68. import os
  69. import autogen
  70. from autogen import AssistantAgent, UserProxyAgent
  71. llm_config = {"model": "gpt-4", "api_key": os.environ["OPENAI_API_KEY"]}
  72. with autogen.coding.DockerCommandLineCodeExecutor(work_dir="coding") as code_executor:
  73. assistant = AssistantAgent("assistant", llm_config=llm_config)
  74. user_proxy = UserProxyAgent(
  75. "user_proxy", code_execution_config={"executor": code_executor}
  76. )
  77. # Start the chat
  78. user_proxy.initiate_chat(
  79. assistant,
  80. message="Plot a chart of NVDA and TESLA stock price change YTD. Save the plot to a file called plot.png",
  81. )
  82. ```
  83. Open `coding/plot.png` to see the generated plot.
  84. </TabItem>
  85. </Tabs>
  86. :::tip
  87. Learn more about configuring LLMs for agents [here](/docs/topics/llm_configuration).
  88. :::
  89. #### Multi-Agent Conversation Framework
  90. Autogen enables the next-gen LLM applications with a generic multi-agent conversation framework. It offers customizable and conversable agents which integrate LLMs, tools, and humans.
  91. By automating chat among multiple capable agents, one can easily make them collectively perform tasks autonomously or with human feedback, including tasks that require using tools via code. For [example](https://github.com/microsoft/autogen/blob/main/test/twoagent.py),
  92. The figure below shows an example conversation flow with AutoGen.
  93. ![Agent Chat Example](/img/chat_example.png)
  94. ### Where to Go Next?
  95. - Go through the [tutorial](/docs/tutorial/introduction) to learn more about the core concepts in AutoGen
  96. - Read the examples and guides in the [notebooks section](/docs/notebooks)
  97. - Understand the use cases for [multi-agent conversation](/docs/Use-Cases/agent_chat) and [enhanced LLM inference](/docs/Use-Cases/enhanced_inference)
  98. - Read the [API](/docs/reference/agentchat/conversable_agent/) docs
  99. - Learn about [research](/docs/Research) around AutoGen
  100. - Chat on [Discord](https://aka.ms/autogen-dc)
  101. - Follow on [Twitter](https://twitter.com/pyautogen)
  102. - See our [roadmaps](https://aka.ms/autogen-roadmap)
  103. If you like our project, please give it a [star](https://github.com/microsoft/autogen/stargazers) on GitHub. If you are interested in contributing, please read [Contributor's Guide](/docs/contributor-guide/contributing).
  104. <iframe
  105. src="https://ghbtns.com/github-btn.html?user=microsoft&amp;repo=autogen&amp;type=star&amp;count=true&amp;size=large"
  106. frameborder="0"
  107. scrolling="0"
  108. width="170"
  109. height="30"
  110. title="GitHub"
  111. ></iframe>