Environment Setup

Get your development environment ready for AutoGen

Choose Your AutoGen Framework

AutoGen offers different frameworks depending on your needs:

AutoGen Studio

Web-based UI for prototyping with agents without writing code.

Best for: Beginners, no-code prototyping

pip install -U autogenstudio
AgentChat

Programming framework for conversational single and multi-agent applications.

Best for: Python developers, conversational AI

pip install -U "autogen-agentchat"
AutoGen Core

Event-driven framework for building scalable multi-agent AI systems.

Best for: Advanced developers, scalable systems

pip install "autogen-core"

Step-by-Step Installation Guide

Step 0: Create AutoGen Root Folder (Recommended)

Create a dedicated folder to organize all your AutoGen projects, demos, and applications.

Recommended folder structure:
mkdir -p ~/Development/AutoGen
cd ~/Development/AutoGen

# Create subfolders for organization
mkdir demos applications tutorials experiments
Recommended folder structure:
md C:\Development\AutoGen
cd C:\Development\AutoGen

# Create subfolders for organization
md demos applications tutorials experiments
Folder Purpose:
  • demos/ - Tutorial examples
  • applications/ - Your projects
  • tutorials/ - Learning exercises
  • experiments/ - Testing new ideas
Step 1: Create Virtual Environment (Recommended)

We recommend using a virtual environment to isolate AutoGen dependencies from your system. Navigate to your AutoGen root folder first:

Linux/Mac:
python3 -m venv .venv
source .venv/bin/activate
Windows:
python -m venv .venv
.venv\Scripts\activate.bat
To deactivate later:
deactivate
conda create -n autogen python=3.10
conda activate autogen
Step 2: Install AutoGen Package

Choose the installation command based on your selected framework:

For AgentChat (Recommended for beginners):
pip install -U "autogen-agentchat"
For AutoGen Core:
pip install "autogen-core"
Step 3: Install Model Extensions

To use AI models, install the appropriate extensions:

For OpenAI models:
pip install "autogen-ext[openai]"
For Azure OpenAI:
pip install "autogen-ext[azure]"
Step 4: Install Docker (Optional)

Docker is recommended for secure code execution using DockerCommandLineCodeExecutor:

Verify Your Installation

Test Your Setup

Create a simple test file to verify your AutoGen installation:

Step 1: Set Up API Key

Set your OpenAI API key as an environment variable:

Mac/Linux Instructions:
1. Set the environment variable:
export OPENAI_API_KEY="sk-your-actual-api-key-here"
2. Verify it's set:
echo $OPENAI_API_KEY
Windows Instructions:
Option 1: Command Prompt (cmd)
1. Set the variable:
set OPENAI_API_KEY=sk-your-actual-api-key-here
2. Verify it's set:
echo %OPENAI_API_KEY%
Option 2: PowerShell
1. Set the variable:
$env:OPENAI_API_KEY="sk-your-actual-api-key-here"
2. Verify it's set:
echo $env:OPENAI_API_KEY
Mac/Linux:
cd ~/Development/AutoGen/demos
touch test_installation.py
Windows:
cd C:\Development\AutoGen\demos
type nul > test_installation.py

Step 3: Add the following code to test_installation.py:

import asyncio
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient

async def main() -> None:
    agent = AssistantAgent("assistant", OpenAIChatCompletionClient(model="gpt-4o"))
    result = await agent.run(task="Say 'Hello World!'")
    print(result)

asyncio.run(main())
Step 4: Run the test:
python test_installation.py

🎉 Environment Ready!

Your AutoGen development environment is now set up. Ready to start learning?

Start Learning Fundamentals Try Interactive Tutorials