agentscope.permissionPermissionMode
class PermissionMode(Enum)
agentscope/permission/_types.py:18–85权限的模式。位于 agentscope.permission 包,继承自 Enum。
Permission modes control how the system handles tool execution requests. Different modes are suitable for different scenarios:
+---------------+--------------------------------------------------+--------------------------------+
| Mode | Behavior | Use Case |
+===============+==================================================+================================+
| DEFAULT | Every operation asks for permission unless: | Default mode, most secure |
| | - an allow rule matches, OR | |
| | - the tool's check_permissions explicitly | |
| | returns ALLOW for the invocation (currently | |
| | only Bash auto-allows recognized | |
| | read-only commands such as ls/git | |
| | status). Read/Glob/Grep return PASSTHROUGH | |
| | and fall through to the default ASK unless | |
| | an allow rule matches. | |
+---------------+--------------------------------------------------+--------------------------------+
| ACCEPT_EDITS | - Auto-allow file writes in working directories | User present, rapid iteration |
| | - Auto-allow file reads in working directories | development |
| | - Auto-allow filesystem commands (mkdir, rm, | |
| | mv, cp, ...) only when all target paths | |
| | resolve inside a working directory | |
| | - Other operations follow normal rules | |
+---------------+--------------------------------------------------+--------------------------------+
| EXPLORE | Read-only mode: | Exploring codebase, planning |
| | - Allow: read-only tools (Read/Grep/ | implementation |
| | Glob) and read-only bash commands | |
| | (e.g. ls, git status) | |
| | - Deny: any modification tool / command | |
| | - User-configured DENY or ASK rules take | |
| | precedence over the read-only auto-allow | |
+---------------+--------------------------------------------------+--------------------------------+
| BYPASS | Skip all permission checks except explicit | Sandboxed environments |
| | user-configured deny / ask rules and tool | (container, VM), unattended |
| | DENY. Safety ASKs from tools are NOT | runs where you fully trust |
| | enforced — including rm -rf /, writes | the agent |
| | to ~/.bashrc, command-injection patterns, | |
| | etc. Use deny rules to protect specific paths. | |
| | For unattended runs that still need safety, | |
| | prefer DONT_ASK. | |
+---------------+--------------------------------------------------+--------------------------------+
| DONT_ASK | Convert every ASK (including safety ASKs and | Scheduled tasks, background |
| | ASK-rule hits) to DENY. Safe-by-default for | execution when user is away |
| | unattended execution. | |
+---------------+--------------------------------------------------+--------------------------------+
属性摘要Attribute Summary
| 属性Attribute | 类型Type | 说明Description | 值Value |
|---|---|---|---|
DEFAULT | — | 默认字段。 Default mode - explicit permission per action. The
only auto-allow path is the tool's own ``check_permissions``
returning ALLOW (currently just ``Bash`` for recognized
read-only commands like ``ls``/``git status``). | 'default' |
ACCEPT_EDITS | — | ACCEPT EDITS字段。 Accept edits mode - automatically allows file
edits within working directories (including filesystem
bash commands whose every target is in a working dir). | 'accept_edits' |
EXPLORE | — | EXPLORE字段。 Explore mode - read-only; modifications are denied. | 'explore' |
BYPASS | — | BYPASS字段。 Bypass mode - skips safety checks; relies on user
deny / ask rules as the only guardrail. | 'bypass' |
DONT_ASK | — | DONT ASK字段。 Don't ask mode - converts all ASK decisions to DENY
(for unattended execution). | 'dont_ask' |
属性详情Attribute Detail
DEFAULT
= 'default'默认字段。
Default mode - explicit permission per action. The
only auto-allow path is the tool's own check_permissions
returning ALLOW (currently just Bash for recognized
read-only commands like ls/git status).
agentscope/permission/_types.py:81ACCEPT_EDITS
= 'accept_edits'ACCEPT EDITS字段。
Accept edits mode - automatically allows file edits within working directories (including filesystem bash commands whose every target is in a working dir).
agentscope/permission/_types.py:82EXPLORE
= 'explore'EXPLORE字段。
Explore mode - read-only; modifications are denied.
agentscope/permission/_types.py:83BYPASS
= 'bypass'BYPASS字段。
Bypass mode - skips safety checks; relies on user deny / ask rules as the only guardrail.
agentscope/permission/_types.py:84DONT_ASK
= 'dont_ask'DONT ASK字段。
Don't ask mode - converts all ASK decisions to DENY (for unattended execution).
agentscope/permission/_types.py:85