AutoGen is the Microsoft Research project that made “agents talking to agents” a mainstream engineering pattern, and its second generation is a genuinely well-engineered codebase: MIT-licensed Python split into a core runtime, an AgentChat layer for everyday use, an extensions package for the ecosystem, and AutoGen Studio for no-code composition. One honesty note up front, straight from the README: AutoGen is now in maintenance mode, and Microsoft points new users to its successor, the Microsoft Agent Framework. That does not diminish the value of reading it; it makes reading it more valuable, because this is the architecture that taught a generation of agent frameworks what actor-model messaging, group chats, and termination conditions should look like.

The design idea that runs through everything is event-driven agents: every agent registers with a runtime, communicates by sending and receiving typed messages over topics and subscriptions, and teams like RoundRobinGroupChat, SelectorGroupChat, and Swarm are just orchestration policies above that fabric. Tools attach through a clean ChatCompletionClient and tools abstraction, with first-party adapters for MCP servers, LangChain tools, and GraphRAG, plus Docker and Jupyter sandboxes for executing the code agents write.

As always in this series, this is an educational tour of published source code. Multi-agent systems can generate and execute code, which is powerful and genuinely risky, and AutoGen treats that seriously: code runs in explicit executor sandboxes, the runtime supports intervention hooks that can inspect or block messages, and every task can be cancelled through a cancellation token. Use those mechanisms in your own builds; they are the difference between a demo and a system.

AutoGen overview architecture diagram

AutoGen at a glance: AgentChat agents and group chat teams sit on an event-driven runtime, models arrive through the ChatCompletionClient abstraction implemented by extension packages, tools and sandboxes plug in from autogen-ext, and AutoGen Studio composes it all visually.

Reading the overview from left to right:

Why You Need This

The first reason is that AutoGen is the clearest open implementation of the actor model applied to agents. Instead of a shared brain, agents are independent components that exchange typed messages through a runtime that manages dispatch, delivery, and lifecycle. The core runtime in _single_threaded_agent_runtime.py is small enough to read completely, and the moment you understand how topics and subscriptions in _type_subscription.py route messages, you will see why this architecture scales from a single assistant to distributed runtimes: the gRPC runtime in autogen-ext is the same contract on different transport.

The second reason is the vocabulary of orchestration it established. Round-robin turn taking, model-driven speaker selection, swarm handoffs, graph workflows, and the Society of Mind pattern where a team is wrapped to look like a single agent, are all in teams/_group_chat as concrete classes you can read and compare. Termination conditions are composable objects rather than magic loop counters, from MaxMessageTermination to TextMentionTermination to handoff-driven stops. If you are designing any multi-agent system, this package is the shortest path to knowing which orchestration policy fits which problem.

The third reason is boundary discipline. Model providers, tool sources, code execution, memory, and caching each live behind small interfaces in autogen-core, implemented in autogen-ext. That is how the project supports OpenAI, Anthropic, Ollama, LlamaCpp, and Semantic Kernel clients without the core knowing any of them, how MCP servers and LangChain tools become ordinary agent tools through thin adapters, and how code execution can move from the local machine into Docker or Jupyter without touching agent logic. This is textbook extension architecture, in a domain that desperately needs it.

How It Works

AutoGen detailed architecture diagram

Inside AutoGen: the AgentChat families of agents and team orchestrators, the runtime with its routing, intervention, and cancellation machinery, the model and message contracts, tool adapters, execution sandboxes, and the Studio and benchmark applications on top.

Understanding the Architecture

Agents that produce and consume messages. AssistantAgent in agents/_assistant_agent.py is the workhorse: it holds a model client, optionally binds tools and workbenches, and answers tasks by looping model calls and tool executions. CodeExecutorAgent turns the pattern around and executes code from messages, UserProxyAgent injects human input, and SocietyOfMindAgent wraps an entire inner team so it presents as one agent. Each of them ultimately specializes BaseAgent from autogen-core.

Teams as policies, not scripts. The group chat system in teams/_group_chat starts at _base_group_chat.py with a manager in _base_group_chat_manager.py deciding the speaking order. RoundRobinGroupChat cycles through participants, SelectorGroupChat asks a model to pick the next speaker, SwarmGroupChat routes via agent handoffs, _graph builds explicit workflow graphs, and _magentic_one recreates the MagenticOne orchestration. All of them share the termination conditions in conditions/_terminations.py, which compose so a team stops on max messages, a text marker, a timeout, or a handoff target.

A runtime with real systems concerns. The single-threaded runtime implements the AgentRuntime protocol from _agent_runtime.py: it registers agent factories, delivers messages by type subscriptions over default topics, and supports publish-subscribe broadcast. Intervention hooks from _intervention.py let a host application inspect, modify, or drop messages in flight, CancellationToken from _cancellation_token.py propagates stop requests through every await, and _serialization.py defines the wire format that lets the same agents run on the distributed gRPC runtime in autogen-ext/runtimes.

Models and tools behind clean seams. ChatCompletionClient in models/_model_client.py with payload types in models/_types.py is the only model contract in the core, and autogen-ext implements it for OpenAI and Azure, Anthropic, Ollama, LlamaCpp, and Semantic Kernel, plus a replay client for tests and a caching layer. Tool handling mirrors this: the core tools package and ToolAgent define the execution contract, while autogen-ext supplies MCP adapters, LangChain tool bridges, and a GraphRAG tool. AssistantAgent manages conversation memory through the chat completion context package in autogen-core/model_context.

Sandboxes and the product layer. Generated code never has to touch your machine: the code executors in autogen-ext run it inside Docker containers, Jupyter sessions, Azure containers, or the local shell, selected per agent. On top of everything, AutoGen Studio (python/packages/autogen-studio) provides the low-code web builder with its own frontend, and AGBench (python/packages/agbench) provides benchmarking for teams. Both consume the same public APIs as your code would, which keeps the product layer honest.

Advantages

  • Proven multi-agent patterns. Round-robin, selector, swarm, graph, and MagenticOne orchestration are concrete, documented classes rather than patterns you must invent.
  • Composable stop conditions. Termination is a first-class, combinable concept, so runaway teams are an engineering choice rather than an accident.
  • Actor-model foundations. Typed messaging with topics, subscriptions, and intervention hooks gives multi-agent systems the discipline of distributed systems.
  • Provider-agnostic core. The ChatCompletionClient seam supports OpenAI, Azure, Anthropic, Ollama, LlamaCpp, and more without core changes.
  • Ecosystem adapters. MCP servers, LangChain tools, GraphRAG, and multiple code sandboxes attach through thin, readable extension packages.
  • A no-code layer. AutoGen Studio exposes the same runtime to non-programmers, and AGBench measures team performance.

Benefits

  • Learn distributed design. The runtime, serialization, and gRPC extension show how agent systems graduate from one process to many.
  • Migration-ready knowledge. The successor Microsoft Agent Framework builds on these ideas, so reading AutoGen transfers directly to its enterprise successor.
  • Practical safety hooks. Intervention points and cancellation tokens are built into the fabric rather than bolted on, a pattern worth copying anywhere.
  • Honest testing story. Replay model clients, component configuration, and AGBench reflect a codebase built to be evaluated, not demoed.
  • Research pedigree. The project that popularized multi-agent conversation is also its best-documented reference implementation.
  • License and longevity. MIT-licensed with a large archive of documentation, examples, and community knowledge to draw on.

Usage

Install the AgentChat layer with an OpenAI client from extensions, and AutoGen Studio if you want the GUI:

pip install -U "autogen-agentchat" "autogen-ext[openai]"
pip install -U "autogenstudio"

Set your provider key and run the hello-world agent from the README:

export OPENAI_API_KEY="sk-..."
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())

Compose a two-agent team with a termination condition:

from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_agentchat.conditions import MaxMessageTermination, TextMentionTermination

team = RoundRobinGroupChat(
    [agent, critic],
    termination_condition=MaxMessageTermination(10) | TextMentionTermination("APPROVE"),
)

Attach an MCP server as a workbench, stream the run to the console, or launch the Studio builder:

from autogen_agentchat.ui import Console
from autogen_ext.tools.mcp import McpWorkbench, StdioServerParams

async with McpWorkbench(StdioServerParams(command="npx", args=["@playwright/mcp@latest"])) as mcp:
    await Console(agent.run_stream(task="Summarize the microsoft/autogen README"))
autogenstudio ui --port 8080 --appdir ./my-app

Conclusion

AutoGen earns its place in this series as the framework that defined how agents collaborate, and its maintenance-mode status makes the lesson sharper, not weaker: the actor-style runtime, the orchestration policies, the termination algebra, and the clean seams for models, tools, and sandboxes are exactly the ideas its successor carries forward into enterprise production. Read it to learn how to build multi-agent systems that can be routed, intercepted, cancelled, and benchmarked, then carry those instincts into whatever framework you adopt next.

Links:

Watch PyShine on YouTube

Contents