AG2AG2
AG2 是 AutoGen 停更后由社区接棒的续作。 仓库描述直接写着 "AG2 (formerly AutoGen)"。
README 也自述维护方:
"a dynamic group of volunteers from several organizations"
理解它必须先分清两条线:
| AG2(本条目) | Microsoft Agent Framework | |
|---|---|---|
| 维护方 | 社区(ag2ai) | 微软官方 |
| 与 AutoGen 关系 | 社区延续 / fork 后的独立演进 | 官方把 AutoGen + Semantic Kernel 合并继任 |
| 顶层 import | import ag2 | agent_framework / Microsoft.Agents.AI |
这也是本项目的 harness 分区当初的取舍依据。
它把 AutoGen 原仓库列为「明确不收对象」。
原仓 pushed_at 停在 2026-04-15,社区已转向 AG2。
收 AG2 而非 AutoGen,正是「跟着仍在更新的那支血脉走」。
AG2 is an open-source Python framework for building AI agents and coordinating multiple agents to solve tasks, with "agents capable of interacting with each other," broad LLM support, tooling, autonomous and human-in-the-loop workflows, and multi-agent conversation patterns. It is the community continuation of AutoGen: as of v1.0 the protocol-driven framework became the top-level package (import ag2), while the classic framework (ConversableAgent, GroupChat, import autogen) moved to its own repository, ag2ai/ag2-classic. Officially, "AG2 v1.0 (pip install ag2) is not a drop-in upgrade from Classic. The agent model, orchestration, and imports all changed." v1.0 orchestrates agents through the Network — a Hub that owns the registry, write-ahead log, and audit trail, with agents talking over typed channels — and exposes an opt-in harness of composable primitives (assembly=, knowledge=, tasks=). It is licensed Apache-2.0 and runs entirely in your own process (no managed hosting), so the only cost is model calls, billed by whichever provider you install.
适合与不适合When to use it, when not to
适合:
- 用 Python 编排多 agent 会话 / 协议化网络
- 需要可审计的 durable messaging 与跨进程部署
- 要在本地模型上跑(Ollama / vLLM / LM Studio)
- 要 HITL 与受限 shell
- 需要 MCP 与 AG-UI
- 偏好 opt-in、可组合的 harness 原语
不适合:
- 期待
pip install ag2仍是老 AutoGen - 需要厂商托管后台
- 需要开箱即用的容器级沙箱
- 非 Python 技术栈
Orchestrating multi-agent conversations / a protocol-driven network in Python (Hub + channels, with consulting, discussion, and workflow adapters) Needing auditable durable messaging (write-ahead log, audit trail) and cross-process deployment (WsLink) Running on local models (Ollama / vLLM / LM Studio) Needing HITL and a restricted shell tool; MCP and AG-UI integration Preferring opt-in, composable harness primitives
Not a fit for expecting pip install ag2 to still be the classic AutoGen API (since v1.0 those classes live in ag2-classic); needing a vendor-managed backend (it is a pure library — you run the process); needing out-of-the-box container-level sandboxing (officially you get a restricted-shell allowlist, not a container); or non-Python stacks (there is no official non-Python port).
中文生态China availability 国产 / 国内可直接用 / 备案状态 · 快照domestic / direct access / CAC filing · snapshot 2026-10-20
- 出品属地Origin
- 国外出品foreign-made 国外主体(网信办公示名单未见对应备案主体)。foreign entity (no matching filing entity in the CAC registry).
- 国内使用Direct access
- 大陆可直连direct OK 官网直连实测 200。official site measured 200 direct.
- 备案状态CAC filing
- 未见于备案名单not in filing list:未见于网信办公示名单(2026-10-20 检索 13 批附件,https://www.cac.gov.cn/2024-04/02/c_1713729983803145.htm);该产品未面向大陆公众提供服务,备案不适用。not in the CAC public registry (13 batch attachments searched 2026-10-20, https://www.cac.gov.cn/2024-04/02/c_1713729983803145.htm); the product does not serve the mainland public, so filing does not apply.
备案信息以网信办《生成式人工智能服务已备案信息》公示名单为准(按批次滚动更新,本站只抄编号不解读);「大陆可直连」是本站从大陆网络直连实测的结果,不是厂商承诺。GitHub 类站点当日实测有波动,口径写在依据里。Filing status is quoted from the CAC public registry (updated batch by batch; this site copies the number and does not interpret it). "Direct access" is this site's own reachability measurement from a mainland network, not a vendor promise. GitHub-hosted sites fluctuated on the measurement day — the note says so.
固定坐标系Fixed coordinate system
8 个维度dimensions, 与同分区其他对象逐项可比each comparable item by item against others in the same section.
- 模型与开放条件Model & openness
provider 清单是显式的、类型安全的配置类,覆盖云端与本地两条路。
官方
beta/model_configuration页原文:"The AG2 framework provides an explicit, predictable, and type-safe way to configure Large Language Models"
每家 provider 一个 Config 类 + 一个 extra:
OpenAIConfig/OpenAIResponsesConfig(ag2[openai])AnthropicConfig(ag2[anthropic])GeminiConfig/VertexAIConfig(ag2[gemini])BedrockConfig(ag2[bedrock])OllamaConfig(ag2[ollama])DashScopeConfig(ag2[dashscope])XAIConfig(ag2[xai])ZAIConfig(ag2[zai])
本地 / 自托管明确支持。
官方专列一节 "Self-Hosted and OpenAI-Compatible Models(vLLM, LM Studio, etc.)", 走
OpenAIConfig的 base_url。README 亦列出ag2[ollama]。Bedrock 于 v1.1.1 改为原生异步客户端 aiobotocore。官方 release 明示为 breaking。
未知 —— 换 provider 后 tool calling / structured output 的可靠性对比,官方未说明 (已查
beta/model_configuration与 Grok 兼容页)。The provider list is explicit, type-safe config classes, covering both cloud and local paths.
Official
beta/model_configurationpage wording:"The AG2 framework provides an explicit, predictable, and type-safe way to configure Large Language Models"
One Config class + one extra per provider:
OpenAIConfig/OpenAIResponsesConfig(ag2[openai])AnthropicConfig(ag2[anthropic])GeminiConfig/VertexAIConfig(ag2[gemini])BedrockConfig(ag2[bedrock])OllamaConfig(ag2[ollama])DashScopeConfig(ag2[dashscope])XAIConfig(ag2[xai])ZAIConfig(ag2[zai])
Local / self-hosted support is explicit.
The official docs have a dedicated section "Self-Hosted and OpenAI-Compatible Models (vLLM, LM Studio, etc.)", via
OpenAIConfig's base_url. The README also listsag2[ollama].Bedrock switched to the native async client aiobotocore in v1.1.1. The official release marks it breaking.
Unknown — how tool calling / structured output reliability compares across providers, not stated officially (
beta/model_configurationand the Grok compatibility page checked).- 运行位置Where it runs
纯 Python 库,异步贯穿,不提供托管服务。
README 原文:
"AG2 requires Python version >= 3.10"
"AG2 is async throughout.
Agent.ask(...)starts a turn and returns anAgentReply"安装是
pip install ag2[openai]。多 agent 的调度形态官方给了两种链路(
network/overview页):- 默认
LocalLink—— 官方描述:
"same-process duplex queues"
即同进程内 hub + agents。
- 换成
WsLink—— 官方描述:
"the hub and each agent as separate OS processes connected over WebSocket"
即 hub 与每个 agent 分处不同操作系统进程。
换链路时
HubClientAPI 不变、无需改业务代码。它不运营 agent loop。
库里的一切跑在你自己的进程 / 主机上,官方无 any 托管 offer。
A pure Python library, async throughout, no hosted service.
README wording:
"AG2 requires Python version >= 3.10"
"AG2 is async throughout.
Agent.ask(...)starts a turn and returns anAgentReply"Install is
pip install ag2[openai].The official docs give two scheduling links for multi-agent form (
network/overviewpage):- default
LocalLink— official description:
"same-process duplex queues"
i.e. hub + agents inside one process.
- switch to
WsLink— official description:
"the hub and each agent as separate OS processes connected over WebSocket"
i.e. the hub and each agent live in separate OS processes.
When switching links the
HubClientAPI is unchanged; no business-code changes needed.It does not operate an agent loop.
Everything in the library runs on your own process / host; the official docs offer no hosted offering.
- 默认
- 本地文件Local files
框架不内置通用文件工具。文件能力来自 KnowledgeStore 与沙箱 shell 工具。
后者的边界写得比多数同类清楚,这是本对象最值得记的一处。
① 磁盘知识库。
官方 harness 示例用
DiskKnowledgeStore(Path("./knowledge_demo")),官方注释:"Disk-backed, so anything the agent remembers survives the process exiting"
即知识落盘位置由你指定的目录决定。
② 受限 shell(已核到,见官方 release v1.1.1)。
受限模式 "runs commands without a shell"。
SandboxShellTool/ShellAdapter传allowed=[...]或readonly=True时, 会把命令切分成 argv。然后只检查 argv 再原样执行:官方原文:"Nothing can expand after the check"
管道 / 重定向 / 通配符 / 变量在受限模式下被拒。
readonly=True只放行不可写文件、不启动其它程序的命令blocked=[...]官方明说:
"remains best-effort. It is not a security boundary."
未知 —— 框架级的默认文件访问边界与容器级隔离,官方未说明 (已查
network/overview、agent_harness与 release 页)。The framework ships no general-purpose file tools. File capability comes from KnowledgeStore and the sandboxed shell tool.
The latter's boundaries are written more clearly than most peers — the single most notable thing about this object.
① Disk knowledge store.
The official harness example uses
DiskKnowledgeStore(Path("./knowledge_demo")), official comment:"Disk-backed, so anything the agent remembers survives the process exiting"
i.e. where knowledge lands on disk is decided by the directory you specify.
② Restricted shell (verified, see official release v1.1.1).
Restricted mode "runs commands without a shell".
When
SandboxShellTool/ShellAdaptergetsallowed=[...]orreadonly=True, it splits the command into argv. Then it checks only the argv and executes it verbatim:Official wording: "Nothing can expand after the check"
Pipes / redirection / wildcards / variables are rejected in restricted mode.
readonly=Trueallows only non-writing commands that launch no other programsblocked=[...]officially stated plainly:
"remains best-effort. It is not a security boundary."
Unknown — framework-level default file-access boundaries and container-level isolation, not stated officially (
network/overview,agent_harnessand the release page checked).- 关机后的任务Tasks after shutdown
「关机后还能跑」在本站是纯库形态 —— 没有托管后台。
但 durable messaging 机制官方给了明确实现。
network/overview页列出的 Network 能力包含:"Durable messaging with replayable channel transcripts (write-ahead log)"
"Distributed / cross-process deployment: replace
LocalLinkwithWsLink"hub 持有权威状态:registry、audit log、channel table、write-ahead logs。客户端是:
"thin frontends"
官方另有 Distributed Deployment 专页。
它涵盖 WsLink、serve_ws、auth、at-least-once delivery、reconnect 与 task durability。
长期记忆可跨进程存活。 DiskKnowledgeStore 落盘,见 local_files 轴。
但没有任何厂商托管 offer。
进程必须跑在你自己的服务器上;要真后台得自己上容器 / K8s。
未知 —— 托管选项与断点续跑在崩溃场景下的具体语义,官方未说明 (已查
network/overview页)。"Still running after shutdown" is pure-library form on this site — there is no hosted background.
But the durable messaging mechanism has an explicit official implementation. The Network capabilities listed on the
network/overviewpage include:"Durable messaging with replayable channel transcripts (write-ahead log)"
"Distributed / cross-process deployment: replace
LocalLinkwithWsLink"The hub holds authoritative state: registry, audit log, channel table, write-ahead logs. Clients are:
"thin frontends"
There is also a dedicated Distributed Deployment page.
It covers WsLink, serve_ws, auth, at-least-once delivery, reconnect and task durability.
Long-term memory can survive across processes. DiskKnowledgeStore persists to disk, see the local_files axis.
But there is no vendor-hosted offering at all.
Processes must run on your own servers; a true background needs your own containers / K8s.
Unknown — hosting options and the exact semantics of resume-after-crash, not stated officially (
network/overviewpage checked).- 工具与扩展Tools & extensions
工具、MCP、AG-UI 三项都能在官方源核到;A2A 仅见仓库 topics。
① 原生工具。
普通 Python 函数加
@tool装饰器即成为工具。官方原文:"AG2 runs the full tool-calling loop: the model decides when to call it, AG2 executes it, and the result is fed back"
agent 还可
Agent.as_tool()被别的 agent 当工具用。② MCP。
官方 release 记录持续维护
MCPToolkit与MCPServerTool:- v1.1.1 "send exactly one
Authorizationheader on every provider" - v1.1.2 "fix(mcp): derive model output schemas from serialization"
③ AG-UI。
- v1.1.2 "feat(ag-ui)!: serve AG-UI 1.0"
- v1.1.1 支持 "Human input over AG-UI"(工具内
context.input()的问题经 AG-UI 客户端以 interrupt 抛出)
④ Skills。
官方 release 有 skill 相关修复:
- "check local skill ownership before validating arguments"
- "execute nested scripts from declared paths"
A2A 目前只能在官方仓库 topics 里看到(含
a2a)。未取到 v1.0 的 A2A 专页正文,故不展开。
子任务委派另有
run_subtask/run_subtasks自动注入工具(见 context 轴)。Tools, MCP and AG-UI are all verifiable from official sources; A2A is only seen in repository topics.
① Native tools.
A plain Python function with the
@tooldecorator becomes a tool. Official wording:"AG2 runs the full tool-calling loop: the model decides when to call it, AG2 executes it, and the result is fed back"
Agents can also be used as tools by other agents via
Agent.as_tool().② MCP.
Official releases record ongoing maintenance of
MCPToolkitandMCPServerTool:- v1.1.1 "send exactly one
Authorizationheader on every provider" - v1.1.2 "fix(mcp): derive model output schemas from serialization"
③ AG-UI.
- v1.1.2 "feat(ag-ui)!: serve AG-UI 1.0"
- v1.1.1 supports "Human input over AG-UI" (questions via
context.input()inside tools are raised as interrupts to the AG-UI client)
④ Skills.
Official releases contain skill-related fixes:
- "check local skill ownership before validating arguments"
- "execute nested scripts from declared paths"
A2A can currently only be seen in the official repository topics (including
a2a).This pass did not capture the body of a v1.0 A2A dedicated page, so it is not expanded.
Subtask delegation has separately auto-injected
run_subtask/run_subtaskstools (see the context axis).- v1.1.1 "send exactly one
- 上下文与记忆Context & memory
这是 AG2 最贴合本站「状态 ≠ 上下文」主张的设计。
它把 harness 显式拆成三组 opt-in 原语。
官方
agent_harness页原文:"A bare
Agentis just a model loop. The harness is the set of opt-in primitives you compose onto it"三个关键参数:
assembly=(上下文策略) —— 官方示例含WorkingMemoryPolicy(把memory/working.md注入 system prompt)、SlidingWindowPolicy(max_events=50)(限制历史占用)、AlertPolicy
knowledge=——KnowledgeConfig(store=..., compact=..., compact_trigger=..., aggregate=...), 配SummarizeCompact/TailWindowCompact做上下文压缩(README 示例 "18 -> 3 events");write_event_log会把流历史落到/log/{stream_id}.jsonl
tasks=(默认关闭) —— 开启后自动注入子任务工具;子 Agent 默认继承父工具, 且子任务自身tasks=False,官方原文:
官方原文:"recursive delegation is structurally impossible"
分野很清楚:
compact=管窗口压缩。KnowledgeStore管跨进程持久记忆 —— 两者官方分开描述。This is the AG2 design that best matches this site's "state ≠ context" stance.
It explicitly splits the harness into three groups of opt-in primitives.
Official
agent_harnesspage wording:"A bare
Agentis just a model loop. The harness is the set of opt-in primitives you compose onto it"Three key parameters:
assembly=(context policy) — official examples includeWorkingMemoryPolicy(injectsmemory/working.mdinto the system prompt),SlidingWindowPolicy(max_events=50)(caps history usage),AlertPolicy
knowledge=—KnowledgeConfig(store=..., compact=..., compact_trigger=..., aggregate=...), withSummarizeCompact/TailWindowCompactdoing context compaction (README example "18 -> 3 events");write_event_logdumps stream history to/log/{stream_id}.jsonl
tasks=(off by default) — when enabled, subtask tools are auto-injected; sub-Agents inherit parent tools by default, and subtasks themselves havetasks=False, official wording:
Official wording: "recursive delegation is structurally impossible"
The boundary is clear:
compact=governs window compaction.KnowledgeStoregoverns cross-process persistent memory — the official docs describe the two separately.- 权限与限制Permissions & limits
官方机制分两层:HITL 人审 + 受限 shell 工具。两层都不等于容器沙箱。
① HITL。
README 原文如下:
- 在工具里调
context.input(...)暂停本次 run 向人提问 - 由
hitl_hook决定答案来源(CLI / web UI / 队列)
② 工具审批。
release v1.1.1 明说:
"Approval grants are keyed by tool implementation"
且同名工具每轮只暴露一个。
MCP 发现的工具排在代码声明的工具之下,不能覆盖本地工具。
③ 受限 shell。
SandboxShellTool的allowed/readonly/blocked见 local_files 轴。 官方自己声明blocked=[...]不是安全边界。v1.1.2 还修了一个 shell 命令过滤绕过漏洞(GHSA-42mf-vpmr-gw5r)。
④ 数据接口安全提示。
官方文档警告 Redis 的
Serializer.PICKLE会把代码执行能力交给任何能写该 stream 的人。 建议只用完全可信的 Redis,JSON 为默认。未知 —— 框架级的进程 / 容器沙箱默认值,官方未说明 (已查
agent_harness与 release 页)。The official mechanisms come in two layers: HITL human review + restricted shell tools. Neither layer equals a container sandbox.
① HITL.
README wording:
- calling
context.input(...)inside a tool pauses the run to ask a human hitl_hookdecides where the answer comes from (CLI / web UI / queue)
② Tool approval.
Release v1.1.1 states plainly:
"Approval grants are keyed by tool implementation"
and only one same-named tool is exposed per turn.
MCP-discovered tools rank below code-declared tools and cannot override local tools.
③ Restricted shell.
SandboxShellTool'sallowed/readonly/blocked— see the local_files axis. The official docs themselves declareblocked=[...]not a security boundary.v1.1.2 also fixed a shell command-filter bypass vulnerability (GHSA-42mf-vpmr-gw5r).
④ Data-interface security note.
Official docs warn that Redis's
Serializer.PICKLEhands code-execution capability to anyone who can write that stream.The advice is to use only fully trusted Redis; JSON is the default.
Unknown — framework-level process / container sandbox defaults, not stated officially (
agent_harnessand release pages checked).- 在工具里调
- 适合什么任务Best for
适合。
- 要用 Python 编排多 agent 会话 / 协议化网络(Hub + channel,含咨询、讨论、工作流适配器)
- 需要可审计的 durable messaging(write-ahead log、audit trail)与跨进程部署(WsLink)
- 要在本地模型上跑(Ollama / vLLM / LM Studio)
- 要 HITL 与受限 shell 工具
- 需要 MCP 与 AG-UI 对接
- 偏好 opt-in、可组合的 harness 原语
不适合。
- 期待
pip install ag2仍是老 AutoGen API(v1.0 起经典类已移入ag2-classic) - 需要厂商托管后台(纯库,进程自负)
- 需要开箱即用的容器级沙箱隔离(官方给的是受限 shell 白名单,非容器)
- 非 Python 技术栈(无官方非 Python 端口)
Fits.
- orchestrating multi-agent conversations / protocolized networks in Python (Hub + channel, with consulting, discussion, workflow adapters)
- needing auditable durable messaging (write-ahead log, audit trail) and cross-process deployment (WsLink)
- running on local models (Ollama / vLLM / LM Studio)
- wanting HITL and restricted shell tools
- needing MCP and AG-UI integration
- preferring opt-in, composable harness primitives
Does not fit.
- expecting
pip install ag2to still be the old AutoGen API (since v1.0 the classic classes moved intoag2-classic) - needing a vendor-hosted background (pure library, processes are your own)
- needing out-of-the-box container-level sandbox isolation (the official offering is a restricted-shell allowlist, not containers)
- non-Python stacks (no official non-Python port)
头号误解Top misconception
- 以为 pip install ag2 还是老 AutoGen —— v1.0 起 ConversableAgent / GroupChat / import autogen 都搬到 ag2-classic 包Assuming
pip install ag2is still classic AutoGen — since v1.0 ConversableAgent / GroupChat /import autogenall moved to the ag2-classic package - 以为 ag2 与 autogen 可平滑升级 —— 官方明说 v1.0 不是 drop-in upgrade,agent 模型、编排与 import 全变了Assuming ag2 is a smooth upgrade from autogen — officially v1.0 is not a drop-in upgrade; the agent model, orchestration, and imports all changed
- 以为它是微软官方项目 —— 社区志愿者维护(ag2ai),与微软的 Microsoft Agent Framework 是两条线Assuming it is a Microsoft-official project — it is maintained by community volunteers (ag2ai), a different line from Microsoft's Microsoft Agent Framework
- 以为 blocked=[...] 是安全边界 —— 官方原文说它只是 best-effort,受限 shell 的隔离靠 allowed 白名单与 readonlyAssuming
blocked=[...]is a security boundary — officially it is only best-effort; isolation in the restricted shell comes from theallowedallowlist andreadonly
未知项清单Known unknowns
- 框架级默认文件访问边界与容器级隔离(官方未说明)
- 托管选项与崩溃场景下的断点续跑语义(官方未说明)
- 换 provider 后 tool calling / structured output 的可靠性对比(官方未说明)
- A2A 在 AG2 v1.0 的实现细节(官方仓库 topics 含 a2a,未取到专页正文)
- 受限 shell 的完整命令白名单语义边界(官方给的是 allowed/readonly/blocked 三档,细节需实测)
- Classic 线与 v1.0 的长期并行维护策略(官方仅称 Classic "remains maintained") 各条的核验出处:
- 文件访问边界与容器隔离、托管选项:已查
network/overview与agent_harness两页 - 换 provider 后可靠性:已查
beta/model_configuration与 Grok 兼容页
- Framework-level default file-access boundaries and container-level isolation (not stated officially)
- Hosting options and resume-after-crash semantics in crash scenarios (not stated officially)
- Tool calling / structured output reliability comparison across providers (not stated officially)
- A2A implementation details in AG2 v1.0 (the official repository topics include a2a; the 2026-10-08 pass did not capture a dedicated page)
- The full command-allowlist semantic boundary of the restricted shell (the official docs give allowed/readonly/blocked three tiers; details need measured runs)
- The long-term parallel-maintenance policy of the Classic line vs v1.0 (officially only "remains maintained") Verification sources per item:
- file-access boundaries and container isolation, hosting options:
network/overviewandagent_harnesspages checked - reliability after switching providers:
beta/model_configurationand the Grok compatibility page checked
证据来源Evidence sources
判断可回到以下一手源复核。本站核验日Every judgement can be rechecked against the primary sources below. Verified on 2026-10-23,内容更新日content updated on 2026-10-08。
| 类型Type | 名称Name | 链接Link |
|---|---|---|
| repo | ag2ai/ag2 · 仓库(5,011★,Apache-2.0,pushed_at 2026-10-22,topics 含 mcp/a2a/ag2,滚动核验 2026-10-23)ag2ai/ag2 · repository (5,011★, Apache-2.0, pushed_at 2026-10-22, topics include mcp/a2a/ag2, rolling check 2026-10-23) | https://github.com/ag2ai/ag2 |
| docs | 主 README(AG2 v1.0 与 AG2 Classic 拆分、Agent/tools/HITL/Network/harness 概念、Apache-2.0 声明)Main README (AG2 v1.0 vs AG2 Classic split, Agent/tools/HITL/Network/harness concepts, Apache-2.0 statement) | https://github.com/ag2ai/ag2/blob/main/README.md |
| docs | 官方文档 · Network Overview(Hub + channel、四种适配器、LocalLink/WsLink、write-ahead log、audit trail、HumanClient)Official docs · Network Overview (Hub + channel, four adapters, LocalLink/WsLink, write-ahead log, audit trail, HumanClient) | https://docs.ag2.ai/docs/user-guide/network/overview/ |
| docs | 官方文档 · Agent Harness(assembly= / knowledge= / tasks= 三组原语、compaction、子任务不可能递归、turn lifecycle)Official docs · Agent Harness (assembly= / knowledge= / tasks= primitive groups, compaction, recursive delegation impossible, turn lifecycle) | https://docs.ag2.ai/docs/user-guide/agent_harness/ |
| docs | 官方文档 · Model Configuration(provider Config 类与 extra 清单、自托管 OpenAI 兼容、Vertex/Z.AI/Bedrock 认证)Official docs · Model Configuration (provider Config classes and extras list, self-hosted OpenAI-compatible, Vertex/Z.AI/Bedrock auth) | https://docs.ag2.ai/latest/docs/beta/model_configuration/ |
| docs | 官方文档 · Grok & OpenAI-API-Compatible(xAI 走 OpenAI 客户端、function calling 与结构化输出)Official docs · Grok & OpenAI-API-Compatible (xAI via the OpenAI client, function calling and structured output) | https://docs.ag2.ai/latest/docs/user-guide/models/grok-and-oai-compatible-models/ |
| docs | AG2 Classic 文档 · LLM Configuration(经典线的 provider 清单:OpenAI/Anthropic/Gemini/Bedrock/Mistral/Cerebras/Together/Groq + 本地 Ollama/LiteLLM/LM Studio)AG2 Classic docs · LLM Configuration (classic line's provider list: OpenAI/Anthropic/Gemini/Bedrock/Mistral/Cerebras/Together/Groq + local Ollama/LiteLLM/LM Studio) | https://classic.docs.ag2.ai/latest/docs/user-guide/basic-concepts/llm-configuration/ |
| changelog | Releases(最新 v1.1.2 @ 2026-10-03;v1.1.1 含受限 shell 与工具审批变更、GHSA-42mf-vpmr-gw5r 修复、Bedrock 转 aiobotocore)Releases (latest v1.1.2 @ 2026-10-03; v1.1.1 includes restricted shell and tool-approval changes, GHSA-42mf-vpmr-gw5r fix, Bedrock switch to aiobotocore) | https://github.com/ag2ai/ag2/releases |
| repo | ag2ai/ag2-classic · 经典框架独立仓(pip install ag2-classic,import autogen,仍维护)ag2ai/ag2-classic · the classic framework's separate repository (pip install ag2-classic, import autogen, still maintained) | https://github.com/ag2ai/ag2-classic |
实测记录Measured runs
本档未跑集成与性能实测;结论只覆盖 API 与官方文档披露的能力面。
实测建议(按编排框架 + 多 agent 会话维度定制):
| # | 测什么 | 为什么值得测 |
|---|---|---|
| 1 | 用 WorkflowAdapter 复刻一段经典 GroupChat 代码的改动量 | 验证官方「最接近 GroupChat」的说法 |
| 2 | 从 LocalLink 切到 WsLink 跨进程部署,业务代码是否真不用改 | 官方承诺 HubClient API 不变 |
| 3 | 受限 shell(allowed/readonly)在真实命令集下的可用性 | 安全变强往往牺牲可用性,需量边界 |
| 4 | 接 Ollama 跑一个多 agent 网络,观察 token 与延迟开销 | 本地模型 + 多 agent 的真实成本 |
| 5 | DiskKnowledgeStore + 压缩两次运行,验证跨进程记忆是否真生效 | README 示例宣称重启仍记得 |
| 6 | v1.1.x 连续两版的破坏性变更面 | 迭代快,选型需量化升级风险 |
This site has not completed measured runs.
The test protocol is at protocols/framework/_protocol.md.
Suggested measurement (tailored to the orchestration-framework + multi-agent-conversation dimensions):
| # | What to test | Why it is worth testing |
|---|---|---|
| 1 | Effort to port a piece of classic GroupChat code using WorkflowAdapter | verifies the official "closest to GroupChat" claim |
| 2 | Switching LocalLink to WsLink cross-process deployment — does business code really stay unchanged | the official promise is the HubClient API stays the same |
| 3 | Usability of the restricted shell (allowed/readonly) under a realistic command set | stronger security often costs usability; the boundary needs measuring |
| 4 | Attach Ollama and run a multi-agent network, observing token and latency overhead | the real cost of local models + multi-agent |
| 5 | DiskKnowledgeStore + compaction across two runs, verifying cross-process memory really works | the README example claims it remembers after restart |
| 6 | The breaking-change surface of the two consecutive v1.1.x releases | fast iteration; selection needs quantified upgrade risk |
一个必须讲清的版本断层:AG2 v1.0 把 Classic 拆出去了A version fault line that must be made clear: AG2 v1.0 split out Classic
README 顶部用醒目提示说明:
Looking forConversableAgent,GroupChat, orimport autogen? That's now AG2 Classic.
自 v1.0 起,经典框架整体搬到独立仓 ag2ai/ag2-classic。
- 经典线:
pip install ag2-classic、import autogen、文档classic.docs.ag2.ai - 新顶层包:
pip install ag2改为协议驱动的新框架
经典线仍在维护、现有代码不停止工作。
新顶层包不再附带 autogen 这个 import 名与经典 agent 类。
官方对升级路径的措辞很直接:
AG2 v1.0 (pip install ag2) is not a drop-in upgrade from Classic. The agent model, orchestration, and imports all changed.
所以「AG2 是不是 AutoGen 新版」这个问题,答案是:同一血脉。
但 v1.0 不是平移升级。
The README top uses a prominent notice:
Looking forConversableAgent,GroupChat, orimport autogen? That's now AG2 Classic.
Since v1.0, the classic framework moved wholesale to the separate repository ag2ai/ag2-classic.
- classic line:
pip install ag2-classic,import autogen, docs atclassic.docs.ag2.ai - new top-level package:
pip install ag2is now the protocol-driven new framework
The classic line is still maintained; existing code does not stop working.
The new top-level package no longer ships the autogen import name or the classic agent classes.
The official wording on the upgrade path is blunt:
AG2 v1.0 (pip install ag2) is not a drop-in upgrade from Classic. The agent model, orchestration, and imports all changed.
So the answer to "is AG2 the new AutoGen" is: same lineage.
But v1.0 is not a lift-and-shift upgrade.
多 agent 编排:Network(Hub + channel)Multi-agent orchestration: Network (Hub + channel)
v1.0 用 Network 取代经典的 GroupChat / swarm / nested chat:
a Hub that owns the registry, the write-ahead log, and the audit trail, with agents talking over typed channels.
官方原文明确:
"This replaces the classic GroupChat / swarm / nested-chat patterns."
四种内置 channel 适配器:
| 适配器 | 参与者 | 发言顺序 | 终止 |
|---|---|---|---|
conversation | 恰好 2 | 自由(任意时刻任一方) | 显式 close 或 TTL |
consulting | 恰好 2 | 严格一问一答 | 答复后自动关闭 |
discussion | 2+ | 轮转(round_robin) | 显式 close 或 TTL |
workflow | 2+ | 声明式 TransitionGraph | 图终止 |
其中 workflow 官方称「最接近经典 GroupChat 的对应物」。
部署上默认 LocalLink(同进程)。换 WsLink 即跨进程 / 跨主机,业务代码不变。
v1.0 uses Network to replace the classic GroupChat / swarm / nested chat:
a Hub that owns the registry, the write-ahead log, and the audit trail, with agents talking over typed channels.
The official wording is explicit:
"This replaces the classic GroupChat / swarm / nested-chat patterns."
Four built-in channel adapters:
| Adapter | Participants | Speaking order | Termination |
|---|---|---|---|
conversation | exactly 2 | free (either side at any time) | explicit close or TTL |
consulting | exactly 2 | strict question-answer | auto-closes after the answer |
discussion | 2+ | round-robin | explicit close or TTL |
workflow | 2+ | declarative TransitionGraph | graph termination |
Of these, the official docs call workflow "the closest counterpart to the classic GroupChat".
For deployment the default is LocalLink (same process). Switching to WsLink goes cross-process / cross-host with business code unchanged.
harness:三组 opt-in 原语,正好落在「状态 ≠ 上下文」上The harness: three groups of opt-in primitives, landing exactly on "state ≠ context"
官方 agent_harness 页原文:
A bare Agent is just a model loop. The harness is the set of opt-in primitives you compose onto it.
| 参数 | 作用 | 对应本站维度 |
|---|---|---|
assembly= | 上下文策略:WorkingMemoryPolicy / SlidingWindowPolicy / AlertPolicy | 上下文 |
knowledge= | KnowledgeStore + SummarizeCompact / TailWindowCompact 压缩 + 聚合 | 长期记忆 + 上下文压缩 |
tasks= | 子任务委派(默认关闭),子 Agent tasks=False,无法递归 | 子代理 |
这条分野很干净:压缩(compact=)管的是窗口占用。
知识库(KnowledgeStore)管的是跨进程持久记忆。
Official agent_harness page wording:
A bare Agent is just a model loop. The harness is the set of opt-in primitives you compose onto it.
| Parameter | Role | Corresponding dimension on this site |
|---|---|---|
assembly= | context policy: WorkingMemoryPolicy / SlidingWindowPolicy / AlertPolicy | context |
knowledge= | KnowledgeStore + SummarizeCompact / TailWindowCompact compaction + aggregation | long-term memory + context compaction |
tasks= | subtask delegation (off by default), sub-Agent tasks=False, recursion impossible | subagents |
This boundary is clean: compaction (compact=) governs window usage.
The knowledge store (KnowledgeStore) governs cross-process persistent memory.
权限:HITL + 受限 shell,但不是容器沙箱Permissions: HITL + restricted shell, but not a container sandbox
- HITL:工具里
context.input(...)暂停 run 向人提问,hitl_hook决定答案来源。 - 工具审批:官方 v1.1.1 明说审批按「工具实现」为键,同名工具每轮只暴露一个。
- 受限 shell:
SandboxShellTool的allowed=[...]/readonly=True会把命令切成 argv 后只检查 argv 再原样执行。
官方原话:
"Nothing can expand after the check"
官方同时声明 blocked=[...] :
"best-effort. It is not a security boundary."
- v1.1.2 修了一个 shell 命令过滤绕过漏洞(GHSA-42mf-vpmr-gw5r), 说明这类工具的安全面需要盯 release。
注意:这不是容器隔离 —— 官方给的是白名单与只读模式。
另一条数据接口提示。
用 Serializer.PICKLE 时,任何能写该 Redis stream 的人都会有代码执行能力。
官方建议只用完全可信的 Redis,JSON 为默认。
- HITL:
context.input(...)inside a tool pauses the run to ask a human;hitl_hookdecides the answer source. - Tool approval: official v1.1.1 states approvals are keyed by "tool implementation", and only one same-named tool is exposed per turn.
- Restricted shell:
SandboxShellTool'sallowed=[...]/readonly=Truesplit the command into argv, then check only the argv and execute verbatim.
Official wording:
"Nothing can expand after the check"
The official docs also declare of blocked=[...]:
"best-effort. It is not a security boundary."
- v1.1.2 fixed a shell command-filter bypass vulnerability (GHSA-42mf-vpmr-gw5r), showing this class of tool's security surface needs watching across releases.
Note: this is not container isolation — the official offering is an allowlist and read-only mode.
One more data-interface note.
With Serializer.PICKLE, anyone who can write that Redis stream gains code-execution capability.
The official advice: use only fully trusted Redis; JSON is the default.
核验说明Verification notes
confidence: partial 的依据:
为什么不是 verified:已核到 v1.0 与 Classic 的拆分、Network 的 Hub/channel 抽象、 harness 三组原语、provider 清单(含本地模型)。
受限 shell 与工具审批机制也已核到。发布节奏(v1.1.1 / v1.1.2)同样在已核到。
但仍有多处官方确实没给的项:
- 框架级默认文件访问边界与容器级隔离
- 托管选项与崩溃续跑语义
- 换 provider 后 tool calling / structured output 的可靠性
- A2A 在 v1.0 的实现细节(仅见仓库 topics)
加上版本迭代快(数日内连发两版),故不足以升到 verified。
已核到的官方页:仓库与 README、network/overview、agent_harness、 beta/model_configuration、Grok 兼容页、经典线 LLM Configuration 页、releases 页、 ag2ai/ag2-classic 仓。
已核验元数据:仓库存在、★5,011(滚动核验 2026-10-23)、许可 Apache-2.0(经 license API)、 最近推送 2026-10-22(仍活跃)、最新版 v1.2.1(releases @ 2026-10-21)。
Basis for confidence: partial:
Why not verified: the 2026-10-08 pass verified the v1.0-vs-Classic split, the Network Hub/channel abstraction, the three harness primitive groups, the provider list (including local models).
The restricted shell and tool-approval mechanisms are also verified. The release cadence (v1.1.1 / v1.1.2) was verified the 2026-10-08 pass too.
But several items are genuinely not given officially:
- framework-level default file-access boundaries and container-level isolation
- hosting options and crash-resume semantics
- tool calling / structured output reliability after switching providers
- A2A implementation details in v1.0 (only seen in repository topics)
Plus fast version iteration (two releases within days), so it is not enough to raise to verified.
Official pages checked the 2026-10-08 pass: repository and README, network/overview, agent_harness, beta/model_configuration, the Grok compatibility page, the classic line's LLM Configuration page, the releases page, the ag2ai/ag2-classic repository.
Verified metadata: repository exists, ★5,011 (rolling check 2026-10-23), license Apache-2.0 (via the license API), last push 2026-10-22 (still active), latest version v1.2.1 (releases @ 2026-10-21).
相关条目Related entries
- Microsoft Agent FrameworkMicrosoft Agent Framework同源分野:AG2 是 AutoGen 的社区延续,MAF 是微软官方把 AutoGen 与 Semantic Kernel 合并的继任线。 本站 harness 分区记下的 AutoGen 停更,是这两条支线被分别收录的原因。Same-lineage divergence: AG2 is the community continuation of AutoGen; MAF is Microsoft's official successor merging AutoGen with Semantic Kernel. The AutoGen sunset recorded by this site's harness section is why these two branches are collected separately.
- CrewAICrewAI抽象层次对照:CrewAI 用 Crew(角色/目标/任务)/ Flow 的业务比喻。 AG2 v1.0 用 Network(Hub + 类型化 channel)的协议化抽象。 一个偏团队角色,一个偏消息协议与治理。Abstraction-level contrast: CrewAI uses the business metaphors of Crew (roles/goals/tasks) / Flow. AG2 v1.0 uses the protocolized abstraction of Network (Hub + typed channels). One leans toward team roles, the other toward message protocols and governance.
- Google ADKGoogle ADK(Agent Development Kit)编排与 HITL 对照:ADK 是图执行引擎 + 工具级确认。 AG2 是 Hub/channel 网络 +
context.input()人审。 两者都提供状态持久化,但落盘粒度与语义不同。Orchestration and HITL contrast: ADK is a graph execution engine + tool-level confirmation. AG2 is a Hub/channel network +context.input()human review. Both provide state persistence, but at different granularity and semantics. - Filesystem MCP ServerFilesystem MCP Server另一层 · MCP 工具Other layer · MCP tools
本页由This page is generated from the ai-handbook 数据层生成(CC BY 4.0)。data layer (CC BY 4.0).
方法论与坐标系定义见仓库内For the methodology and coordinate definitions, see METHODOLOGY.md.