---
title: Installing AG2
---

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

AG2 is available on PyPI as <a href="https://pypi.org/project/ag2" target="_blank">`ag2`</a>. You can install it using `pip`, the Python package manager.

<Tip>
We recommend using a virtual environment for your project to keep your packages contained. See <a href="https://docs.python.org/3/library/venv.html" target="_blank">venv</a>.
</Tip>

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

```bash
pip install "ag2[openai]"
```

This installs AG2 along with the <a href="https://pypi.org/project/openai" target="_blank">`openai`</a> package.

!!! note
    **From ag2 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:

```bash
pip install "ag2[openai]"
pip install "ag2[gemini]"
pip install "ag2[anthropic,cohere,mistral]"
```

!!! tip "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:

    ```bash
    pip install "ag2[openai]"
    ```

### Verify Your Installation

Confirm AG2 is installed correctly:

```bash
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 from `autogen` or `ag2`


If you've been using `autogen` or `ag2`, upgrading is simple — no need to reinstall from scratch. `autogen` and `ag2` are aliases for the same PyPI package.

To upgrade, run:

```bash
pip install -U "ag2[openai]"
```

### Next Step

You're all set! Head to the [Quick Start](/docs/quick-start) to build your first agent in 3 minutes.
