📚 Cite paper.
:tada: IMPORTANT
:fire: :tada: Nov 11, 2024: We are evolving AutoGen into AG2!
A new organization AG2ai is created to host the development of AG2 and related projects with open governance. Check AG2's new look.
We invite collaborators from all organizations and individuals to join the development.
:fire: :tada: AG2 is available via pyautogen
(or its alias autogen
or ag2
) on PyPI!
pip install pyautogen
📄 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, made in collaboration with Microsoft and Penn State University, and taught by AutoGen creators Chi Wang and Qingyun Wu.
:tada: May 24, 2024: Foundation Capital published an article on Forbes: The Promise of Multi-Agent AI and a video AI in the Real World Episode 2: Exploring Multi-Agent AI and AutoGen with Chi Wang.
:tada: May 13, 2024: The Economist published an article about multi-agent systems (MAS) following a January 2024 interview with Chi Wang.
:tada: May 11, 2024: AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation received the best paper award at the ICLR 2024 LLM Agents Workshop.
:tada: Apr 17, 2024: Andrew Ng cited AutoGen in The Batch newsletter and What's next for AI agentic workflows at Sequoia Capital's AI Ascent (Mar 26).
:tada: Mar 3, 2024: What's new in AutoGen? 📰Blog; 📺Youtube.
:tada: Dec 31, 2023: AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation Framework is selected by TheSequence: My Five Favorite AI Papers of 2023.
:tada: Nov 8, 2023: AutoGen is selected into Open100: Top 100 Open Source achievements 35 days after spinoff from FLAML.
:tada: Mar 29, 2023: AutoGen is first created in FLAML.
What is AG2
AG2 (formerly 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 from several organizations. Contact project administrators Chi Wang and Qingyun Wu via support@ag2.ai if you are interested in becoming a maintainer.
↑ Back to Top ↑
Quickstart
The easiest way to start playing is
-
Click below to use the GitHub Codespace
-
Copy OAI_CONFIG_LIST_sample to ./notebook folder, name to OAI_CONFIG_LIST, and set the correct configuration.
-
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.
↑ Back to Top ↑
Option 1. Install and Run AG2 in Docker
Find detailed instructions for users here, and for developers here.
Option 2. Install AG2 Locally
AG2 requires Python version >= 3.8, < 3.14. It can be installed from pip:
pip install ag2
Minimal dependencies are installed without extra options. You can install extra options based on the feature you need.
Find more options in Installation.
Even if you are installing and running AG2 locally outside of docker, the recommendation and default behavior of agents is to perform code execution in docker. Find more instructions and how to change the default behaviour here.
For LLM inference configurations, check the FAQs.
↑ Back to Top ↑
Multi-Agent Conversation Framework
AG2 enables the next-gen LLM applications with a generic multi-agent conversation 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,
from autogen import AssistantAgent, UserProxyAgent, config_list_from_json
config_list = config_list_from_json(env_or_file="OAI_CONFIG_LIST")
assistant = AssistantAgent("assistant", llm_config={"config_list": config_list})
user_proxy = UserProxyAgent("user_proxy", code_execution_config={"work_dir": "coding", "use_docker": False})
user_proxy.initiate_chat(assistant, message="Plot a chart of NVDA and TESLA stock price change YTD.")
This example can be run with
python test/twoagent.py
After the repo is cloned.
The figure below shows an example conversation flow with AG2.
Alternatively, the sample code here allows a user to chat with an AG2 agent in ChatGPT style.
Please find more code examples for this feature.
↑ Back to Top ↑
Enhanced LLM Inferences
AG2 also helps maximize the utility out of the expensive LLMs such as gpt-4o. It offers enhanced LLM inference with powerful functionalities like caching, error handling, multi-config inference and templating.
↑ Back to Top ↑
Documentation
You can find detailed documentation about AG2 here.
In addition, you can find:
↑ Back to Top ↑
CookBook
Explore detailed implementations with sample code and applications to help you get started with AG2.
Cookbook
Related Papers
AutoGen
@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
@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
@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
@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
@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}
}
↑ Back to Top ↑
Contributors Wall
↑ Back to Top ↑
License
This project is licensed under the Apache License, Version 2.0 (Apache-2.0).
This project is a spin-off of AutoGen and contains code under two licenses:
We have documented these changes for clarity and to ensure transparency with our user and contributor community. For more details, please see the NOTICE file.