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

PermissionMode

class PermissionMode(Enum)
源码Source 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).

源码Source agentscope/permission/_types.py:81

ACCEPT_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).

源码Source agentscope/permission/_types.py:82

EXPLORE

 = 'explore'

EXPLORE字段。

Explore mode - read-only; modifications are denied.

源码Source agentscope/permission/_types.py:83

BYPASS

 = 'bypass'

BYPASS字段。

Bypass mode - skips safety checks; relies on user deny / ask rules as the only guardrail.

源码Source agentscope/permission/_types.py:84

DONT_ASK

 = 'dont_ask'

DONT ASK字段。

Don't ask mode - converts all ASK decisions to DENY (for unattended execution).

源码Source agentscope/permission/_types.py:85
基于官方固定版本源码静态生成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.