autogen

microsoft/autogen

Multi-agent AI framework for autonomous or collaborative applications

60k
Stars
9.0k
Forks
927
Open issues
527
Watchers
Python CC-BY-4.0Last pushed Apr 15, 2026

Overview

AutoGen is a Python framework for creating complex AI agent systems that can interact autonomously or with human guidance. It enables developers to build sophisticated multi-agent workflows and AI applications using large language models.

Categories

Tags

Install

pip install autogen

README

AutoGen Logo

AutoGen

AutoGen is a framework for creating multi-agent AI applications that can act autonomously or work alongside humans.

[!CAUTION] ⚠️ Maintenance Mode

AutoGen is now in maintenance mode. It will not receive new features or enhancements and is community managed going forward.

New users should start with Microsoft Agent Framework. Existing users are encouraged to migrate using the AutoGen → Microsoft Agent Framework migration guide.

Microsoft Agent Framework (MAF) is the enterprise‑ready successor to AutoGen. Microsoft Agent FrameworkAF in now available as a production-ready release: stable APIs, and a commitment to long-term support. Whether you're building a single assistant or orchestrating a fleet of specialized agents, Microsoft Agent Framework 1.0 gives you enterprise-grade multi-agent orchestration, multi-provider model support, and cross-runtime interoperability via A2A and MCP.

Installation

AutoGen requires Python 3.10 or later.

# Install AgentChat and OpenAI client from Extensions
pip install -U "autogen-agentchat" "autogen-ext[openai]"

The current stable version can be found in the releases. If you are upgrading from AutoGen v0.2, please refer to the Migration Guide for detailed instructions on how to update your code and configurations.

# Install AutoGen Studio for no-code GUI
pip install -U "autogenstudio"

Quickstart

The following samples call OpenAI API, so you first need to create an account and export your key as export OPENAI_API_KEY="sk-...".

Hello World

Create an assistant agent using OpenAI's GPT-4o model. See other supported models.

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

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

asyncio.run(main())

MCP Server

Create a web browsing assistant agent that uses the Playwright MCP server.

# First run `npm install -g @playwright/mcp@latest` to install the MCP server.
import asyncio
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.ui import Console
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.tools.mcp import McpWorkbench, StdioServerParams


async def main() -> None:
    model_client = OpenAIChatCompletionClient(model="gpt-4.1")
    server_params = StdioServerParams(
        command="npx",
        args=[
            "@playwright/mcp@latest",
            "--headless",
        ],
    )
    async with McpWorkbench(server_params) as mcp:
        agent = AssistantAgent(
            "web_browsing_assistant",
            model_client=model_client,
            workbench=mcp, # For multiple MCP servers, put them in a list.
            model_client_stream=True,
            max_tool_iterations=10,
        )
        await Console(agent.run_stream(task="Find out how many contributors for the microsoft/autogen repository"))


asyncio.run(main())

Warning: Only connect to trusted MCP servers as they may execute commands in your local environment or expose sensitive information.

Multi-Agent Orchestration

You can use AgentTool to create a basic multi-agent orchestration setup.

impo