ag2
A programming framework for agentic AI
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- 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.
- Installation is straightforward with low friction; the package is actively maintained with a recent release and strong repository activity.
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive), so you can use, modify, and distribute AG2 freely in commercial and private projects without restriction.
last release 2026-07-29 (16 days) · last repo commit 2026-08-14 · 4,859 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 505,464 downloads/mo, #6,291 on PyPI
Alternatives
Verify before relying
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())- 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.
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 on it.
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
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.
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.
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())
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 packagestermcolorpython-dotenvtiktokenpydanticpyyamlpackaginghttpxanyiofast-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 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: PydanticFramework :: Pydantic :: 2Intended Audience :: DevelopersIntended Audience :: Information TechnologyOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonTopic :: Software DevelopmentTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Application FrameworksTopic :: Software Development :: Libraries :: Python Modules |
Evidence: ag2-1.0.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “autonomous agent programming”
- ag2AG2 is a Python framework for building AI agents that interact with…
- crewaiCrewAI is a Python framework for building multi-agent AI systems…
- stirrupStirrup is a lightweight Python framework for building LLM-powered…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also autogen · pyautogen · agent-framework-core · langgraph · agno · agent-framework-claude · agent-framework · fasta2a · pydantic-deep · agentscope