ag2
A programming framework for agentic AI
What it is and what it does
AG2 is a protocol-driven framework for building AI agents and coordinating multiple agents to solve tasks. It replaces the earlier AutoGen Classic framework (now maintained separately as ag2-classic) with a new agent model centered on async-first design, a Network-based orchestration pattern for multi-agent coordination, and integration with multiple LLM providers through a unified config interface. The core building block is the Agent class, which talks to a model provider, can invoke tools, and returns structured replies; conversations are stateful, so calling ask() on a reply continues the same conversation thread.
The framework is designed for developers building autonomous or human-in-the-loop workflows where agents need to collaborate, persist knowledge, and call external functions. It uses pydantic for configuration, supports Python 3.10 through 3.14, and is actively maintained. The package is permissively licensed (Apache-2.0) and has no known security vulnerabilities.
Use it for:
- Build a code-review agent that analyzes code snippets and suggests improvements across multiple turns.
- Coordinate multiple specialized agents (e.g., researcher, writer, editor) over a typed channel network to collaboratively produce documents.
- Create an autonomous assistant that calls external APIs or Python functions to fetch data, process it, and report results.
- Implement a human-in-the-loop workflow where an agent pauses to request confirmation or missing information from a person.
- Develop a multi-turn conversational system where agent state and history persist across multiple user interactions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
AG2 is a Python framework for building AI agents that interact with language models, call tools, and coordinate with other agents to solve tasks.
Yes. AG2 is a mature, actively maintained framework (Production/Stable status) with low install friction, permissive licensing, no known vulnerabilities, and strong community adoption. Install it if you need to build AI agents that coordinate with LLMs and other agents. Note: this is a breaking change from AG2 Classic (autogen namespace) — if you have existing Classic code, stay on ag2-classic or consult the migration guide.
Install
ag2 on PyPI
pip
pip install ag2uv
uv add ag2poetry
poetry add ag2Installing ag2
Before you install
Installation is straightforward with low friction; the package is actively maintained with a recent release and strong repository activity. Requires Python 3.10 or later and pulls in 9 runtime dependencies including pydantic, httpx, and tiktoken.
License in practice
Licensed under Apache-2.0 (permissive), so you can use, modify, and distribute AG2 freely in commercial and private projects without restriction.
Quickstart
pip install ag2[openai]
import asyncio
from ag2 import Agent
from ag2.config import OpenAIConfig
agent = Agent(
"assistant",
prompt="You are a helpful assistant.",
config=OpenAIConfig(model="gpt-4o-mini"),
)
async def main():
reply = await agent.ask("Your question here")
print(reply.body)
asyncio.run(main())
Requires Python 3.10 or later. You must set OPENAI_API_KEY or provide an API key explicitly to OpenAIConfig; other model providers require their respective environment variables or explicit configuration.
Verify before relying
- Whether the framework supports streaming responses or only turn-based ask/reply patterns.
- What tool-calling capabilities are available and how they compare to direct function registration.
- Performance characteristics and latency for multi-agent coordination at scale.
- How the Network orchestration model differs functionally from the classic GroupChat pattern beyond naming.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 9 — termcolor, python-dotenv, tiktoken, pydantic, pyyaml, packaging, httpx, anyio, fast-depends |
| Maintenance | actively maintained — 16 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 505,464/month — #6,291 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ag2-1.0.1-py3-none-any.whl
Keywords: ai, agent, autogen, ag2, ag2.ai, ag2ai, agentic
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
autogenA framework for building AI agents that…
permissive · top 15,000 on PyPI
pyautogenpyautogen is a proxy package that redirects to…
permissive · top 15,000 on PyPI
agent-framework-coreBuild, orchestrate, and deploy AI agents and…
permissive · top 5,000 on PyPI
langgraphLangGraph is a low-level orchestration…
permissive · top 1,000 on PyPI
agnoAgno is a framework and runtime for building,…
permissive · top 5,000 on PyPI
agent-framework-claudeIntegrates Claude with Microsoft Agent…
permissive · top 15,000 on PyPI
agent-frameworkBuilds and orchestrates AI agents powered by…
permissive · top 5,000 on PyPI
fasta2aFastA2A converts an AI agent into an…
permissive · top 15,000 on PyPI
pydantic-deepA Python framework and terminal assistant for…
permissive · top 15,000 on PyPI
agentscopeAgentScope is a production-ready framework for…
permissive · top 15,000 on PyPI