# AutoGen — Microsoft Multi-Agent Conversation Framework > Framework by Microsoft Research for building multi-agent conversational AI systems. Agents chat with each other to solve tasks collaboratively. Supports human-in-the-loop and code execution. 40,000+ stars. ## Install Save as a script file and run: ## Quick Use ```bash pip install autogen-agentchat autogen-ext ``` ```python from autogen_agentchat.agents import AssistantAgent from autogen_agentchat.teams import RoundRobinGroupChat from autogen_ext.models.openai import OpenAIChatCompletionClient model = OpenAIChatCompletionClient(model="claude-sonnet-4-20250514", api_key="sk-ant-...") coder = AssistantAgent("coder", model_client=model, system_message="You write Python code to solve tasks.") reviewer = AssistantAgent("reviewer", model_client=model, system_message="You review code for bugs and improvements.") team = RoundRobinGroupChat([coder, reviewer], max_turns=4) result = await team.run(task="Write a function to find prime numbers up to N") ``` --- ## Intro AutoGen is a framework by Microsoft Research for building multi-agent conversational AI systems with 40,000+ GitHub stars. Multiple AI agents with different roles chat with each other to collaboratively solve complex tasks — a coder writes code, a reviewer checks it, a planner coordinates, and a human approves. AutoGen v0.4 (latest) features an event-driven architecture, pluggable components, and first-class support for human-in-the-loop workflows. Best for teams building complex multi-agent systems where agents need to debate, iterate, and collaborate. Works with: Claude, GPT-4, any OpenAI-compatible model. Setup time: under 3 minutes. --- ## Core Concepts ### Agents Each agent has a role and system message: ```python planner = AssistantAgent("planner", model_client=model, system_message="Break down complex tasks into steps. Coordinate with coder and reviewer.") coder = AssistantAgent("coder", model_client=model, system_message="Write clean, tested Python code.") reviewer = AssistantAgent("reviewer", model_client=model, system_message="Review code for bugs, edge cases, and improvements.") ``` ### Teams **Round Robin** — agents take turns: ```python team = RoundRobinGroupChat([planner, coder, reviewer], max_turns=6) ``` **Selector** — a model picks who speaks next: ```python team = SelectorGroupChat([planner, coder, reviewer], model_client=model) # Model decides speaking order ``` ### Human-in-the-Loop ```python from autogen_agentchat.agents import UserProxyAgent human = UserProxyAgent("human") team = RoundRobinGroupChat([coder, reviewer, human], max_turns=10) # Pauses for human input when human's turn comes ``` ### Code Execution Agents can write and run code in sandboxed environments: ```python from autogen_ext.code_executors.docker import DockerCommandLineCodeExecutor executor = DockerCommandLineCodeExecutor() coder = AssistantAgent("coder", model_client=model, code_executor=executor) ``` ### Tool Use ```python from autogen_core import FunctionTool def search_web(query: str) -> str: 'Search the web for information.' return tavily_search(query) search_tool = FunctionTool(search_web, description="Search the web") agent = AssistantAgent("researcher", model_client=model, tools=[search_tool]) ``` ### Real-World Example: Research Paper ```python researcher = AssistantAgent("researcher", tools=[search_tool]) writer = AssistantAgent("writer", system_message="Write academic-style content") editor = AssistantAgent("editor", system_message="Edit for clarity and accuracy") human = UserProxyAgent("professor") team = SelectorGroupChat([researcher, writer, editor, human]) result = await team.run(task="Write a literature review on LLM agents in software engineering") ``` ### Key Stats - 40,000+ GitHub stars - By Microsoft Research - Event-driven architecture (v0.4) - Human-in-the-loop support - Docker code execution sandbox ### FAQ **Q: What is AutoGen?** A: A Microsoft Research framework for building multi-agent AI systems where agents converse and collaborate to solve complex tasks, with human-in-the-loop support. **Q: Is AutoGen free?** A: Yes, open-source under MIT license. **Q: How is AutoGen different from CrewAI?** A: AutoGen focuses on agent conversations and debate. CrewAI focuses on role-based task delegation. AutoGen is more flexible for complex multi-turn interactions. --- ## Source & Thanks > Created by [Microsoft Research](https://github.com/microsoft). Licensed under MIT. > > [autogen](https://github.com/microsoft/autogen) — ⭐ 40,000+ Thanks to Microsoft Research for pioneering multi-agent conversations. --- ## 快速使用 ```bash pip install autogen-agentchat autogen-ext ``` ```python from autogen_agentchat.agents import AssistantAgent from autogen_agentchat.teams import RoundRobinGroupChat coder = AssistantAgent("coder", model_client=model) reviewer = AssistantAgent("reviewer", model_client=model) team = RoundRobinGroupChat([coder, reviewer], max_turns=4) result = await team.run(task="写一个质数查找函数") ``` --- ## 简介 AutoGen 是微软研究院开发的多 Agent 对话框架,GitHub 40,000+ stars。多个 AI Agent 通过对话协作解决复杂任务。支持人在环路和沙盒代码执行。适合需要 Agent 辩论、迭代和协作的复杂多 Agent 系统。 --- ## 来源与感谢 > Created by [Microsoft Research](https://github.com/microsoft). Licensed under MIT. > > [autogen](https://github.com/microsoft/autogen) — ⭐ 40,000+ --- Source: https://tokrepo.com/en/workflows/dd1827b4-2401-4ecc-a1b4-a3cc813e06f5 Author: Agent Toolkit