AutoGen Guide 2025: Microsoft's Multi-Agent AI Framework
AutoGen is Microsoft Research's open-source framework for building conversational multi-agent AI systems. Agents communicate via messages, execute code in sandboxed environments, and collaborate to complete complex tasks — with minimal boilerplate.
What Is AutoGen?
AutoGen (GitHub: microsoft/autogen, 40k+ stars) models AI collaboration as agent conversations. Key properties:
- Agents are conversable — they send and receive messages to/from other agents
- Agents can be LLM-backed (AssistantAgent) or code-executing (UserProxyAgent)
- Supports 2-agent chat, group chat (multiple agents), and nested chat patterns
- Built-in code execution in Docker sandbox (safe), local Python, or no execution
- AutoGen Studio provides a visual no-code builder for workflows
AutoGen 0.4 (2024) introduced a major architecture refactor: AgentChat (high-level API, backward-compatible patterns) and Core (low-level actor model for distributed agents).
Installation
# AutoGen AgentChat (recommended starting point) pip install autogen-agentchat # With OpenAI support pip install autogen-agentchat autogen-ext[openai] # With Anthropic Claude support pip install autogen-agentchat autogen-ext[anthropic] # AutoGen Studio (visual builder) pip install autogenstudio autogenstudio ui --port 8081
Core Agents
AssistantAgent
LLM-backed agent. Reads conversation history and generates responses. Can call tools defined via function schema. Does not execute code itself — it produces code that other agents execute.
UserProxyAgent
Proxy for the human or code executor. Can run Python code blocks it receives (in Docker sandbox, local, or no execution). Can prompt a real human for input or auto-reply with results. Terminates the conversation when a stop condition is met.
GroupChat + GroupChatManager
Coordinate 3+ agents in a group chat. A manager (also LLM-powered) selects which agent speaks next. Supports round-robin, random, or LLM-driven speaker selection.
ConversableAgent
The base class. All agents extend this. Configure any combination of LLM, code execution, and reply functions to build custom agent types.
Quickstart: 2-Agent Coding Pair
from autogen import AssistantAgent, UserProxyAgent
# LLM configuration
llm_config = {
"model": "gpt-4o",
"api_key": "your_openai_key",
}
# 1. Assistant — the LLM that writes code and plans
assistant = AssistantAgent(
name="Coder",
llm_config=llm_config,
system_message="You are an expert Python developer. Write clean, commented code.",
)
# 2. UserProxy — executes the code, reports results back
user_proxy = UserProxyAgent(
name="Executor",
human_input_mode="NEVER", # fully autonomous
code_execution_config={
"work_dir": "coding_workspace",
"use_docker": False, # set True for sandboxed execution
},
max_consecutive_auto_reply=10,
is_termination_msg=lambda x: "TERMINATE" in x.get("content", ""),
)
# 3. Start the conversation — agents iterate until task is done
user_proxy.initiate_chat(
assistant,
message="Write and run a Python script that fetches the top 5 Hacker News stories and prints their titles.",
) Supported LLMs
| Provider | llm_config key | Notes |
|---|---|---|
| OpenAI | api_key | Default. GPT-4o, o3, o4-mini |
| Azure OpenAI | api_type: "azure" | Enterprise, private endpoint |
| Anthropic Claude | api_type: "anthropic" | Claude Sonnet 4.6, Opus 4 |
| Google Gemini | api_type: "google" | Gemini 2.0 Flash, 2.5 Pro |
| Ollama (local) | base_url: "http://localhost:11434/v1" | Llama 3, Mistral, DeepSeek-R1 |
AutoGen vs CrewAI vs LangGraph
| Factor | AutoGen | CrewAI | LangGraph |
|---|---|---|---|
| Paradigm | Conversational agents | Role-based crew | Explicit state graph |
| Code execution | First-class (Docker sandbox) | Via tools | Via tool nodes |
| Visual builder | AutoGen Studio (yes) | CrewAI+ ($) | LangGraph Studio ($) |
| State management | Message history | Short/long-term memory | Typed state + checkpointing |
| Learning curve | Low | Very low | High |
| Best for | Code generation, research | Content, analysis teams | Production stateful agents |
See also: CrewAI Guide, LangGraph Guide, and Devin Guide for autonomous coding agents.
Monitor Your Multi-Agent AI Stack
AutoGen agents depend on OpenAI, Anthropic, or Azure APIs. Track uptime for every LLM provider your agents use — get instant alerts before your workflows fail silently.
Monitor All AI APIs Free →