From 60bab2963b88144ab65a70ab7b109e6d8bc03fba Mon Sep 17 00:00:00 2001 From: kang Date: Wed, 1 Apr 2026 09:04:18 +0800 Subject: [PATCH] auto-save 2026-04-01 09:03 (+1, ~1) --- index.html | 783 +++++++++++++++++++++++++++++++++++++++++++++++++++-- source | 1 + 2 files changed, 759 insertions(+), 25 deletions(-) create mode 160000 source diff --git a/index.html b/index.html index 27a1c39..cd0ce1a 100644 --- a/index.html +++ b/index.html @@ -3,44 +3,777 @@ - AgentScope 多智能体框架研究 + AgentScope 多智能体框架深度研究 -
-

AgentScope 多智能体框架研究

-

AgentScope 开源多Agent框架深度分析与介绍

-
-

概述

-

待补充研究内容...

-
- -
-

核心发现

-

待补充...

+ +
+ +

AgentScope

+

+ 阿里系开源的生产级多智能体框架 — "Build and run agents you can see, understand and trust" +

+
+ GitHub 21,400+ Stars + v1.0.18 (2026-03-26) + Python 3.10+ + Apache-2.0
+ +
+ + +
+

#1 一句话定位

+
+

+ AgentScope 是一个多 Agent 编排框架。 + 它不是一个模型,不是一个 App,而是一个帮你把多个 AI Agent 组装在一起、让它们互相通信协作的开发框架。 +

+ 类比:如果单个 LLM API 调用是"一个人干活",AgentScope 就是"组建一支团队让多个人分工合作"。 +

+
+
+ + +
+

#2 核心架构

+ +
+
+ Application Layer + ReAct Agent + User Agent + Custom Agent +
+
+
+ Orchestration + MsgHub + Pipeline + A2A Protocol +
+
+
+ Core Modules + Memory + Tool / MCP + Formatter +
+
+
+ Model Layer + DashScope + OpenAI + Anthropic + Ollama + vLLM +
+
+ +
+
+

Message — 统一通信

+

所有 Agent 之间用统一的 Msg 对象通信,包含 name、content、role 等字段。MsgHub 负责消息路由和广播。

+
+
+

Agent — 智能体

+

核心是 ReActAgent:接收消息 → 思考 → 调工具 → 观察结果 → 循环。支持人机协作实时打断。

+
+
+

Memory — 记忆系统

+

InMemoryMemory(短期)+ 数据库持久化(长期)+ 自动压缩。支持 ReMe、Qdrant、Milvus 等向量库。

+
+
+

Tool — 工具注册

+

Toolkit 统一注册函数/MCP 工具,Agent 通过 function calling 调用。支持 MCP 标准协议、后台异步执行。

+
+
+
+ + +
+

#3 源码包结构

+
+
+// src/agentscope/ 核心包目录 +agentscope/ + ├── agent/ # ReActAgent, UserAgent 等智能体实现 + ├── model/ # DashScope, OpenAI, Anthropic 等模型封装 + ├── memory/ # InMemoryMemory, 数据库存储, 压缩 + ├── tool/ # Toolkit, 工具注册, function calling + ├── mcp/ # MCP 客户端 (HttpStatelessClient) + ├── a2a/ # Agent-to-Agent 协议实现 + ├── pipeline/ # MsgHub, sequential_pipeline 编排 + ├── message/ # Msg 统一消息格式 + ├── formatter/ # 各模型的 prompt 格式化器 + ├── plan/ # Agent 计划模块 + ├── rag/ # RAG 检索增强生成 + ├── realtime/ # 实时语音交互 + ├── tts/ # 文本转语音 + ├── evaluate/ # 评估框架 + ├── tuner/ # 模型微调 (Trinity-RFT) + ├── tracing/ # OpenTelemetry 可观测性 + ├── session/ # 会话管理 (SQLite) + ├── hooks/ # 生命周期钩子 + └── embedding/ # 嵌入模型 +
+
+
+ + +
+

#4 核心特性详解

+ +
+
+

ReAct Agent

+
    +
  • 推理 → 行动 → 观察循环
  • +
  • 内置工具调用 (function calling)
  • +
  • 人机协作实时打断
  • +
  • 流式输出支持
  • +
+
+
+

MCP 集成

+
    +
  • MCP 工具 → 本地可调函数
  • +
  • 支持 streamable_http 传输
  • +
  • 可直接调用 / 注册给 Agent / 组合封装
  • +
+
+
+

A2A 协议

+
    +
  • Google 提出的 Agent 间通信标准
  • +
  • 跨框架 Agent 互操作
  • +
  • 任务卡片 / 能力声明
  • +
+
+
+

多 Agent 编排

+
    +
  • MsgHub 消息中心广播
  • +
  • sequential_pipeline 顺序执行
  • +
  • 动态增删参与者
  • +
  • 灵活的消息路由
  • +
+
+
+

实时语音

+
    +
  • TTS 文本转语音
  • +
  • 实时双向语音交互
  • +
  • 多 Agent 语音场景(狼人杀)
  • +
+
+
+

模型微调

+
    +
  • Trinity-RFT 强化学习
  • +
  • Agent 行为优化
  • +
  • 数据增强 + 合成
  • +
  • 狼人杀胜率 50% → 80%
  • +
+
+
+
+ + +
+

#5 模型支持矩阵

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
模型平台典型模型主要用途接入方式
DashScopeQwen-max, Qwen3 系列主力模型,示例默认内置 DashScopeChatModel
OpenAIGPT-4o, GPT-4.1通用对话/推理内置 OpenAI 兼容
AnthropicClaude Opus/Sonnet复杂推理/代码内置支持
GeminiGemini Pro多模态可选依赖 [gemini]
OllamaLlama, Mistral 等本地部署可选依赖 [ollama]
vLLM任意 HF 模型高性能本地推理内置支持
HuggingFaceEndpoint 模型云端托管Endpoint 接入
+
+
+ + +
+

#6 代码示例

+ +
+

Hello AgentScope — 最简 ReAct Agent

+
+from agentscope.agent import ReActAgent, UserAgent +from agentscope.model import DashScopeChatModel +from agentscope.formatter import DashScopeChatFormatter +from agentscope.memory import InMemoryMemory +from agentscope.tool import Toolkit, execute_python_code +import asyncio + +async def main(): + toolkit = Toolkit() + toolkit.register_tool_function(execute_python_code) + + agent = ReActAgent( + name="Friday", + sys_prompt="You're a helpful assistant.", + model=DashScopeChatModel( + model_name="qwen-max", + api_key=os.environ["DASHSCOPE_API_KEY"], + ), + memory=InMemoryMemory(), + formatter=DashScopeChatFormatter(), + toolkit=toolkit, + ) + + user = UserAgent(name="user") + msg = None + while True: + msg = await agent(msg) + msg = await user(msg) + +asyncio.run(main()) +
+
+ +
+

MCP 工具调用 — 把 MCP 服务变成本地函数

+
+from agentscope.mcp import HttpStatelessClient +from agentscope.tool import Toolkit + +async def use_mcp(): + client = HttpStatelessClient( + name="gaode_mcp", + transport="streamable_http", + url="https://mcp.amap.com/mcp?key=YOUR_KEY", + ) + # MCP 工具 → 本地可调用函数 + func = await client.get_callable_function(func_name="maps_geo") + + # 直接调用 + await func(address="天安门广场", city="北京") + + # 或注册给 Agent + toolkit = Toolkit() + toolkit.register_tool_function(func) +
+
+ +
+

多 Agent 编排 — MsgHub 消息中心

+
+from agentscope.pipeline import MsgHub, sequential_pipeline +from agentscope.message import Msg + +async def multi_agent(): + # 创建多个 Agent... + agent1, agent2, agent3, agent4 = ... + + # MsgHub 管理消息广播 + async with MsgHub( + participants=[agent1, agent2, agent3], + announcement=Msg("Host", "请介绍一下自己。", "assistant") + ) as hub: + # 顺序发言 + await sequential_pipeline([agent1, agent2, agent3]) + # 动态增删参与者 + hub.add(agent4) + hub.delete(agent3) +
+
+
+ + +
+

#7 官方示例项目一览

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
类别示例说明
智能体ReAct Agent基础推理-行动循环智能体
Voice Agent语音交互智能体
Deep Research Agent深度研究/调研智能体
Browser Agent浏览器操作智能体
Meta Planner Agent任务规划元智能体
A2A AgentAgent-to-Agent 通信智能体
Realtime Voice Agent实时双向语音智能体
功能MCPModel Context Protocol 工具集成
RAG检索增强生成
Structured Output结构化输出(JSON Schema)
Memory Compression记忆自动压缩
Long-term MemoryReMe / Qdrant / Milvus 长期记忆
工作流Multi-Agent Debate多智能体辩论
Multi-Agent Realtime多智能体实时语音交互
游戏Werewolves (9人)九人制狼人杀
微调Math Agent数学求解微调 (75% → 85%)
Frozen Lake冰湖游戏微调 (15% → 86%)
Werewolf Tuning狼人杀策略微调 (50% → 80%)
+
+
+ + +
+

#8 生态系统

+
+
+

AgentScope Core

+

核心框架本体,Agent + Model + Memory + Tool 四大模块

+
+
+

AgentScope Runtime

+

生产运行时:Docker/K8s 部署、安全沙箱、VNC 图形界面、Agent-as-a-Service

+
+
+

AgentScope Studio

+

可视化开发/调试环境,拖拽式 Agent 编排

+
+
+

CoPaw

+

基于 AgentScope 构建的个人 AI 助手产品 (2026-03 开源)

+
+
+
+ + +
+

#9 发展时间线

+
+
+
2026-03
+
v1.0.18 发布 / CoPaw 个人助手开源 / HuggingFace 修复 / 工具后台执行
+
+
+
2026-02
+
实时语音 Agent 上线,支持多 Agent 实时语音交互
+
+
+
2026-01
+
Memory 数据库支持 + 记忆压缩 / 社区双周会议启动
+
+
+
2025-12
+
A2A 协议集成 / TTS 支持 / 深度研究 Agent
+
+
+
2025-11
+
Trinity-RFT 强化学习 / ReMe 长期记忆 / agentscope-runtime 发布
+
+
+
2024-02
+
AgentScope 论文发布 (arXiv: 2402.14034),框架正式开源
+
+
+
+ + +
+

#10 安装方式

+
+
+

PyPI 安装(推荐)

+
+# 基础安装 +pip install agentscope + +# 带可选依赖 +pip install agentscope[gemini] # Gemini 支持 +pip install agentscope[ollama] # Ollama 本地模型 +pip install agentscope[rag] # RAG 检索增强 +pip install agentscope[a2a] # A2A 协议 +pip install agentscope[realtime] # 实时语音 +
+
+
+

从源码安装

+
+git clone -b main \ + https://github.com/agentscope-ai/agentscope.git + +cd agentscope +pip install -e . + +# 或 uv +uv pip install -e . +
+
+
+
+ + +
+

#11 与同类框架对比

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
维度AgentScopeLangChain / LangGraphAutoGenCrewAI
定位生产级多 AgentLLM 应用开发全家桶多 Agent 对话角色扮演多 Agent
核心范式ReAct + MsgHubChain / Graph对话驱动任务分配
MCP 支持原生支持社区插件有限第三方
A2A 支持原生支持
模型微调内置 RL
主要模型DashScope 为主OpenAI 为主OpenAI 为主不限
部署K8s / DockerLangServe无内置无内置
学习曲线中等较陡较低
生态成熟度快速成长中最成熟中等中等
+
+
+ + +
+

#12 客观评价:噱头还是实力?

+ +
+

结论:不是噱头,但你不一定需要

+

+ AgentScope 解决的是真实存在的工程问题 — 当你需要多个 AI Agent 协作、通信、共享记忆时, + 手写消息路由和状态管理是痛苦的。这个框架确实简化了这个过程。

+ 但对于大多数项目(尤其是单 Agent + 工具调用的场景),直接用 SDK 调 API 更简单、更可控、更省钱。 + 框架带来的抽象层反而增加了调试成本和依赖风险。 +

+ +
+
+

值得用的场景

+
    +
  • 需要 3+ 个 Agent 协作分工
  • +
  • Agent 之间需要消息路由/广播
  • +
  • 需要 A2A 跨框架互操作
  • +
  • 要做 Agent 行为的 RL 微调
  • +
  • K8s 生产部署多 Agent 服务
  • +
+
+
+

不需要的场景

+
    +
  • 单 Agent + RAG(直接调 API)
  • +
  • 浏览器自动化(Playwright 就行)
  • +
  • 模板填充 + LLM 润色
  • +
  • 追求轻量省钱的项目
  • +
  • API 走 Poe/OpenRouter(适配要折腾)
  • +
+
+
+
+
+ + +
+

#13 关键链接

+
+ +
+

文档

+

doc.agentscope.io

+
+
+

论文

+

arXiv: 2402.14034

+
+
+
+ +
+ + + + diff --git a/source b/source new file mode 160000 index 0000000..928b88a --- /dev/null +++ b/source @@ -0,0 +1 @@ +Subproject commit 928b88a10973250d09624b8b481d053a42e8d4e0