<a name="readme-top"></a>
[![PyPI version](https://badge.fury.io/py/autogen.svg)](https://badge.fury.io/py/autogen)
[![Build](https://github.com/ag2ai/ag2/actions/workflows/python-package.yml/badge.svg)](https://github.com/ag2ai/ag2/actions/workflows/python-package.yml)
![Python Version](https://img.shields.io/badge/3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)
[![Discord](https://img.shields.io/discord/1153072414184452236?logo=discord&style=flat)](https://discord.gg/pAbnFJrkgZ)
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Follow%20%40ag2ai)](https://x.com/ag2ai)
<!-- [![NuGet version](https://badge.fury.io/nu/AutoGen.Core.svg)](https://badge.fury.io/nu/AutoGen.Core) -->
# [AG2](https://github.com/ag2ai/ag2)
[📚 Cite paper](#related-papers).
<!-- <p align="center">
<img src="https://github.com/ag2ai/ag2/blob/main/website/static/img/flaml.svg" width=200>
<br>
</p> -->
> [!IMPORTANT]
>
> :fire: :tada: Nov 11, 2024: We are evolving AutoGen into AG2! A new organization [ag2ai](https://github.com/ag2ai) is created to host the development of AG2 and related projects with open governance. We invite collaborators from all organizations and individuals to join the development.
:fire: :tada: AG2 is available via `ag2` (or its alias `autogen` or `pyautogen`) on PyPI! Starting with version 0.3.2, you can now install AG2 using:
```
pip install ag2
```
or
```
pip install pyautogen
```
or
```
pip install autogen
```
📄 **License:**
We adopt the Apache 2.0 license from v0.3. This enhances our commitment to open-source collaboration while providing additional protections for contributors and users alike.
:tada: May 29, 2024: DeepLearning.ai launched a new short course [AI Agentic Design Patterns with AutoGen](https://www.deeplearning.ai/short-courses/ai-agentic-design-patterns-with-autogen), made in collaboration with Microsoft and Penn State University, and taught by AutoGen creators [Chi Wang](https://github.com/sonichi) and [Qingyun Wu](https://github.com/qingyun-wu).
:tada: May 24, 2024: Foundation Capital published an article on [Forbes: The Promise of Multi-Agent AI](https://www.forbes.com/sites/joannechen/2024/05/24/the-promise-of-multi-agent-ai/?sh=2c1e4f454d97) and a video [AI in the Real World Episode 2: Exploring Multi-Agent AI and AutoGen with Chi Wang](https://www.youtube.com/watch?v=RLwyXRVvlNk).
:tada: May 13, 2024: [The Economist](https://www.economist.com/science-and-technology/2024/05/13/todays-ai-models-are-impressive-teams-of-them-will-be-formidable) published an article about multi-agent systems (MAS) following a January 2024 interview with [Chi Wang](https://github.com/sonichi).
:tada: May 11, 2024: [AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation](https://openreview.net/pdf?id=uAjxFFing2) received the best paper award at the [ICLR 2024 LLM Agents Workshop](https://llmagents.github.io/).
<!-- :tada: Apr 26, 2024: [AutoGen.NET](https://ag2ai.github.io/ag2-for-net/) is available for .NET developers! -->
:tada: Apr 17, 2024: Andrew Ng cited AutoGen in [The Batch newsletter](https://www.deeplearning.ai/the-batch/issue-245/) and [What's next for AI agentic workflows](https://youtu.be/sal78ACtGTc?si=JduUzN_1kDnMq0vF) at Sequoia Capital's AI Ascent (Mar 26).
:tada: Mar 3, 2024: What's new in AutoGen? 📰[Blog](https://ag2ai.github.io/ag2/blog/2024/03/03/AutoGen-Update); 📺[Youtube](https://www.youtube.com/watch?v=j_mtwQiaLGU).
<!-- :tada: Mar 1, 2024: the first AutoGen multi-agent experiment on the challenging [GAIA](https://huggingface.co/spaces/gaia-benchmark/leaderboard) benchmark achieved the No. 1 accuracy in all the three levels. -->
<!-- :tada: Jan 30, 2024: AutoGen is highlighted by Peter Lee in Microsoft Research Forum [Keynote](https://t.co/nUBSjPDjqD). -->
:tada: Dec 31, 2023: [AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation Framework](https://arxiv.org/abs/2308.08155) is selected by [TheSequence: My Five Favorite AI Papers of 2023](https://thesequence.substack.com/p/my-five-favorite-ai-papers-of-2023).
<!-- :fire: Nov 24: pyautogen [v0.2](https://github.com/microsoft/autogen/releases/tag/v0.2.0) is released with many updates and new features compared to v0.1.1. It switches to using openai-python v1. Please read the [migration guide](https://ag2ai.github.io/ag2/docs/Installation#python). -->
<!-- :fire: Nov 11: OpenAI's Assistants are available in AutoGen and interoperatable with other AutoGen agents! Checkout our [blogpost](https://ag2ai.github.io/ag2/blog/2023/11/13/OAI-assistants) for details and examples. -->
:tada: Nov 8, 2023: AutoGen is selected into [Open100: Top 100 Open Source achievements](https://www.benchcouncil.org/evaluation/opencs/annual.html) 35 days after spinoff from [FLAML](https://github.com/microsoft/FLAML).
<!-- :tada: Nov 6, 2023: AutoGen is mentioned by Satya Nadella in a [fireside chat](https://youtu.be/0pLBvgYtv6U). -->
<!-- :tada: Nov 1, 2023: AutoGen is the top trending repo on GitHub in October 2023. -->
<!-- :tada: Oct 03, 2023: AutoGen spins off from [FLAML](https://github.com/microsoft/FLAML) on GitHub. -->
<!-- :tada: Aug 16: Paper about AutoGen on [arxiv](https://arxiv.org/abs/2308.08155). -->
:tada: Mar 29, 2023: AutoGen is first created in [FLAML](https://github.com/microsoft/FLAML).
<!--
:fire: FLAML is highlighted in OpenAI's [cookbook](https://github.com/openai/openai-cookbook#related-resources-from-around-the-web).
:fire: [autogen](https://ag2ai.github.io/ag2/) is released with support for ChatGPT and GPT-4, based on [Cost-Effective Hyperparameter Optimization for Large Language Model Generation Inference](https://arxiv.org/abs/2303.04673).
:fire: FLAML supports Code-First AutoML & Tuning – Private Preview in [Microsoft Fabric Data Science](https://learn.microsoft.com/en-us/fabric/data-science/). -->
## What is AG2
AG2 (formally AutoGen) is an open-source programming framework for building AI agents and facilitating cooperation among multiple agents to solve tasks. AG2 aims to streamline the development and research of agentic AI, much like PyTorch does for Deep Learning. It offers features such as agents capable of interacting with each other, facilitates the use of various large language models (LLMs) and tool use support, autonomous and human-in-the-loop workflows, and multi-agent conversation patterns.
**Open Source Statement**: The project welcomes contributions from developers and organizations worldwide. Our goal is to foster a collaborative and inclusive community where diverse perspectives and expertise can drive innovation and enhance the project's capabilities. Whether you are an individual contributor or represent an organization, we invite you to join us in shaping the future of this project. Together, we can build something truly remarkable.
The project is currently maintained by a [dynamic group of volunteers](MAINTAINERS.md) from several organizations. Contact project administrators Chi Wang and Qingyun Wu via [support@ag2.ai](mailto:support@ag2.ai) if you are interested in becoming a maintainer.
![AutoGen Overview](./website/static/img/autogen_agentchat.png)
<p align="right" style="font-size: 14px; color: #555; margin-top: 20px;">
<a href="#readme-top" style="text-decoration: none; color: blue; font-weight: bold;">
↑ Back to Top ↑
</a>
</p>
<!--
## Roadmaps
-->
## Quickstart
The easiest way to start playing is
1. Click below to use the GitHub Codespace
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/ag2ai/ag2?quickstart=1)
2. Copy OAI_CONFIG_LIST_sample to ./notebook folder, name to OAI_CONFIG_LIST, and set the correct configuration.
3. Start playing with the notebooks!
*NOTE*: OAI_CONFIG_LIST_sample lists gpt-4o as the default model. If you use a different model, you may need to revise various system prompts (especially if using weaker models like gpt-4o-mini). Proceed with caution when updating this default and be aware of additional risks related to alignment and safety.
<p align="right" style="font-size: 14px; color: #555; margin-top: 20px;">
<a href="#readme-top" style="text-decoration: none; color: blue; font-weight: bold;">
↑ Back to Top ↑
</a>
</p>
## [Installation](https://ag2ai.github.io/ag2/docs/Installation)
### Option 1. Install and Run AG2 in Docker
Find detailed instructions for users [here](https://ag2ai.github.io/ag2/docs/installation/Docker#step-1-install-docker), and for developers [here](https://ag2ai.github.io/ag2/docs/Contribute#docker-for-development).
### Option 2. Install AG2 Locally
AG2 requires **Python version >= 3.8, < 3.13**. It can be installed from pip:
```bash
pip install ag2
```
Minimal dependencies are installed without extra options. You can install extra options based on the feature you need.
<!-- For example, use the following to install the dependencies needed by the [`blendsearch`](https://microsoft.github.io/FLAML/docs/Use-Cases/Tune-User-Defined-Function#blendsearch-economical-hyperparameter-optimization-with-blended-search-strategy) option.
```bash
pip install "autogen[blendsearch]"
``` -->
Find more options in [Installation](https://ag2ai.github.io/ag2/docs/Installation#option-2-install-autogen-locally-using-virtual-environment).
<!-- Each of the [`notebook examples`](https://github.com/ag2ai/ag2/tree/main/notebook) may require a specific option to be installed. -->
Even if you are installing and running AG2 locally outside of docker, the recommendation and default behavior of agents is to perform [code execution](https://ag2ai.github.io/ag2/docs/FAQ/#code-execution) in docker. Find more instructions and how to change the default behaviour [here](https://ag2ai.github.io/ag2/docs/Installation#code-execution-with-docker-(default)).
For LLM inference configurations, check the [FAQs](https://ag2ai.github.io/ag2/docs/FAQ#set-your-api-endpoints).
<p align="right" style="font-size: 14px; color: #555; margin-top: 20px;">
<a href="#readme-top" style="text-decoration: none; color: blue; font-weight: bold;">
↑ Back to Top ↑
</a>
</p>
## Multi-Agent Conversation Framework
AG2 enables the next-gen LLM applications with a generic [multi-agent conversation](https://ag2ai.github.io/ag2/docs/Use-Cases/agent_chat) framework. It offers customizable and conversable agents that integrate LLMs, tools, and humans.
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.
Features of this use case include:
- **Multi-agent conversations**: AG2 agents can communicate with each other to solve tasks. This allows for more complex and sophisticated applications than would be possible with a single LLM.
- **Customization**: AG2 agents can be customized to meet the specific needs of an application. This includes the ability to choose the LLMs to use, the types of human input to allow, and the tools to employ.
- **Human participation**: AG2 seamlessly allows human participation. This means that humans can provide input and feedback to the agents as needed.
For [example](https://github.com/ag2ai/ag2/blob/main/test/twoagent.py),
```python
from autogen import AssistantAgent, UserProxyAgent, config_list_from_json
# Load LLM inference endpoints from an env variable or a file
# See https://ag2ai.github.io/ag2/docs/FAQ#set-your-api-endpoints
# and OAI_CONFIG_LIST_sample
config_list = config_list_from_json(env_or_file="OAI_CONFIG_LIST")
# You can also set config_list directly as a list, for example, config_list = [{'model': 'gpt-4o', 'api_key': '<your OpenAI API key here>'},]
assistant = AssistantAgent("assistant", llm_config={"config_list": config_list})
user_proxy = UserProxyAgent("user_proxy", code_execution_config={"work_dir": "coding", "use_docker": False}) # IMPORTANT: set to True to run code in docker, recommended
user_proxy.initiate_chat(assistant, message="Plot a chart of NVDA and TESLA stock price change YTD.")
# This initiates an automated chat between the two agents to solve the task
```
This example can be run with
```python
python test/twoagent.py
```
After the repo is cloned.
The figure below shows an example conversation flow with AG2.
![Agent Chat Example](./website/static/img/chat_example.png)
Alternatively, the [sample code](https://github.com/ag2ai/build-with-autogen/blob/main/samples/simple_chat.py) here allows a user to chat with an AG2 agent in ChatGPT style.
Please find more [code examples](https://ag2ai.github.io/ag2/docs/Examples#automated-multi-agent-chat) for this feature.
<p align="right" style="font-size: 14px; color: #555; margin-top: 20px;">
<a href="#readme-top" style="text-decoration: none; color: blue; font-weight: bold;">
↑ Back to Top ↑
</a>
</p>
## Enhanced LLM Inferences
AG2 also helps maximize the utility out of the expensive LLMs such as gpt-4o. It offers [enhanced LLM inference](https://ag2ai.github.io/ag2/docs/Use-Cases/enhanced_inference#api-unification) with powerful functionalities like caching, error handling, multi-config inference and templating.
<!-- For example, you can optimize generations by LLM with your own tuning data, success metrics, and budgets.
```python
# perform tuning for openai<1
config, analysis = autogen.Completion.tune(
data=tune_data,
metric="success",
mode="max",
eval_func=eval_func,
inference_budget=0.05,
optimization_budget=3,
num_samples=-1,
)
# perform inference for a test instance
response = autogen.Completion.create(context=test_instance, **config)
```
Please find more [code examples](https://ag2ai.github.io/ag2/docs/Examples#tune-gpt-models) for this feature. -->
<p align="right" style="font-size: 14px; color: #555; margin-top: 20px;">
<a href="#readme-top" style="text-decoration: none; color: blue; font-weight: bold;">
↑ Back to Top ↑
</a>
</p>
## Documentation
You can find detailed documentation about AG2 [here](https://ag2ai.github.io/ag2/).
In addition, you can find:
- [Research](https://ag2ai.github.io/ag2/docs/Research), [blogposts](https://ag2ai.github.io/ag2/blog) around AG2, and [Transparency FAQs](https://github.com/ag2ai/ag2/blob/main/TRANSPARENCY_FAQS.md)
- [Discord](https://discord.gg/pAbnFJrkgZ)
- [Contributing guide](https://ag2ai.github.io/ag2/docs/Contribute)
<p align="right" style="font-size: 14px; color: #555; margin-top: 20px;">
<a href="#readme-top" style="text-decoration: none; color: blue; font-weight: bold;">
↑ Back to Top ↑
</a>
</p>
## CookBook
Explore detailed implementations with sample code and applications to help you get started with AG2.
[Cookbook](https://github.com/ag2ai/build-with-autogen)
## Related Papers
[AG2](https://arxiv.org/abs/2308.08155)
```
@inproceedings{wu2023autogen,
title={AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation Framework},
author={Qingyun Wu and Gagan Bansal and Jieyu Zhang and Yiran Wu and Beibin Li and Erkang Zhu and Li Jiang and Xiaoyun Zhang and Shaokun Zhang and Jiale Liu and Ahmed Hassan Awadallah and Ryen W White and Doug Burger and Chi Wang},
year={2023},
eprint={2308.08155},
archivePrefix={arXiv},
primaryClass={cs.AI}
}
```
[EcoOptiGen](https://arxiv.org/abs/2303.04673)
```
@inproceedings{wang2023EcoOptiGen,
title={Cost-Effective Hyperparameter Optimization for Large Language Model Generation Inference},
author={Chi Wang and Susan Xueqing Liu and Ahmed H. Awadallah},
year={2023},
booktitle={AutoML'23},
}
```
[MathChat](https://arxiv.org/abs/2306.01337)
```
@inproceedings{wu2023empirical,
title={An Empirical Study on Challenging Math Problem Solving with GPT-4},
author={Yiran Wu and Feiran Jia and Shaokun Zhang and Hangyu Li and Erkang Zhu and Yue Wang and Yin Tat Lee and Richard Peng and Qingyun Wu and Chi Wang},
year={2023},
booktitle={ArXiv preprint arXiv:2306.01337},
}
```
[AgentOptimizer](https://arxiv.org/pdf/2402.11359)
```
@article{zhang2024training,
title={Training Language Model Agents without Modifying Language Models},
author={Zhang, Shaokun and Zhang, Jieyu and Liu, Jiale and Song, Linxin and Wang, Chi and Krishna, Ranjay and Wu, Qingyun},
journal={ICML'24},
year={2024}
}
```
[StateFlow](https://arxiv.org/abs/2403.11322)
```
@article{wu2024stateflow,
title={StateFlow: Enhancing LLM Task-Solving through State-Driven Workflows},
author={Wu, Yiran and Yue, Tianwei and Zhang, Shaokun and Wang, Chi and Wu, Qingyun},
journal={arXiv preprint arXiv:2403.11322},
year={2024}
}
```
<p align="right" style="font-size: 14px; color: #555; margin-top: 20px;">
<a href="#readme-top" style="text-decoration: none; color: blue; font-weight: bold;">
↑ Back to Top ↑
</a>
</p>
## Contributors Wall
<a href="https://github.com/ag2ai/ag2/graphs/contributors">
<img src="https://contrib.rocks/image?repo=ag2ai/ag2&max=204" />
</a>
<p align="right" style="font-size: 14px; color: #555; margin-top: 20px;">
<a href="#readme-top" style="text-decoration: none; color: blue; font-weight: bold;">
↑ Back to Top ↑
</a>
</p>
## License
This project is licensed under the [Apache License, Version 2.0 (Apache-2.0)](./LICENSE).
This project is a spin-off of https://github.com/microsoft/autogen and contains code under two licenses:
- The original code from https://github.com/microsoft/autogen is licensed under the MIT License. See the [LICENSE_original_MIT](./license_original/LICENSE_original_MIT) file for details.
- Modifications and additions made in this fork are licensed under the Apache License, Version 2.0. See the [LICENSE](./LICENSE) file for the full license text.
We have documented these changes for clarity and to ensure transparency with our user and contributor community. For more details, please see the [NOTICE](./NOTICE.md) file.
Raw data
{
"_id": null,
"home_page": "https://github.com/ag2ai/ag2",
"name": "autogen",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Chi Wang & Qingyun Wu",
"author_email": "support@ag2.ai",
"download_url": "https://files.pythonhosted.org/packages/7b/e8/33b7fb072fbcf63b8a1b5bbba15570e4e8c86d6374da398889b92fc420c8/autogen-0.3.2.tar.gz",
"platform": null,
"description": "<a name=\"readme-top\"></a>\n\n[![PyPI version](https://badge.fury.io/py/autogen.svg)](https://badge.fury.io/py/autogen)\n[![Build](https://github.com/ag2ai/ag2/actions/workflows/python-package.yml/badge.svg)](https://github.com/ag2ai/ag2/actions/workflows/python-package.yml)\n![Python Version](https://img.shields.io/badge/3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)\n[![Discord](https://img.shields.io/discord/1153072414184452236?logo=discord&style=flat)](https://discord.gg/pAbnFJrkgZ)\n[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Follow%20%40ag2ai)](https://x.com/ag2ai)\n\n<!-- [![NuGet version](https://badge.fury.io/nu/AutoGen.Core.svg)](https://badge.fury.io/nu/AutoGen.Core) -->\n\n# [AG2](https://github.com/ag2ai/ag2)\n\n[\ud83d\udcda Cite paper](#related-papers).\n<!-- <p align=\"center\">\n <img src=\"https://github.com/ag2ai/ag2/blob/main/website/static/img/flaml.svg\" width=200>\n <br>\n</p> -->\n\n> [!IMPORTANT]\n>\n> :fire: :tada: Nov 11, 2024: We are evolving AutoGen into AG2! A new organization [ag2ai](https://github.com/ag2ai) is created to host the development of AG2 and related projects with open governance. We invite collaborators from all organizations and individuals to join the development.\n\n\n:fire: :tada: AG2 is available via `ag2` (or its alias `autogen` or `pyautogen`) on PyPI! Starting with version 0.3.2, you can now install AG2 using:\n```\npip install ag2\n```\nor\n```\npip install pyautogen\n```\nor\n```\npip install autogen\n```\n\n\n\ud83d\udcc4 **License:**\nWe adopt the Apache 2.0 license from v0.3. This enhances our commitment to open-source collaboration while providing additional protections for contributors and users alike.\n\n\n:tada: May 29, 2024: DeepLearning.ai launched a new short course [AI Agentic Design Patterns with AutoGen](https://www.deeplearning.ai/short-courses/ai-agentic-design-patterns-with-autogen), made in collaboration with Microsoft and Penn State University, and taught by AutoGen creators [Chi Wang](https://github.com/sonichi) and [Qingyun Wu](https://github.com/qingyun-wu).\n\n:tada: May 24, 2024: Foundation Capital published an article on [Forbes: The Promise of Multi-Agent AI](https://www.forbes.com/sites/joannechen/2024/05/24/the-promise-of-multi-agent-ai/?sh=2c1e4f454d97) and a video [AI in the Real World Episode 2: Exploring Multi-Agent AI and AutoGen with Chi Wang](https://www.youtube.com/watch?v=RLwyXRVvlNk).\n\n:tada: May 13, 2024: [The Economist](https://www.economist.com/science-and-technology/2024/05/13/todays-ai-models-are-impressive-teams-of-them-will-be-formidable) published an article about multi-agent systems (MAS) following a January 2024 interview with [Chi Wang](https://github.com/sonichi).\n\n:tada: May 11, 2024: [AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation](https://openreview.net/pdf?id=uAjxFFing2) received the best paper award at the [ICLR 2024 LLM Agents Workshop](https://llmagents.github.io/).\n\n<!-- :tada: Apr 26, 2024: [AutoGen.NET](https://ag2ai.github.io/ag2-for-net/) is available for .NET developers! -->\n\n:tada: Apr 17, 2024: Andrew Ng cited AutoGen in [The Batch newsletter](https://www.deeplearning.ai/the-batch/issue-245/) and [What's next for AI agentic workflows](https://youtu.be/sal78ACtGTc?si=JduUzN_1kDnMq0vF) at Sequoia Capital's AI Ascent (Mar 26).\n\n:tada: Mar 3, 2024: What's new in AutoGen? \ud83d\udcf0[Blog](https://ag2ai.github.io/ag2/blog/2024/03/03/AutoGen-Update); \ud83d\udcfa[Youtube](https://www.youtube.com/watch?v=j_mtwQiaLGU).\n\n<!-- :tada: Mar 1, 2024: the first AutoGen multi-agent experiment on the challenging [GAIA](https://huggingface.co/spaces/gaia-benchmark/leaderboard) benchmark achieved the No. 1 accuracy in all the three levels. -->\n\n<!-- :tada: Jan 30, 2024: AutoGen is highlighted by Peter Lee in Microsoft Research Forum [Keynote](https://t.co/nUBSjPDjqD). -->\n\n:tada: Dec 31, 2023: [AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation Framework](https://arxiv.org/abs/2308.08155) is selected by [TheSequence: My Five Favorite AI Papers of 2023](https://thesequence.substack.com/p/my-five-favorite-ai-papers-of-2023).\n\n<!-- :fire: Nov 24: pyautogen [v0.2](https://github.com/microsoft/autogen/releases/tag/v0.2.0) is released with many updates and new features compared to v0.1.1. It switches to using openai-python v1. Please read the [migration guide](https://ag2ai.github.io/ag2/docs/Installation#python). -->\n\n<!-- :fire: Nov 11: OpenAI's Assistants are available in AutoGen and interoperatable with other AutoGen agents! Checkout our [blogpost](https://ag2ai.github.io/ag2/blog/2023/11/13/OAI-assistants) for details and examples. -->\n\n:tada: Nov 8, 2023: AutoGen is selected into [Open100: Top 100 Open Source achievements](https://www.benchcouncil.org/evaluation/opencs/annual.html) 35 days after spinoff from [FLAML](https://github.com/microsoft/FLAML).\n\n<!-- :tada: Nov 6, 2023: AutoGen is mentioned by Satya Nadella in a [fireside chat](https://youtu.be/0pLBvgYtv6U). -->\n\n<!-- :tada: Nov 1, 2023: AutoGen is the top trending repo on GitHub in October 2023. -->\n\n<!-- :tada: Oct 03, 2023: AutoGen spins off from [FLAML](https://github.com/microsoft/FLAML) on GitHub. -->\n\n<!-- :tada: Aug 16: Paper about AutoGen on [arxiv](https://arxiv.org/abs/2308.08155). -->\n\n:tada: Mar 29, 2023: AutoGen is first created in [FLAML](https://github.com/microsoft/FLAML).\n\n<!--\n:fire: FLAML is highlighted in OpenAI's [cookbook](https://github.com/openai/openai-cookbook#related-resources-from-around-the-web).\n\n:fire: [autogen](https://ag2ai.github.io/ag2/) is released with support for ChatGPT and GPT-4, based on [Cost-Effective Hyperparameter Optimization for Large Language Model Generation Inference](https://arxiv.org/abs/2303.04673).\n\n:fire: FLAML supports Code-First AutoML & Tuning \u2013 Private Preview in [Microsoft Fabric Data Science](https://learn.microsoft.com/en-us/fabric/data-science/). -->\n\n## What is AG2\n\nAG2 (formally AutoGen) is an open-source programming framework for building AI agents and facilitating cooperation among multiple agents to solve tasks. AG2 aims to streamline the development and research of agentic AI, much like PyTorch does for Deep Learning. It offers features such as agents capable of interacting with each other, facilitates the use of various large language models (LLMs) and tool use support, autonomous and human-in-the-loop workflows, and multi-agent conversation patterns.\n\n**Open Source Statement**: The project welcomes contributions from developers and organizations worldwide. Our goal is to foster a collaborative and inclusive community where diverse perspectives and expertise can drive innovation and enhance the project's capabilities. Whether you are an individual contributor or represent an organization, we invite you to join us in shaping the future of this project. Together, we can build something truly remarkable.\n\nThe project is currently maintained by a [dynamic group of volunteers](MAINTAINERS.md) from several organizations. Contact project administrators Chi Wang and Qingyun Wu via [support@ag2.ai](mailto:support@ag2.ai) if you are interested in becoming a maintainer.\n\n\n![AutoGen Overview](./website/static/img/autogen_agentchat.png)\n\n\n\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n \u2191 Back to Top \u2191\n </a>\n</p>\n\n<!--\n## Roadmaps\n-->\n\n## Quickstart\nThe easiest way to start playing is\n1. Click below to use the GitHub Codespace\n\n [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/ag2ai/ag2?quickstart=1)\n\n 2. Copy OAI_CONFIG_LIST_sample to ./notebook folder, name to OAI_CONFIG_LIST, and set the correct configuration.\n 3. Start playing with the notebooks!\n\n*NOTE*: OAI_CONFIG_LIST_sample lists gpt-4o as the default model. If you use a different model, you may need to revise various system prompts (especially if using weaker models like gpt-4o-mini). Proceed with caution when updating this default and be aware of additional risks related to alignment and safety.\n\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n \u2191 Back to Top \u2191\n </a>\n</p>\n\n## [Installation](https://ag2ai.github.io/ag2/docs/Installation)\n\n### Option 1. Install and Run AG2 in Docker\n\nFind detailed instructions for users [here](https://ag2ai.github.io/ag2/docs/installation/Docker#step-1-install-docker), and for developers [here](https://ag2ai.github.io/ag2/docs/Contribute#docker-for-development).\n\n### Option 2. Install AG2 Locally\n\nAG2 requires **Python version >= 3.8, < 3.13**. It can be installed from pip:\n\n```bash\npip install ag2\n```\n\nMinimal dependencies are installed without extra options. You can install extra options based on the feature you need.\n\n<!-- For example, use the following to install the dependencies needed by the [`blendsearch`](https://microsoft.github.io/FLAML/docs/Use-Cases/Tune-User-Defined-Function#blendsearch-economical-hyperparameter-optimization-with-blended-search-strategy) option.\n```bash\npip install \"autogen[blendsearch]\"\n``` -->\n\nFind more options in [Installation](https://ag2ai.github.io/ag2/docs/Installation#option-2-install-autogen-locally-using-virtual-environment).\n\n<!-- Each of the [`notebook examples`](https://github.com/ag2ai/ag2/tree/main/notebook) may require a specific option to be installed. -->\n\nEven if you are installing and running AG2 locally outside of docker, the recommendation and default behavior of agents is to perform [code execution](https://ag2ai.github.io/ag2/docs/FAQ/#code-execution) in docker. Find more instructions and how to change the default behaviour [here](https://ag2ai.github.io/ag2/docs/Installation#code-execution-with-docker-(default)).\n\nFor LLM inference configurations, check the [FAQs](https://ag2ai.github.io/ag2/docs/FAQ#set-your-api-endpoints).\n\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n \u2191 Back to Top \u2191\n </a>\n</p>\n\n## Multi-Agent Conversation Framework\n\nAG2 enables the next-gen LLM applications with a generic [multi-agent conversation](https://ag2ai.github.io/ag2/docs/Use-Cases/agent_chat) framework. It offers customizable and conversable agents that integrate LLMs, tools, and humans.\nBy 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.\n\nFeatures of this use case include:\n\n- **Multi-agent conversations**: AG2 agents can communicate with each other to solve tasks. This allows for more complex and sophisticated applications than would be possible with a single LLM.\n- **Customization**: AG2 agents can be customized to meet the specific needs of an application. This includes the ability to choose the LLMs to use, the types of human input to allow, and the tools to employ.\n- **Human participation**: AG2 seamlessly allows human participation. This means that humans can provide input and feedback to the agents as needed.\n\nFor [example](https://github.com/ag2ai/ag2/blob/main/test/twoagent.py),\n\n```python\nfrom autogen import AssistantAgent, UserProxyAgent, config_list_from_json\n# Load LLM inference endpoints from an env variable or a file\n# See https://ag2ai.github.io/ag2/docs/FAQ#set-your-api-endpoints\n# and OAI_CONFIG_LIST_sample\nconfig_list = config_list_from_json(env_or_file=\"OAI_CONFIG_LIST\")\n# You can also set config_list directly as a list, for example, config_list = [{'model': 'gpt-4o', 'api_key': '<your OpenAI API key here>'},]\nassistant = AssistantAgent(\"assistant\", llm_config={\"config_list\": config_list})\nuser_proxy = UserProxyAgent(\"user_proxy\", code_execution_config={\"work_dir\": \"coding\", \"use_docker\": False}) # IMPORTANT: set to True to run code in docker, recommended\nuser_proxy.initiate_chat(assistant, message=\"Plot a chart of NVDA and TESLA stock price change YTD.\")\n# This initiates an automated chat between the two agents to solve the task\n```\n\nThis example can be run with\n\n```python\npython test/twoagent.py\n```\n\nAfter the repo is cloned.\nThe figure below shows an example conversation flow with AG2.\n\n![Agent Chat Example](./website/static/img/chat_example.png)\n\n\nAlternatively, the [sample code](https://github.com/ag2ai/build-with-autogen/blob/main/samples/simple_chat.py) here allows a user to chat with an AG2 agent in ChatGPT style.\nPlease find more [code examples](https://ag2ai.github.io/ag2/docs/Examples#automated-multi-agent-chat) for this feature.\n\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n \u2191 Back to Top \u2191\n </a>\n</p>\n\n## Enhanced LLM Inferences\n\nAG2 also helps maximize the utility out of the expensive LLMs such as gpt-4o. It offers [enhanced LLM inference](https://ag2ai.github.io/ag2/docs/Use-Cases/enhanced_inference#api-unification) with powerful functionalities like caching, error handling, multi-config inference and templating.\n\n<!-- For example, you can optimize generations by LLM with your own tuning data, success metrics, and budgets.\n\n```python\n# perform tuning for openai<1\nconfig, analysis = autogen.Completion.tune(\n data=tune_data,\n metric=\"success\",\n mode=\"max\",\n eval_func=eval_func,\n inference_budget=0.05,\n optimization_budget=3,\n num_samples=-1,\n)\n# perform inference for a test instance\nresponse = autogen.Completion.create(context=test_instance, **config)\n```\n\nPlease find more [code examples](https://ag2ai.github.io/ag2/docs/Examples#tune-gpt-models) for this feature. -->\n\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n \u2191 Back to Top \u2191\n </a>\n</p>\n\n## Documentation\n\nYou can find detailed documentation about AG2 [here](https://ag2ai.github.io/ag2/).\n\nIn addition, you can find:\n\n- [Research](https://ag2ai.github.io/ag2/docs/Research), [blogposts](https://ag2ai.github.io/ag2/blog) around AG2, and [Transparency FAQs](https://github.com/ag2ai/ag2/blob/main/TRANSPARENCY_FAQS.md)\n\n- [Discord](https://discord.gg/pAbnFJrkgZ)\n\n- [Contributing guide](https://ag2ai.github.io/ag2/docs/Contribute)\n\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n \u2191 Back to Top \u2191\n </a>\n</p>\n\n## CookBook\n\nExplore detailed implementations with sample code and applications to help you get started with AG2.\n[Cookbook](https://github.com/ag2ai/build-with-autogen)\n\n\n## Related Papers\n\n[AG2](https://arxiv.org/abs/2308.08155)\n\n```\n@inproceedings{wu2023autogen,\n title={AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation Framework},\n author={Qingyun Wu and Gagan Bansal and Jieyu Zhang and Yiran Wu and Beibin Li and Erkang Zhu and Li Jiang and Xiaoyun Zhang and Shaokun Zhang and Jiale Liu and Ahmed Hassan Awadallah and Ryen W White and Doug Burger and Chi Wang},\n year={2023},\n eprint={2308.08155},\n archivePrefix={arXiv},\n primaryClass={cs.AI}\n}\n```\n\n[EcoOptiGen](https://arxiv.org/abs/2303.04673)\n\n```\n@inproceedings{wang2023EcoOptiGen,\n title={Cost-Effective Hyperparameter Optimization for Large Language Model Generation Inference},\n author={Chi Wang and Susan Xueqing Liu and Ahmed H. Awadallah},\n year={2023},\n booktitle={AutoML'23},\n}\n```\n\n[MathChat](https://arxiv.org/abs/2306.01337)\n\n```\n@inproceedings{wu2023empirical,\n title={An Empirical Study on Challenging Math Problem Solving with GPT-4},\n author={Yiran Wu and Feiran Jia and Shaokun Zhang and Hangyu Li and Erkang Zhu and Yue Wang and Yin Tat Lee and Richard Peng and Qingyun Wu and Chi Wang},\n year={2023},\n booktitle={ArXiv preprint arXiv:2306.01337},\n}\n```\n\n[AgentOptimizer](https://arxiv.org/pdf/2402.11359)\n\n```\n@article{zhang2024training,\n title={Training Language Model Agents without Modifying Language Models},\n author={Zhang, Shaokun and Zhang, Jieyu and Liu, Jiale and Song, Linxin and Wang, Chi and Krishna, Ranjay and Wu, Qingyun},\n journal={ICML'24},\n year={2024}\n}\n```\n\n[StateFlow](https://arxiv.org/abs/2403.11322)\n```\n@article{wu2024stateflow,\n title={StateFlow: Enhancing LLM Task-Solving through State-Driven Workflows},\n author={Wu, Yiran and Yue, Tianwei and Zhang, Shaokun and Wang, Chi and Wu, Qingyun},\n journal={arXiv preprint arXiv:2403.11322},\n year={2024}\n}\n```\n\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n \u2191 Back to Top \u2191\n </a>\n</p>\n\n## Contributors Wall\n<a href=\"https://github.com/ag2ai/ag2/graphs/contributors\">\n <img src=\"https://contrib.rocks/image?repo=ag2ai/ag2&max=204\" />\n</a>\n\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n \u2191 Back to Top \u2191\n </a>\n</p>\n\n## License\nThis project is licensed under the [Apache License, Version 2.0 (Apache-2.0)](./LICENSE).\n\nThis project is a spin-off of https://github.com/microsoft/autogen and contains code under two licenses:\n\n- The original code from https://github.com/microsoft/autogen is licensed under the MIT License. See the [LICENSE_original_MIT](./license_original/LICENSE_original_MIT) file for details.\n\n- Modifications and additions made in this fork are licensed under the Apache License, Version 2.0. See the [LICENSE](./LICENSE) file for the full license text.\n\nWe have documented these changes for clarity and to ensure transparency with our user and contributor community. For more details, please see the [NOTICE](./NOTICE.md) file.\n\n\n",
"bugtrack_url": null,
"license": "Apache Software License 2.0",
"summary": "A programming framework for agentic AI",
"version": "0.3.2",
"project_urls": {
"Homepage": "https://github.com/ag2ai/ag2"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cc327d3f2930d723a69b5e2a5a53298b645b055da7e006747be6041cbcc3b539",
"md5": "a86703e05b5ee3774a41bf81f8d4714c",
"sha256": "e37a9df0ad84cde3429ec63298b8e9eb4e6306a28eec2627171e14b9a61ea64d"
},
"downloads": -1,
"filename": "autogen-0.3.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a86703e05b5ee3774a41bf81f8d4714c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.8",
"size": 351997,
"upload_time": "2024-11-13T20:34:56",
"upload_time_iso_8601": "2024-11-13T20:34:56.359595Z",
"url": "https://files.pythonhosted.org/packages/cc/32/7d3f2930d723a69b5e2a5a53298b645b055da7e006747be6041cbcc3b539/autogen-0.3.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7be833b7fb072fbcf63b8a1b5bbba15570e4e8c86d6374da398889b92fc420c8",
"md5": "0ebf73b3f2358726f6b02b3225e87319",
"sha256": "9f8a1170ac2e5a1fc9efc3cfa6e23261dd014db97b17c8c416f97ee14951bc7b"
},
"downloads": -1,
"filename": "autogen-0.3.2.tar.gz",
"has_sig": false,
"md5_digest": "0ebf73b3f2358726f6b02b3225e87319",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.8",
"size": 306281,
"upload_time": "2024-11-13T20:34:58",
"upload_time_iso_8601": "2024-11-13T20:34:58.592780Z",
"url": "https://files.pythonhosted.org/packages/7b/e8/33b7fb072fbcf63b8a1b5bbba15570e4e8c86d6374da398889b92fc420c8/autogen-0.3.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-13 20:34:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ag2ai",
"github_project": "ag2",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "autogen"
}