Repolode
ag2ai

ag2ai/ag2

Python framework for building AI agents that use LLMs and tools, and coordinate with each other in multi-agent workflows.

Stars
5,010
Forks
754
Open issues
70
Last commit
13 hours ago

What is it?

AG2 (formerly AutoGen) is an open-source Python framework for building AI agents and coordinating several agents to solve a task. An `Agent` talks to a model provider, calls Python functions decorated with `@tool`, and runs the full tool-calling loop. Provider support is installed as extras such as `ag2[openai]`, `ag2[anthropic]`, `ag2[gemini]` and `ag2[ollama]`.

For multi-agent work, AG2 v1.0 uses a `Hub` that manages agent registration, a write-ahead log and an audit trail, with agents exchanging messages over typed channels such as `conversation`, `consulting`, `discussion` and `workflow`. The project also offers a harness layer with opt-in knowledge storage, history compaction and human-in-the-loop input via `context.input(...)`. Version 1.0 is not a drop-in upgrade from the classic `autogen` namespace, which now lives in a separate repository, ag2-classic.

Key features

  • 01Agent class with async `ask()` calls and multi-turn conversation continuation.
  • 02Tool calling through plain Python functions decorated with `@tool`.
  • 03Support for multiple LLM providers installed as optional extras.
  • 04Human-in-the-loop pauses that collect input from a person during a run.
  • 05Hub-based multi-agent orchestration over typed channels with a write-ahead log.
  • 06Opt-in knowledge store and history compaction for persistent memory.

Use cases

  • Building a single assistant agent that calls custom Python tools against an LLM API.
  • Coordinating a planner and reviewer agent to refine outputs through conversation.
  • Adding approval steps where a person must confirm an action before a tool runs.
  • Prototyping agentic research or multi-agent workflows in Python.

Quick start

  1. 1

    Install the package with the OpenAI extra

    pip install ag2[openai]
  2. 2

    Set your OpenAI API key as an environment variable

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

    Save the first-agent example from the README and run it

Things to know

  • Requires Python 3.10 or newer.
  • Running the examples needs a paid OpenAI API key or another model provider key.
  • Not a drop-in upgrade from AG2 Classic; the autogen import and classic agent classes were removed.

Topics

FAQ

What is ag2?
Python framework for building AI agents that use LLMs and tools, and coordinate with each other in multi-agent workflows. AG2 (formerly AutoGen) is an open-source Python framework for building AI agents and coordinating several agents to solve a task. An `Agent` talks to a model provider, calls Python functions decorated with `@tool`, and runs the full tool-calling loop. Provider support is installed as extras such as `ag2[openai]`, `ag2[anthropic]`, `ag2[gemini]` and `ag2[ollama]`.
Is ag2 free to use? What license does it have?
ag2 is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is ag2 still maintained?
Actively maintained. The last commit to ag2 was on Oct 21, 2026.
What can I use ag2 for?
Building a single assistant agent that calls custom Python tools against an LLM API. Coordinating a planner and reviewer agent to refine outputs through conversation. Adding approval steps where a person must confirm an action before a tool runs. Prototyping agentic research or multi-agent workflows in Python.
How do I install ag2?
Install the package with the OpenAI extra: pip install ag2[openai] Set your OpenAI API key as an environment variable: export OPENAI_API_KEY="<your-api-key>" Save the first-agent example from the README and run it
Where can I get ag2?
The source code and installation instructions are on GitHub: https://github.com/ag2ai/ag2

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects