AS AgentScopeAPI 手册 / API Reference
类class agentscope.permission

PermissionRule

class PermissionRule(BaseModel)
源码Source agentscope/permission/_rule.py:8–36

用于工具用量的权限规则。位于 agentscope.permission 包。

A permission rule defines whether a specific tool or tool operation should be allowed, denied, or require user confirmation. The rule_content field has different semantics depending on the tool_name:

  • For "Bash": rule_content is a substring pattern matched against the command Example: rule_content="npm install" matches "npm install express"

  • For "Write"/"Read": rule_content is a glob pattern matched against file paths Example: rule_content="src/**" matches "src/main.py"

  • For other tools: rule_content is a tool-specific filter pattern

属性摘要Attribute Summary

属性Attribute类型Type说明Description值Value
tool_namestr
工具名称字段。
—
rule_contentstr | None
规则内容字段。
—
behaviorPermissionBehavior
行为字段。
—
sourcestr
来源字段。
—

属性详情Attribute Detail

tool_name

str

工具名称字段。声明为 str。

The tool name field.

源码Source agentscope/permission/_rule.py:24

rule_content

str | None

规则内容字段。声明为 str | None。

The rule content field.

源码Source agentscope/permission/_rule.py:28

behavior

PermissionBehavior

行为字段。声明为 PermissionBehavior。

The behavior field.

源码Source agentscope/permission/_rule.py:31

source

str

来源字段。声明为 str。

The source field.

源码Source agentscope/permission/_rule.py:34
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.