# 🔧 AgentScope:25k Stars 的开源 Agent 框架,pip install 就能看见你的 Agent 在想什么
> 项目地址:[https://github.com/agentscope-ai/agentscope](https://github.com/agentscope-ai/agentscope) | ⭐ 25.2k Stars | 🛠 Python | 作者:ModelScope / Alibaba
老实说,现在市面上的 Agent 框架多到离谱,选框架就选了一下午。LangChain 太重,CrewAI 太黑盒,AutoGen 配置起来脑壳疼。**AgentScope 是阿里 ModelScope 出的,核心卖点就一个:你的 Agent 是透明的,每一步在想什么、用什么工具、为什么这么搞,全部看得见。**
而且它原生支持 MCP、A2A 协议、Realtime Voice,甚至还能用 RL 微调 Agent——这玩意儿不是玩具。
## ⚡ 一条命令装好
或者用 uv:
Python 3.10+ 就行,依赖干净。
## 🛠 5 分钟搭一个 ReAct Agent
从 README 拿的真实代码,一个叫 Friday 的助手,能写代码、能执行命令:
最骚的是 AgentScope 的 ReAct Agent 支持实时人机协同(Human-in-the-loop),你可以在 Agent 执行过程中随时打断它、纠正它,而不是等它跑完了才发现方向错了。
## 🔌 MCP 工具即插即用
AgentScope 对 MCP 的支持直接到函数级别——把 MCP 工具当本地函数一样调用:
## 🎯 支持 Agentic RL——用强化学习训练 Agent
这可能是最特别的功能。AgentScope 集成了 RL 训练管线,可以直接用强化学习微调 Agent 的策略。
比如训练一个数学解题 Agent,准确率从 75% 提到了 85%。训练一个狼人杀 Agent,胜率从 50% 提到 80%。**框架自带这些实验代码,不是画饼。**
## 💬 要点总结
- **透明可观测** — 每步推理、工具调用全部可见,调试体验碾压黑盒框架
- **MCP + A2A 原生支持** — 不用自己封装,直接调
- **RAG / 记忆 / TTS / Realtime Voice 全套内置** — 外挂依赖降到最低
- **Agentic RL** — 这是唯一自带 RL 调优管线的开源 Agent 框架
- **pip install 就上手** — Python 3.10+,5 分钟从零到跑通
pip install agentscope
uv pip install agentscope
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, execute_shell_command
import os, asyncio
async def main():
toolkit = Toolkit()
toolkit.register_tool_function(execute_python_code)
toolkit.register_tool_function(execute_shell_command)
agent = ReActAgent(
name="Friday",
sys_prompt="You're a helpful assistant named Friday.",
model=DashScopeChatModel(
model_name="qwen-max",
api_key=os.environ["DASHSCOPE_API_KEY"],
stream=True,
),
memory=InMemoryMemory(),
formatter=DashScopeChatFormatter(),
toolkit=toolkit,
)
user = UserAgent(name="user")
msg = None
while True:
msg = await agent(msg)
msg = await user(msg)
if msg.get_text_content() == "exit":
break
asyncio.run(main())
from agentscope.mcp import HttpStatelessClient
from agentscope.tool import Toolkit
async def use_mcp_tool():
client = HttpStatelessClient(
name="gaode_mcp",
transport="streamable_http",
url="https://mcp.amap.com/mcp?key=YOUR_API_KEY",
)
# MCP 工具直接变成可调用的函数
func = await client.get_callable_function(func_name="maps_geo")
# 可以自己调,也可以注册给 Agent 用
await func(address="天安门广场", city="北京")
toolkit = Toolkit()
toolkit.register_tool_function(func)
# 🔧 AgentScope: 25k Stars Open-Source Agent Framework — pip Install and See What Your Agent Is Thinking
> Project: [https://github.com/agentscope-ai/agentscope](https://github.com/agentscope-ai/agentscope) | ⭐ 25.2k Stars | 🛠 Python | By ModelScope / Alibaba
AgentScope is a production-ready Python framework for building AI agents with full observability. Unlike LangChain (too heavy), CrewAI (too black-box), or AutoGen (configuration hell), AgentScope makes every step visible — what your agent is thinking, which tools it's using, and why.
### Quick Install
### 5-Minute ReAct Agent
### MCP Tools as First-Class Functions
### Key Highlights
- **Full transparency** — every reasoning step and tool call is observable
- **Native MCP + A2A** — no wrapping needed
- **Built-in RAG, memory, TTS, realtime voice** — minimal external dependencies
- **Agentic RL** — the only open-source Agent framework with built-in RL training pipeline
pip install agentscope
from agentscope.agent import ReActAgent, UserAgent
from agentscope.model import DashScopeChatModel
from agentscope.memory import InMemoryMemory
from agentscope.tool import Toolkit, execute_python_code, execute_shell_command
import os, asyncio
async def main():
toolkit = Toolkit()
toolkit.register_tool_function(execute_python_code)
toolkit.register_tool_function(execute_shell_command)
agent = ReActAgent(
name="Friday",
sys_prompt="You're a helpful assistant named Friday.",
model=DashScopeChatModel(
model_name="qwen-max",
api_key=os.environ["DASHSCOPE_API_KEY"],
stream=True,
),
memory=InMemoryMemory(),
formatter=DashScopeChatFormatter(),
toolkit=toolkit,
)
# ... human-in-the-loop supported
asyncio.run(main())
from agentscope.mcp import HttpStatelessClient
client = HttpStatelessClient(
name="gaode_mcp",
transport="streamable_http",
url="https://mcp.amap.com/mcp?key=YOUR_API_KEY",
)
func = await client.get_callable_function(func_name="maps_geo")
await func(address="Tiananmen Square", city="Beijing")