AutoGen

Also known as: Microsoft AutoGen

On this page 7

AutoGen is an open-source programming framework from Microsoft Research for building applications in which several language model agents converse with each other, call tools, run code and involve humans to complete a task. Among AI frameworks & tools, it is best known for popularizing the multi-agent conversation pattern, where a problem is solved through structured message exchange rather than a single long prompt.

The framework is written primarily in Python, with a .NET implementation, and is also referred to as Microsoft AutoGen. It occupies the same space as agent orchestration libraries such as LangGraph, CrewAI and Semantic Kernel, but its defining idea is that agents are conversational participants whose roles, turn order and termination rules the developer configures.

How AutoGen organizes agents into conversations

AutoGen models every participant as an agent that sends and receives messages. An agent can be backed by a language model, by a tool executor, by a code runner or by a human, and the framework routes messages between them until a termination condition is met.

The original design, known as AutoGen 0.2, centered on the ConversableAgent class and two common specializations: the AssistantAgent, which drafts answers and code, and the UserProxyAgent, which executes code and can stand in for a human. A group chat manager selected the next speaker among several agents, either in a fixed rotation or by asking a model to choose.

The AutoGen 0.4 redesign, released in early 2025, rebuilt the framework around an asynchronous, event-driven architecture. Agents became actors that exchange typed messages through a runtime, which allows distributed deployment, better observability and agents written in different languages.

The table below summarizes the main building blocks a developer works with in current versions.

ComponentRoleTypical use
Core APILow-level actor runtime with typed messagesCustom event-driven and distributed agent systems
AgentChat APIHigh-level preset agents and team patternsRapid prototyping of conversational workflows
ExtensionsModel clients, tools and code executorsConnecting to model providers and sandboxes
AutoGen StudioLow-code graphical interfaceDesigning and testing teams without writing code
AutoGen BenchBenchmarking harnessMeasuring agent performance on repeatable tasks
Core components of AutoGen

Team patterns and conversation control

AutoGen expresses collaboration through team patterns that decide who speaks next. Choosing the right pattern matters more than prompt wording, because it determines cost, latency and reliability of the whole system.

The following table compares the most common patterns available in the AgentChat layer.

PatternHow the next speaker is chosenBest suited for
Round-robin group chatFixed rotation among agentsPredictable review loops such as writer and critic
Selector group chatA model picks the next agent from descriptionsOpen-ended tasks with specialized roles
SwarmAgents hand off control explicitlyCustomer service flows with clear handoffs
Magentic-OneAn orchestrator plans and delegatesComplex web and file tasks needing planning
Two-agent chatAssistant and executor alternateCode generation with automatic execution
Common AutoGen team patterns

Every team needs an explicit stopping rule, such as a maximum number of messages, a keyword like TERMINATE or a token budget. Without one, agents can loop indefinitely, repeating polite acknowledgments while consuming tokens.

AutoGen differs from neighboring tools mainly in its conversation-first abstraction. Graph-based frameworks describe workflows as nodes and edges, while role-based frameworks describe crews of agents with tasks; AutoGen describes who talks to whom and when the talking stops.

FrameworkCentral abstractionMain strength
AutoGenAgents exchanging messages in teamsFlexible multi-agent dialogue and code execution
LangGraphStateful graph of nodes and edgesExplicit control flow and checkpointing
CrewAICrews of role-based agents with tasksSimple setup for role-driven pipelines
Semantic KernelPlugins and planners in an SDKEnterprise integration in .NET and Python
OpenAI Agents SDKAgents with handoffs and guardrailsLightweight orchestration around one provider
AutoGen and comparable agent frameworks

The project lineage is also worth knowing. In late 2024, several original creators continued the 0.2 line as a community fork called AG2, while Microsoft pursued the 0.4 architecture. In 2025, Microsoft announced the Microsoft Agent Framework, which combines ideas from AutoGen and Semantic Kernel, and positioned AutoGen itself for maintenance and research use rather than new feature development.

Using AutoGen in practice

A typical AutoGen application starts with a model client, a set of agents with system messages and tool definitions, a team pattern and a termination condition. Developers then stream the conversation, inspect each message and refine agent descriptions until the team behaves predictably.

The decision table below helps match project needs with the appropriate AutoGen layer or an alternative.

SituationRecommended choiceReason
Quick multi-agent prototypeAgentChat with a round-robin teamMinimal code and readable message logs
Distributed or cross-language agentsCore API with a distributed runtimeActors communicate through typed events
Non-developers designing workflowsAutoGen StudioVisual configuration and live testing
New long-lived production systemEvaluate Microsoft Agent FrameworkAutoGen receives limited new features
Strict, auditable process stepsA graph-based frameworkExplicit edges are easier to verify
Choosing how to use AutoGen

Code execution deserves special care. AutoGen can run generated code locally or in a Docker-based executor, and the container option should be the default whenever agents write and execute code, because model-generated scripts can delete files or reach the network.

Limitations and common mistakes

Multi-agent systems built with AutoGen inherit the weaknesses of the underlying models and add coordination overhead. Each extra agent multiplies token usage and latency, and errors made early in a conversation tend to propagate.

SymptomLikely causeFix
Endless polite exchangesMissing or weak termination conditionAdd message limits and explicit stop keywords
Wrong agent keeps speakingVague agent descriptions in a selector teamWrite distinct, task-specific descriptions
High cost per taskToo many agents for a simple problemMerge roles or use a single agent with tools
Unsafe file changesLocal code executionUse a sandboxed container executor
Code breaks after upgradeAPI changes between 0.2 and 0.4Pin versions and follow migration guidance
Typical problems and fixes
  • More agents is not automatically better; a single well-instructed agent often matches a team on narrow tasks.
  • Version confusion is common, because tutorials for 0.2, 0.4 and AG2 use different class names.
  • Evaluation is essential, since conversational behavior varies between runs with the same input.

A plain-language summary

AutoGen is a toolkit that lets programmers set up a small team of AI assistants that talk to each other. One assistant might write a plan. Another might write code. A third might check the result, much like colleagues passing a document around a table.

The programmer decides who is on the team and what each member does. The programmer also decides when the discussion must end. The work happens through conversation. Good rules for that conversation matter as much as the skill of each assistant.

An example from practice

A data analytics team at a mid-sized retailer wants weekly sales summaries without manual spreadsheet work. A developer builds an AutoGen team with three agents: a planner that breaks the request into steps, a coder that writes Python to query a sales database and draw charts, and a reviewer that checks figures against simple sanity rules.

The team runs in a Docker-based code executor with read-only database credentials, a limit of 20 messages and a stop keyword issued by the reviewer. In early tests, the selector pattern sometimes let the coder answer twice in a row, so the developer switched to a round-robin team with clearer descriptions.

After two weeks of tuning, the system produces a complete summary in about four minutes instead of roughly an hour of analyst time, and the analyst now only reviews the final report and its charts before sending it to management.