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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. from autogen import AssistantAgent, UserProxyAgent
  35. llm_config = {"model": "gpt-4", "api_key": os.environ["OPENAI_API_KEY"]}
  36. assistant = AssistantAgent("assistant", llm_config=llm_config)
  37. user_proxy = UserProxyAgent("user_proxy", code_execution_config=False)
  38. # Start the chat
  39. user_proxy.initiate_chat(
  40. assistant,
  41. message="Tell me a joke about NVDA and TESLA stock prices.",
  42. )
  43. ```
  44. </TabItem>
  45. <TabItem value="local" label="Local execution" default>
  46. :::warning
  47. When asked, be sure to check the generated code before continuing to ensure it is safe to run.
  48. :::
  49. ```python
  50. import autogen
  51. from autogen import AssistantAgent, UserProxyAgent
  52. llm_config = {"model": "gpt-4", "api_key": os.environ["OPENAI_API_KEY"]}
  53. assistant = AssistantAgent("assistant", llm_config=llm_config)
  54. user_proxy = UserProxyAgent(
  55. "user_proxy", code_execution_config={"executor": autogen.coding.LocalCommandLineCodeExecutor(work_dir="coding")}
  56. )
  57. # Start the chat
  58. user_proxy.initiate_chat(
  59. assistant,
  60. message="Plot a chart of NVDA and TESLA stock price change YTD.",
  61. )
  62. ```
  63. </TabItem>
  64. <TabItem value="docker" label="Docker execution" default>
  65. ```python
  66. import autogen
  67. from autogen import AssistantAgent, UserProxyAgent
  68. llm_config = {"model": "gpt-4", "api_key": os.environ["OPENAI_API_KEY"]}
  69. with autogen.coding.DockerCommandLineCodeExecutor(work_dir="coding") as code_executor:
  70. assistant = AssistantAgent("assistant", llm_config=llm_config)
  71. user_proxy = UserProxyAgent(
  72. "user_proxy", code_execution_config={"executor": code_executor}
  73. )
  74. # Start the chat
  75. user_proxy.initiate_chat(
  76. assistant,
  77. message="Plot a chart of NVDA and TESLA stock price change YTD. Save the plot to a file called plot.png",
  78. )
  79. ```
  80. Open `coding/plot.png` to see the generated plot.
  81. </TabItem>
  82. </Tabs>
  83. :::tip
  84. Learn more about configuring LLMs for agents [here](/docs/topics/llm_configuration).
  85. :::
  86. #### Multi-Agent Conversation Framework
  87. 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.
  88. 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),
  89. The figure below shows an example conversation flow with AutoGen.
  90. ![Agent Chat Example](/img/chat_example.png)
  91. ### Where to Go Next?
  92. - Go through the [tutorial](/docs/tutorial/introduction) to learn more about the core concepts in AutoGen
  93. - Read the examples and guides in the [notebooks section](/docs/notebooks)
  94. - Understand the use cases for [multi-agent conversation](/docs/Use-Cases/agent_chat) and [enhanced LLM inference](/docs/Use-Cases/enhanced_inference)
  95. - Read the [API](/docs/reference/agentchat/conversable_agent/) docs
  96. - Learn about [research](/docs/Research) around AutoGen
  97. - Chat on [Discord](https://aka.ms/autogen-dc)
  98. - Follow on [Twitter](https://twitter.com/pyautogen)
  99. - See our [roadmaps](https://aka.ms/autogen-roadmap)
  100. 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).
  101. <iframe
  102. src="https://ghbtns.com/github-btn.html?user=microsoft&amp;repo=autogen&amp;type=star&amp;count=true&amp;size=large"
  103. frameborder="0"
  104. scrolling="0"
  105. width="170"
  106. height="30"
  107. title="GitHub"
  108. ></iframe>