Skip to content
⚠️ This is documentation for AG2 Classic (autogen package), which is in maintenance mode. For the latest version, use AG2 v1.0+ (ag2 package) at docs.ag2.ai.

Installing AG2

AG2 is an open-source framework for building AI agents and multi-agent workflows. Let's get it installed.

AG2 Classic is available on PyPI as autogen. You can install it using pip, the Python package manager.

Warning

Install autogen, not ag2. The ag2 package now refers to AG2 v1.0+, a separate, newer release. AG2 Classic only ships under the autogen name.

Tip

We recommend using a virtual environment for your project to keep your packages contained. See venv.

AG2 requires Python version >= 3.10, < 3.14. Run the following command to install AG2:

pip install "autogen[openai]"

This installs AG2 along with the openai package.

Note

From version 0.8: The OpenAI package, openai is not installed by default. You need to install it separately by adding the openai extra option.

Install with Your Preferred Model Provider(s)#

AG2 supports multiple AI model providers through optional dependency groups. Below are some examples of how to install AG2 with different model providers:

pip install "autogen[openai]"
pip install "autogen[gemini]"
pip install "autogen[anthropic,cohere,mistral]"

MacOS Tip

On MacOS, if you get a no matches found: error, it usually means you missed the double quotes enclosing the package name. Wrap it in quotes as shown in the example and you should be fine:

pip install "autogen[openai]"

Verify Your Installation#

Confirm AG2 is installed correctly:

python -c "import autogen; print('AG2', autogen.__version__, 'installed successfully')"

You should see something like AG2 x.x.x installed successfully with your installed version number.

Upgrading autogen#

If you've already installed autogen, upgrading is simple — no need to reinstall from scratch.

To upgrade, run:

pip install -U "autogen[openai]"

Next Step#

You're all set! Head to the Quick Start to build your first agent in 3 minutes.