AgentScope

活跃
GitHub Python Apache-2.0

简介

阿里巴巴开源的多 Agent 框架,支持可观测、可理解的 Agent 构建与运行,提供丰富的分布式 Agent 能力。

核心特性

  • 内置ReAct Agent — 5分钟快速创建具备推理和工具使用能力的Agent
  • 工具与技能系统 — 内置Bash、Grep、文件读写等工具,支持自定义扩展
  • 多Agent编排 — 通过Message Hub实现灵活的多Agent协作和工作流
  • MCP/A2A原生支持 — 兼容Model Context Protocol和Agent-to-Agent通信
  • Agent服务化 — 基于FastAPI的多租户、多会话Agent服务部署
  • 实时流式响应 — 支持事件流式输出,适配UI实时渲染

适用场景

💡 构建具备文件操作和代码执行能力的个人AI助手
💡 部署多Agent协作系统处理复杂研究或数据分析任务
💡 将Agent封装为API服务供前端应用和第三方系统调用
💡 利用MCP协议集成外部工具和数据源扩展Agent能力
💡 搭建带Web UI的交互式Agent平台供团队使用

快速开始

pip install agentscope

from agentscope.agent import Agent
from agentscope.tool import Toolkit, Bash, Read, Write
from agentscope.model import DashScopeChatModel
from agentscope.message import UserMsg
import os, asyncio

agent = Agent(
    name="Friday",
    system_prompt="You are a helpful assistant.",
    model=DashScopeChatModel(
        api_key=os.environ["DASHSCOPE_API_KEY"],
        model="qwen3.6-plus",
    ),
    toolkit=Toolkit(tools=[Bash(), Read(), Write()]),
)

async def main():
    async for evt in agent.reply_stream(UserMsg("Tony", "Hi!")):
        print(evt)

asyncio.run(main())

相关项目