Open-source Python framework for building multi-agent AI systems where specialized agents collaborate through structured conversations to solve complex tasks, supporting four orchestration patterns, human-in-the-loop workflows, and cross-framework interoperability via AgentOS.
Open-source multi-agent framework where AI agents collaborate through structured conversations to complete complex tasks like code generation, research analysis, and customer support.
AG2 (formerly Microsoft AutoGen) is the leading open-source Python framework for conversational multi-agent AI, with over 36,000 GitHub stars and 400+ contributors. Originally created at Microsoft Research and later forked as an independent, community-governed project under the Apache 2.0 license, AG2 preserves the proven conversable-agent architecture that made AutoGen one of the most popular agent frameworks while adding cross-framework interoperability, AgentOS runtime, and swarm-style orchestration.
The core idea behind AG2 is simple: define specialized AI agents with distinct roles and let them collaborate through structured conversations. AG2 provides four built-in conversation patterns — two-agent chat for direct back-and-forth dialogue, sequential chat for pipeline workflows, group chat with automatic speaker selection for collaborative discussions, and nested chat for hierarchical agent compositions. This flexibility allows developers to model anything from a simple coding assistant to a multi-tier customer support system with escalation logic.
AG2 differentiates itself through several key capabilities. The UserProxyAgent class provides granular human-in-the-loop control, letting developers decide exactly when human approval is required. Built-in code execution supports both local and Docker-sandboxed environments, so coding agents can write, run, and iteratively debug code within safety boundaries. The tool registration system uses Python decorators to expose any function as an agent-callable tool with automatic schema generation. RAG support is built in via RetrieveUserProxyAgent with vector store integration for document-grounded conversations.
AG2 is LLM-agnostic, supporting OpenAI, Anthropic Claude, Google Gemini, Mistral, and local open-weight models through a unified configuration interface. Different agents in the same conversation can use different models, enabling cost optimization by routing simple tasks to smaller models while reserving frontier models for complex reasoning.
The AgentOS layer extends AG2 from a development framework into a production runtime. It provides agent discovery and registry, persistent state management across sessions, and deployment infrastructure for moving from notebook prototypes to scalable production systems. AgentOS also enables cross-framework interoperability, allowing AG2 to orchestrate agents built with CrewAI, LangChain, and LlamaIndex through standardized protocols including A2A and MCP.
For teams evaluating multi-agent frameworks, AG2 occupies a unique position: it offers more orchestration flexibility than CrewAI's opinionated role-and-task model, more natural agent interaction than LangGraph's explicit state machines, broader model support than OpenAI's Agents SDK, and stronger multi-agent capabilities than LlamaIndex's data-focused architecture. The tradeoff is complexity — AG2 requires intermediate Python skills and provides no visual builder or low-code option for the open-source framework.
Was this helpful?
AG2 delivers enterprise-grade multi-agent AI through conversational orchestration that no other open-source framework matches in flexibility. Its four conversation patterns, native human-in-the-loop support, and cross-framework interoperability via AgentOS make it the most versatile option for Python developers building complex agent systems. The tradeoffs are real — Python-only, no managed hosting, and a learning curve steeper than CrewAI — but for teams that need fine-grained control over how agents collaborate, AG2 remains the strongest open-source choice in 2026.
AG2 provides four distinct collaboration patterns — swarms for parallel task distribution, sequential chains for pipeline workflows, group chats with LLM-based automatic speaker selection for multi-party collaboration, and nested conversations for hierarchical agent compositions. The GroupChatManager coordinates turn-taking and routing, while developers can customize speaker selection logic, termination conditions, and maximum turn limits for each pattern.
AG2 uniquely bridges agent ecosystems by connecting agents built in CrewAI, LangChain, LlamaIndex, and other frameworks into unified conversations through standardized A2A and MCP protocols. This cross-framework orchestration means teams are not locked into a single agent framework — they can leverage the best tools from each ecosystem while AG2's AgentOS runtime handles message routing, state synchronization, and lifecycle management across heterogeneous agent populations.
The UserProxyAgent class provides granular control over human involvement in agent conversations. Developers configure human_input_mode to ALWAYS (human approves every message), TERMINATE (human intervenes only at conversation end), or NEVER (fully autonomous). The agent can relay messages to humans, execute code on their behalf, and seamlessly transition between autonomous operation and human oversight at any conversation turn.
Agents can write, execute, and iteratively debug Python code within sandboxed environments. AG2 supports LocalCommandLineCodeExecutor for development, DockerCommandLineCodeExecutor for production-safe isolation, and Jupyter-based execution for notebook-style workflows. Configurable timeouts, allowed languages, and working directories give developers control over the execution environment while preventing runaway processes.
Register any Python function as an agent tool with automatic schema generation using simple decorators. The @register_for_llm decorator exposes a tool to an agent's LLM for function calling, while @register_for_execution designates which agent runs the function. This separation of calling and execution enables secure patterns where one agent decides to use a tool but a different, authorized agent performs the action. LangChain tool adapters provide additional interoperability.
Built-in RAG capabilities allow agents to ingest, index, and reason over external documents during conversations. The RetrieveUserProxyAgent handles document chunking, embedding generation, and vector store queries (with native ChromaDB support and adapters for Pinecone and Weaviate). Agents automatically retrieve relevant passages and inject them as context, enabling document-grounded conversations without requiring separate RAG infrastructure.
Every agent inherits from the ConversableAgent base class, providing a unified interface for sending and receiving messages, maintaining conversation history, and registering reply functions. This architecture means any agent can talk to any other agent, conversations are composable (a two-agent chat can be nested inside a group chat), and new agent types are created by subclassing and overriding reply logic rather than implementing complex interfaces.
AG2 integrates with all major LLM providers — OpenAI GPT-4 and GPT-4o, Anthropic Claude, Google Gemini, Mistral, Azure OpenAI, and local open-weight models via Ollama and LM Studio. Different agents in the same conversation can use different models, enabling cost optimization by routing simple tasks to cheaper models while reserving expensive frontier models for complex reasoning. Model failover chains automatically switch providers if a primary model is unavailable.
Define strict output schemas using Pydantic models, enforce JSON response formats, and set precise termination conditions to maintain control over agent conversations. Developers can specify max_turns limits, custom termination keywords, reply function overrides, and conversation hooks that trigger at specific points in the dialogue flow. This ensures agent conversations produce machine-parseable results and terminate predictably.
The shared state system provides a centralized context store accessible to all agents in a conversation. In sequential chats, the carryover mechanism automatically passes relevant context from one conversation stage to the next. Context variables can be set, read, and updated by any participating agent, enabling coordination without requiring agents to explicitly pass information through conversation messages. AgentOS extends this with persistent state across sessions.
Free
Custom pricing (contact sales)
Ready to get started with AG2 (AutoGen Evolved)?
View Pricing Options →AG2 (AutoGen Evolved) works with these platforms and services:
We believe in transparent reviews. Here's what AG2 (AutoGen Evolved) doesn't handle well:
Weekly insights on the latest AI tools, features, and trends delivered to your inbox.
AG2 has sharpened its positioning around AgentOS as a universal, cross-framework agent runtime. Key developments include swarm-style orchestration for lightweight agent handoffs, Captain Agent for dynamic sub-agent creation and management, reasoning agents with built-in chain-of-thought and reflection capabilities, and improved structured output support via Pydantic models. The cross-framework interoperability story has matured significantly, with production-ready integrations for CrewAI, LangChain, and LlamaIndex agents through standardized A2A and MCP protocols.
AI Agent Builders
Open-source Python framework that orchestrates autonomous AI agents collaborating as teams to accomplish complex workflows. Define agents with specific roles and goals, then organize them into crews that execute sequential or parallel tasks. Agents delegate work, share context, and complete multi-step processes like market research, content creation, and data analysis. Supports 100+ LLM providers through LiteLLM integration and includes memory systems for agent learning. Features 48K+ GitHub stars with active community.
AI Agent Builders
Graph-based workflow orchestration framework for building reliable, production-ready AI agents with deterministic state machines, human-in-the-loop capabilities, and comprehensive observability through LangSmith integration.
AI Agent Builders
OpenAI's official open-source framework for building agentic AI applications with minimal abstractions. Production-ready successor to Swarm, providing agents, handoffs, guardrails, and tracing primitives that work with Python and TypeScript.
AI Agent Builders
LlamaIndex: Build and optimize RAG pipelines with advanced indexing and agent retrieval for LLM applications.
No reviews yet. Be the first to share your experience!
Get started with AG2 (AutoGen Evolved) and see if it's the right fit for your needs.
Get Started →Take our 60-second quiz to get personalized tool recommendations
Find Your Perfect AI Stack →Explore 20 ready-to-deploy AI agent templates for sales, support, dev, research, and operations.
Browse Agent Templates →