尚未收集仓库信息。
尚未检测到更新。GitHub 发布版本后会显示在这里。
AG2 (formerly AutoGen): The Open-Source AgentOS.Join us at: https://discord.gg/sNGSwQME3x
翻译准备中
正在加载完整 README。
查看完整 README ↗[!IMPORTANT] Looking for
ConversableAgent,GroupChat, orimport autogen? That's now AG2 Classic.As of AG2 v1.0, the protocol-driven framework is the top-level package, imported as
ag2. The classic framework has moved to its own repository — ag2ai/ag2-classic, documented at classic.docs.ag2.ai. It is still maintained and installable; nothing you have built stops working.This repository (
pip install ag2) no longer ships theautogenimport name or the classic agent classes.
AG2 is an open-source programming framework for building AI agents and facilitating cooperation among multiple agents to solve tasks. AG2 aims to streamline the development and research of agentic AI. It offers features such as agents capable of interacting with each other, facilitates the use of various large language models (LLMs) and tool use support, autonomous and human-in-the-loop workflows, and multi-agent conversation patterns.
The project is currently maintained by a dynamic group of volunteers from several organizations. Contact project administrators Chi Wang and Qingyun Wu via [email protected] if you are interested in becoming a maintainer.
autogen.* namespace)AG2 Classic is the original AutoGen-derived framework: the autogen.* import namespace and its agent classes — ConversableAgent, AssistantAgent, UserProxyAgent, GroupChat / GroupChatManager, swarms, register_function, LLMConfig / OAI_CONFIG_LIST, and the nested- and sequential-chat patterns.
It now lives in its own repository and has its own documentation site:
| AG2 Classic | AG2 (this repo) | |
|---|---|---|
| Repository | ag2ai/ag2-classic | ag2ai/ag2 |
| Documentation | classic.docs.ag2.ai | docs.ag2.ai |
| Import | import autogen | import ag2 |
| Core agent | ConversableAgent | Agent |
| Multi-agent | GroupChat, swarms, nested chats | Network (hub + channels) |
If any of the following appear in your code, you are on Classic — stay on it, and use classic.docs.ag2.ai:
import autogen # the autogen.* namespace
from autogen import ConversableAgent, GroupChat # classic agent classes
from autogen import AssistantAgent, UserProxyAgent
Classic remains maintained and installable. Your existing code keeps working — pin the classic distribution instead of ag2>=1.0:
pip install ag2-classic
[!NOTE] AG2 v1.0 (
pip install ag2) is not a drop-in upgrade from Classic. The agent model, orchestration, and imports all changed. See the group chat migration guide.
The rest of this README covers AG2 v1.0 (import ag2).
For a step-by-step walk through of AG2 concepts and code, see the Quick Start in our documentation.
AG2 requires Python version >= 3.11. AG2 is available as ag2 on PyPI.
Windows/Linux:
pip install ag2[openai]
Mac:
pip install 'ag2[openai]'
Minimal dependencies are installed by default. Install the extra that matches your model provider — ag2[openai], ag2[anthropic], ag2[gemini], ag2[ollama], and so on.
Each provider config reads its standard environment variable, so keys never need to be hardcoded or checked in:
export OPENAI_API_KEY="<your-api-key>" # or ANTHROPIC_API_KEY, GEMINI_API_KEY, ...
You can also pass a key explicitly with OpenAICompletionsConfig(model="gpt-4o-mini", api_key=...) — useful when each request brings its own key.
AG2 is async throughout. Agent.ask(...) starts a turn and returns an AgentReply; the text is in reply.body.
import asyncio
from ag2 import Agent
from ag2.config import OpenAICompletionsConfig
agent = Agent(
"assistant",
prompt="You are a helpful assistant.",
config=OpenAICompletionsConfig(model="gpt-4o-mini"),
)
async def main() -> None:
reply = await agent.ask("Summarize the main differences between Python lists and tuples.")
print(reply.body)
asyncio.run(main())
We maintain both a live playground and a dedicated repository with a wide range of applications to help you get started with various use cases, and a set of runnable code examples in the documentation.
以上为 README 的开头部分。其余内容请阅读原文。 查看完整 README ↗