Inside AgentScope's Tool-Call Permission System
A Juejin AI article examines AgentScope's permission subsystem for agent tool calls, including ALLOW, DENY and ASK decisions. It describes rule matching at the argument level, persistent permission context, and event-driven human confirmation that can resume an asynchronous agent workflow after a user approves or rejects a tool call.
The analysis shows how an open-source agent framework can evaluate tool arguments before execution and integrate human approval without blocking its asynchronous ReAct loop.
当 Agent 能执行 Bash、读写文件、调用 MCP 时,「能不能干」比「会不会干」更重要。本文基于开源框架 AgentScope 的权限子系统,拆解一套面向工具调用的权限模型:规则怎么存、怎么匹配、怎么和 HITL(人在环)续跑咬合。
一、为什么 Agent 需要独立的权限层
传统后端权限多半挂在「用户 → API → 资源」上。Agent 场景不一样:
- 调用方是模型,不是人。模型可能连续发出
rm -rf、改配置文件、跑任意 shell。 - 危险粒度在「工具入参」。同样是
Bash,ls和rm -rf /风险完全不同;同样是Write,写src/和写~/.bashrc也不同。 - 决策常常要人确认,但不能阻塞整条异步链路。权限系统必须能输出「ASK」,让 Agent 停车,等 UI 确认后再续跑。
因此 AgentScope 把权限做成 工具执行前的独立引擎:Agent 循环只管 ReAct,权限引擎只管 ALLOW / DENY / ASK。