ag2

Repo

A Python framework for building AI agents and multi-agent systems, the successor to AutoGen.

5.1k805PythonApache-2.0

Claim this listing

Made ag2? Claim it to edit the listing and see how many people view it. Sign in to claim

AG2 is an open-source Python framework for building AI agents and getting several agents to cooperate on tasks. It is for developers who want a typed, async agent toolkit and who know the project formerly as AutoGen.

It is written in Python, uses the Apache-2.0 license, and has about 5,000 stars. The README says a volunteer group from several organizations maintains it.

Table of contents

  1. What AG2 does
  2. Key features
  3. How to get started
  4. Who should use it, and when to skip it
  5. AG2 alternatives
  6. License and cost
  7. FAQs

What AG2 does

AG2 gives you an Agent class, tools the agent can call, human-in-the-loop controls, and a way to orchestrate multiple agents. The README calls it an open-source AgentOS for AI agents. Everything is async, and a call to Agent.ask(...) returns an AgentReply whose text is in reply.body.

An important detail: this repository is AG2 v1.0, a rewrite. The old AutoGen-derived framework, with import autogen, ConversableAgent, GroupChat and swarms, now lives in a separate repository called ag2-classic. This repo no longer ships the autogen import name. In v1.0 the top-level package is ag2, and multi-agent work uses a Network model built from a hub and channels instead of group chats.

Key features

  • A protocol-driven core with Agent as the main class.
  • Tools, human-in-the-loop, and multi-agent orchestration through Network.
  • An agent harness with knowledge and compaction, described in the README.
  • Provider extras for installing only what you need: ag2[openai], ag2[anthropic], ag2[gemini], ag2[ollama] and others.
  • API keys read from standard environment variables such as OPENAI_API_KEY, ANTHROPIC_API_KEY and GEMINI_API_KEY, or passed explicitly per request.
  • Python 3.11 or newer.
  • A migration guide from group chat to Network in the docs.

The topics on the repo also list A2A and MCP support, though the README sections reviewed here focus on the core agent model.

How to get started

Install with the extra for your model provider. On Windows and Linux:

pip install ag2[openai]

On macOS, quote it:

pip install 'ag2[openai]'

Set your key:

export OPENAI_API_KEY="<your-api-key>"

Then follow the Quick Start in the docs at docs.ag2.ai, where the README shows an async example using Agent and a provider config such as OpenAICompletionsConfig(model="gpt-4o-mini"). If your code already imports autogen, do not upgrade to ag2>=1.0. The README says to stay on Classic and pin the classic distribution:

pip install ag2-classic

Who should use it, and when to skip it

AG2 fits Python developers building agent workflows, especially ones that need several agents to hand off work, and teams with existing AutoGen code who want a maintained path. It also suits researchers who want an open framework to modify.

Skip it if you have a working AutoGen project and no reason to rewrite, because v1.0 is not a drop-in upgrade. The agent model, orchestration and imports all changed. Skip it if you want a visual builder or hosted service, since this is a code library. Because the rewrite is recent, expect docs and community examples to mix v1.0 and Classic, and check which one a tutorial uses.

AG2 alternatives

Widely known alternatives include CrewAI, LangGraph and the OpenAI Agents SDK. They differ in orchestration style: CrewAI uses roles and crews, LangGraph uses explicit graphs, and AG2 uses a network of agents. AgentOps, an observability SDK, lists AG2 among its integrations. See AG2 alternatives and the AI repos directory.

License and cost

AG2 is Apache-2.0 and free. You pay your model provider for tokens. The README gives support contact addresses for the project administrators but lists no paid plan.

FAQs

Is AG2 the same as AutoGen?

AG2 is the continuation of the project formerly known as AutoGen. The old namespace now lives in ag2-classic, and v1.0 in this repo is a redesign.

Can I upgrade my AutoGen code to AG2 v1.0?

Not directly. The README says v1.0 is not a drop-in upgrade, and tells Classic users to pin ag2-classic instead.

Which Python version do I need?

Python 3.11 or newer.

Which model providers does AG2 support?

The README names OpenAI, Anthropic, Gemini and Ollama as install extras, and says there are others.

How does multi-agent work in v1.0?

Through Network, a hub-and-channels model that replaces the old GroupChat approach.

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

Reviews (0)

No reviews yet.

Sign in to write a review.

Similar Repos

Open Source

LangChain

Agent engineering platform for building LLM applications from composable parts

Reviewed by hand · Jun 2026
Free

ECC

Agent harness optimisation for Claude Code, Codex, OpenCode and Cursor

Reviewed by hand · May 2026
Free

Hermes Agent

Self-improving agent from Nous Research that learns across sessions

Reviewed by hand · May 2026
Free

Skills for Real Engineers

Small, composable agent skills from Matt Pocock's daily .agents directory

Reviewed by hand · Apr 2026