类class
agentscope.permissionPermissionRule
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_name | str | 工具名称字段。 | — |
rule_content | str | None | 规则内容字段。 | — |
behavior | PermissionBehavior | 行为字段。 | — |
source | str | 来源字段。 | — |
属性详情Attribute Detail
tool_name
str工具名称字段。声明为 str。
The tool name field.
源码Source
agentscope/permission/_rule.py:24rule_content
str | None规则内容字段。声明为 str | None。
The rule content field.
源码Source
agentscope/permission/_rule.py:28behavior
PermissionBehavior行为字段。声明为 PermissionBehavior。
The behavior field.
源码Source
agentscope/permission/_rule.py:31source
str来源字段。声明为 str。
The source field.
源码Source
agentscope/permission/_rule.py:34