AG2
Community-driven evolution of the original AutoGen project, focused on open multi-agent conversation patterns and group decision-making. AG2 emphasizes conversable agents that can engage in flexible, dynamic conversations with each other, supporting human participation and complex group chat scenarios.
Architecture Overview
AG2 uses a conversable agent architecture where each agent (ConversableAgent) can send and receive messages. Agents can be configured with LLM capabilities (AssistantAgent) or human input (UserProxyAgent). Group chats are managed by a GroupChatManager that coordinates turn-taking among multiple agents. The framework supports nested conversations, function calling, and code execution within the conversation flow.
When to Use AG2
- Multi-agent conversations and debates
- Group decision-making with diverse agent perspectives
- Research and brainstorming with AI collaborators
- Code generation with automated testing feedback loops
- Complex problem decomposition across agent teams
Strengths & Weaknesses
Strengths
- Flexible conversation-driven agent interactions
- Strong group chat and multi-party dynamics
- Active open-source community with rapid development
- Built-in code execution capabilities
- Supports nested and hierarchical conversations
Weaknesses
- Complex API surface for beginners
- Rapidly evolving with frequent breaking changes
- Documentation can lag behind development pace
Quick Start
from ag2 import AssistantAgent, UserProxyAgent
# Create an assistant agent
assistant = AssistantAgent(
name="assistant",
llm_config={"model": "gpt-4o", "api_type": "openai"},
system_message="You are a helpful AI assistant. Solve tasks step by step.",
)
# Create a user proxy that can execute code
user_proxy = UserProxyAgent(
name="user_proxy",
human_input_mode="NEVER",
max_consecutive_auto_reply=5,
code_execution_config={"work_dir": "coding", "use_docker": False},
)
# Start a conversation
user_proxy.initiate_chat(
assistant,
message="Write a Python function to calculate the Fibonacci sequence up to n terms, then test it with n=10.",
)Features at a Glance
| Developer | AG2 Community |
| Language | Python |
| License | Apache-2.0 |
| GitHub Stars | 5k+ |
| MCP Support | Yes |
| Multi-Agent | Yes |
Notable Users
Resources
Explore Related Content
Multi-Agent Systems
Coordinating multiple AI agents to collaborate, delegate, and solve complex problems together.
GuideMulti-Agent Architecture
Design and build systems with multiple collaborating agents using supervisor and peer patterns.
PatternPeer Collaboration
Agents communicate directly without a central orchestrator for exploratory and creative tasks.