> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ag2.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

## Create a virtual environment (optional)

When installing AG2 locally, we recommend using a virtual environment for the installation. This will ensure that the dependencies for AG2 are isolated from the rest of your system.

<Tabs>
  <Tab title="venv" default>
    <p>Create and activate:</p>

    ```bash theme={null}
    python3 -m venv autogen
    source autogen/bin/activate
    ```

    <p>To deactivate later, run:</p>

    ```bash theme={null}
    deactivate
    ```
  </Tab>

  <Tab title="Conda">
    <p>[Install Conda](https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html) if you have not already.</p>

    <p>Create and activate:</p>

    ```bash theme={null}
    conda create -n autogen python=3.10
    conda activate autogen
    ```

    <p>To deactivate later, run:</p>

    ```bash theme={null}
    conda deactivate
    ```
  </Tab>

  <Tab title="Poetry">
    <p><a href="https://python-poetry.org/docs/#installation" target="_blank" rel="noopener noreferrer">Install Poetry</a> if you have not already.</p>

    <p>Create and activate:</p>

    ```bash theme={null}
    poetry init
    poetry shell

    poetry add autogen
    ```

    <p>To deactivate later, run:</p>

    ```bash theme={null}
    exit
    ```
  </Tab>
</Tabs>

## Install AG2

AG2 requires **Python version >= 3.9, \< 3.14**. It can be installed from pip:

```bash theme={null}
pip install ag2[openai]
```

<Tip>
  If you have been using `autogen` or `ag2`, all you need to do is upgrade it using:

  ```bash theme={null}
  pip install -U autogen[openai]
  ```

  or

  ```bash theme={null}
  pip install -U ag2[openai]
  ```

  as `autogen` and `ag2` are aliases for the same PyPI package.
</Tip>

<div class="info">
  <Info> `openai>=1` is required. </Info>
</div>

## Install Docker for Code Execution

We recommend using Docker for code execution.
To install Docker, follow the instructions for your operating system on the [Docker website](https://docs.docker.com/get-docker/).

A simple example of how to use Docker for code execution is shown below:

```python theme={null}
from pathlib import Path
from autogen import UserProxyAgent
from autogen.coding import DockerCommandLineCodeExecutor

work_dir = Path("coding")
work_dir.mkdir(exist_ok=True)

with DockerCommandLineCodeExecutor(work_dir=work_dir) as code_executor:
    user_proxy = UserProxyAgent(
        name="user_proxy",
        code_execution_config={"executor": code_executor},
    )
```

To learn more about code executors, see the [code executors tutorial](/docs/user-guide/advanced-concepts/code-execution).

You might have seen a different way of defining the executors without creating the
executor object, please refer to FAQ for this [legacy code executor](/docs/faq/FAQ#legacy-code-executor).
