# ag2ai/ag2

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/ag2ai-ag2).**

4,169 stars · 539 forks · Python · apache-2.0

## Links

- GitHub: https://github.com/ag2ai/ag2
- Homepage: https://ag2.ai
- awesome-repositories: https://awesome-repositories.com/repository/ag2ai-ag2.md

## Topics

`a2a` `ag2` `agent-framework` `agentic` `agentic-ai` `ai` `ai-agents-framework` `aiagents` `genai` `llm` `llms` `mcp` `multi-agent` `multi-agent-system` `open-source` `python`

## Description

AG2 is a multi-agent large language model orchestration framework, agentic workflow automation tool, and RAG-enabled agent platform. It functions as a communication protocol and framework for coordinating multiple AI agents to solve complex tasks through shared state and standardized messaging.

The project distinguishes itself through flexible coordination strategies, including hierarchical agent organization, hub-and-spoke models, and dynamic routing that analyzes conversation context to distribute work. It implements multi-stage feedback loops for iterative refinement and uses schema-constrained output generation to ensure responses adhere to specific data models.

The system covers a broad capability surface, including retrieval augmented generation for external data integration, human-in-the-loop oversight for output validation, and secure external tool execution within isolated environments. It also provides shared state management for memory persistence across agent lifecycles and an error handling system that routes failures to recovery agents.

Model provider integration is managed through optional dependency groups for targeted installation.

## Tags

### Artificial Intelligence & ML

- [Agentic RAG Platforms](https://awesome-repositories.com/f/artificial-intelligence-ml/agentic-rag-platforms.md) — Provides a platform that combines retrieval augmented generation with reasoning agents for complex data fetching.
- [Multi-Agent Orchestrators](https://awesome-repositories.com/f/artificial-intelligence-ml/multi-agent-orchestrators.md) — Provides a framework for coordinating teams of specialized AI agents to solve complex multi-step tasks. ([source](https://cdn.jsdelivr.net/gh/ag2ai/ag2@main/README.md))
- [Agent-to-Agent Communication](https://awesome-repositories.com/f/artificial-intelligence-ml/agent-communication-protocols/agent-to-agent-communication.md) — Implements standardized protocols to facilitate secure and interoperable communication between different AI agents. ([source](https://ag2.ai/))
- [Hub-and-Spoke Coordination](https://awesome-repositories.com/f/artificial-intelligence-ml/agent-deployment/agent-hubs/hub-and-spoke-coordination.md) — Coordinates multiple specialist agents through a single central hub to leverage diverse expertise. ([source](https://docs.ag2.ai/latest/docs/user-guide/advanced-concepts/pattern-cookbook/overview/))
- [Agent State Management](https://awesome-repositories.com/f/artificial-intelligence-ml/agent-state-management.md) — Provides unified memory and state management to ensure consistency across multiple agent lifecycles. ([source](https://ag2.ai/))
- [Iterative Refinement Workflows](https://awesome-repositories.com/f/artificial-intelligence-ml/agentic-systems-frameworks/agentic-workflows/iterative-refinement-workflows.md) — Employs multi-stage feedback loops between agents to iteratively refine and improve the quality of generated content.
- [Multi-Agent Orchestration Frameworks](https://awesome-repositories.com/f/artificial-intelligence-ml/agentic-systems-frameworks/integration-deployment/agent-frameworks/agent-orchestrators/multi-agent-orchestration-frameworks.md) — Provides a framework for coordinating specialized LLM agents using hierarchical teams and dynamic routing.
- [Model Provider Integrations](https://awesome-repositories.com/f/artificial-intelligence-ml/agentic-systems-frameworks/model-integration-serving/ai-model-orchestration/model-provider-integrations.md) — Provides unified interfaces to connect and configure multiple large language model providers. ([source](https://docs.ag2.ai/latest/docs/user-guide/basic-concepts/installing-ag2/))
- [Agentic Traffic Routing](https://awesome-repositories.com/f/artificial-intelligence-ml/agentic-traffic-routing.md) — Determines the next appropriate specialist by analyzing semantic intent and conversation state. ([source](https://docs.ag2.ai/latest/docs/user-guide/advanced-concepts/pattern-cookbook/overview/))
- [Agentic Workflow Automation](https://awesome-repositories.com/f/artificial-intelligence-ml/agentic-workflow-automation.md) — Offers a platform for building AI workflows that integrate external tool execution and human-in-the-loop feedback.
- [LLM Tooling Integrations](https://awesome-repositories.com/f/artificial-intelligence-ml/artificial-intelligence-tooling/language-model-integrations/llm-tooling-integrations.md) — Connects large language models to external APIs and executes generated code in isolated environments.
- [Contextual Agent Routing](https://awesome-repositories.com/f/artificial-intelligence-ml/contextual-agent-routing.md) — Determines the next active agent by analyzing conversation context and agent descriptions.
- [External Tool Execution](https://awesome-repositories.com/f/artificial-intelligence-ml/external-tool-execution.md) — Runs generated code and API calls within isolated shells or kernels to perform computations.
- [External Tool Integration](https://awesome-repositories.com/f/artificial-intelligence-ml/external-tool-integration.md) — Connects agents to external APIs and custom functions to perform actions beyond text generation. ([source](https://cdn.jsdelivr.net/gh/ag2ai/ag2@main/README.md))
- [Hierarchical Agent Orchestration](https://awesome-repositories.com/f/artificial-intelligence-ml/hierarchical-agent-orchestration.md) — Implements a structural hierarchy where manager agents delegate tasks to specialized subordinate agents and aggregate their results.
- [Multi-Agent Orchestration Systems](https://awesome-repositories.com/f/artificial-intelligence-ml/multi-agent-orchestration-systems.md) — Coordinates multiple autonomous agents through hierarchies and hubs to solve tasks requiring diverse specialist expertise.
- [Structured Output Enforcements](https://awesome-repositories.com/f/artificial-intelligence-ml/structured-output-enforcements.md) — Constrains AI responses to specific schemas and data models to ensure consistent types and field presence. ([source](https://docs.ag2.ai/latest/docs/user-guide/basic-concepts/structured-outputs))
- [Cross-Framework Agent Coordination](https://awesome-repositories.com/f/artificial-intelligence-ml/agent-architectures/orchestration-engines/ai-agent/cross-framework-agent-coordination.md) — Integrates agents from different frameworks into a single team to enable cross-platform cooperation. ([source](https://ag2.ai/))
- [Sequential Agent Execution](https://awesome-repositories.com/f/artificial-intelligence-ml/agent-architectures/orchestration-engines/ai-agent/multi-agent-coordination-systems/sequential-agent-execution.md) — Organizes agents into a linear pipeline where each agent completes its action before passing work forward. ([source](https://docs.ag2.ai/latest/docs/user-guide/advanced-concepts/pattern-cookbook/overview/))
- [Agent Communication Protocols](https://awesome-repositories.com/f/artificial-intelligence-ml/agent-communication-protocols.md) — Uses standardized messaging formats to enable interoperability between agents from different frameworks.
- [Code Execution Environments](https://awesome-repositories.com/f/artificial-intelligence-ml/code-execution-environments.md) — Provides sandboxed environments using shells and kernels to execute agent-generated code blocks. ([source](https://cdn.jsdelivr.net/gh/ag2ai/ag2@main/README.md))
- [Code Execution Tools](https://awesome-repositories.com/f/artificial-intelligence-ml/code-execution-tools.md) — Ships built-in tools that allow agents to perform computations and data manipulation via dynamic code execution. ([source](https://docs.ag2.ai/latest/))
- [Retrieval-Augmented Generation](https://awesome-repositories.com/f/artificial-intelligence-ml/conversational-interfaces/retrieval-augmented-generation.md) — Grounds model responses by retrieving relevant information from external knowledge bases before generation. ([source](https://cdn.jsdelivr.net/gh/ag2ai/ag2@main/README.md))
- [External Knowledge Integrators](https://awesome-repositories.com/f/artificial-intelligence-ml/external-service-integrations/external-knowledge-integrators.md) — Connects agents to external databases and APIs to enable retrieval-augmented generation from specific documents. ([source](https://docs.ag2.ai/latest/))
- [Human-in-the-Loop Workflows](https://awesome-repositories.com/f/artificial-intelligence-ml/human-in-the-loop-workflows.md) — Integrates human oversight into workflows to validate outputs or provide guidance before tasks are finalized. ([source](https://cdn.jsdelivr.net/gh/ag2ai/ag2@main/README.md))

### Part of an Awesome List

- [AI Agents and Automation](https://awesome-repositories.com/f/awesome-lists/ai/ai-agents-and-automation.md) — Orchestrates autonomous agents through sequential pipelines and iterative loops to automate complex AI workflows.
- [Conversational Task Routing](https://awesome-repositories.com/f/awesome-lists/ai/specialized-rag-agents/conversational-task-routing.md) — Analyzes conversation context to automatically route work to the most appropriate specialized AI agent. ([source](https://docs.ag2.ai/latest/docs/user-guide/advanced-concepts/pattern-cookbook/overview/))
- [AI and Agents](https://awesome-repositories.com/f/awesome-lists/ai/ai-and-agents.md) — An open-source AgentOS for multi-agent orchestration and building agentic AI systems.

### Software Engineering & Architecture

- [Agent Coordination State](https://awesome-repositories.com/f/software-engineering-architecture/shared-memory-management/agent-coordination-state.md) — Maintains a unified shared state across agent lifecycles to ensure context persistence and consistency during task execution.
- [Request Triage](https://awesome-repositories.com/f/software-engineering-architecture/system-internals/centralization-patterns/workflow-execution-managers/complex-workflow-coordination/request-triage.md) — Implements workflows that break complex requests into categorized tasks for processing by specialized agents. ([source](https://docs.ag2.ai/latest/docs/user-guide/advanced-concepts/pattern-cookbook/overview/))
- [Complexity-Based Routers](https://awesome-repositories.com/f/software-engineering-architecture/task-complexity-analyzers/complexity-based-routers.md) — Automatically assigns the most suitable AI model or agent based on an analysis of the task complexity. ([source](https://docs.ag2.ai/latest/docs/user-guide/advanced-concepts/pattern-cookbook/overview/))

### Data & Databases

- [Schema-Adherent Generation](https://awesome-repositories.com/f/data-databases/json-schema-modeling/schema-adherent-generation.md) — Constrains model responses to specific data models to ensure consistent types and guaranteed field presence.
