This is an early release preview. You may encounter bugs.
AG2 logo
Unclaimed

Tool coding

AG2

Open-source framework for building AI agents and orchestrating cooperation among multiple agents

A+ 91/100 GitHub score ? This grade is derived from GitHub signals, not user votes. Open for the full breakdown.
No votes yet

01 / About

What AG2 is.

AG2 is a Python programming framework for building AI agents and coordinating multiple agents to solve tasks together. It supports agents that interact with each other, use of various large language models (LLMs) and tools, autonomous and human-in-the-loop workflows, and multi-agent conversation patterns, and is aimed at both application development and agentic AI research.

As of v1.0 the protocol-driven framework is the top-level ag2 package. The original AutoGen-derived framework — the autogen.* namespace with ConversableAgent, GroupChat, swarms, and nested chats — now lives in a separate ag2-classic distribution with its own documentation and remains maintained. AG2 v1.0 is not a drop-in upgrade: the agent model, orchestration, and imports all changed.

The framework is async throughout. Agent is the core building block: it talks to a model provider, calls tools, and returns an AgentReply; calling ask() on a reply continues the same conversation. Provider configs (OpenAIConfig and equivalents for Anthropic, Gemini, Ollama, and others) read their standard environment variables. Tools are plain Python functions decorated with @tool, and a hitl_hook lets a tool pause the run to ask a person for confirmation or missing information.

Multi-agent coordination uses the Network: a Hub that owns the registry, a write-ahead log, and an audit trail, with agents exchanging messages over typed channels such as a two-party conversation channel. An opt-in harness layers persistent knowledge stores, context assembly policies, and history compaction onto an agent so it remembers across runs and bounds history growth.

Features

  • Agent: a model loop that runs turns via ask(), calls tools, and preserves conversation history across follow-up calls on the reply
  • Tools: Python functions decorated with @tool; the model decides when to call them, AG2 executes them, and the result is fed back
  • Human in the loop: context.input(...) inside a tool pauses the run and routes the question through a hitl_hook (CLI prompt, web UI, queue)
  • Network: a Hub with registry, write-ahead log, and audit trail, connecting agents over typed channels
  • Knowledge stores: memory- or disk-backed KnowledgeStore instances the agent can read and write across runs
  • Compaction: strategies such as SummarizeCompact that fold dropped turns into a summary once a CompactTrigger fires
  • Context assembly: policies such as WorkingMemoryPolicy that inject stored memory into the system prompt on every turn
  • Event streams: subscribe to events such as CompactionCompleted and CompactionFailed during a run
  • Provider configs: OpenAIConfig and provider extras for Anthropic, Gemini, Ollama, and others
  • Further capabilities: structured output, middleware, observers, telemetry, evaluation, and testing utilities
  • AG2 Classic: the autogen namespace and classic agent classes, still installable as ag2-classic

02 / Discussion CREDIBILITY-GATED

Discussion

Reading is open to everyone. Posting and voting need a verified identity or a GitHub grade of B or higher.

  • No discussions yet.

03 / Build

Build with AG2.

Browse the catalogue for frameworks, tools, and harnesses, each scored on real GitHub credibility.

Get AG2 →

Browse the catalogue