Controls what an agent is allowed to do. Permissions can be configured with fine-grained controls for different tool types, or with a custom callback for complex logic.
Tool gating fields:
tool_allowlist: Optional list of tools that are allowed. When set, tools not in the list are denied.tool_denylist: Optional list of tools that are always denied.permission_prompt_tool_name: Optional tool name to mention in deny messages for gated tools (e.g., "ask_user").
Security Note: Permission fields are immutable after construction. This prevents adversarial code from modifying permissions at runtime. All fields use active bindings that reject modification attempts.
Active bindings
modePermission mode (see PermissionMode). Read-only after construction.
file_readAllow file reading. Read-only after construction.
file_writeAllow file writing. Can be
TRUE,FALSE, or a canonical absolute directory path. Read-only after construction.bashAllow bash command execution. Read-only after construction.
r_codeAllow R code execution. Read-only after construction.
webAllow web requests. Read-only after construction.
install_packagesAllow package installation. Read-only after construction.
can_use_toolCustom permission callback. Read-only after construction.
tool_allowlistOptional character vector of allowed tool names. Read-only after construction.
tool_denylistOptional character vector of denied tool names. Read-only after construction.
permission_prompt_tool_nameOptional tool name used in gating deny messages. Read-only after construction.
Methods
Permissions$new()
Create a new Permissions object.
Usage
Permissions$new(
mode = "standard",
file_read = TRUE,
file_write = getwd(),
bash = FALSE,
r_code = TRUE,
web = FALSE,
install_packages = FALSE,
can_use_tool = NULL,
tool_allowlist = NULL,
tool_denylist = NULL,
permission_prompt_tool_name = NULL
)Arguments
modePermission mode
file_readAllow file reading
file_writeAllow file writing (
TRUE,FALSE, or an existing absolute directory path). Directory grants are canonicalized once when the policy is constructed.bashAllow bash commands
r_codeAllow R code execution
webAllow web requests
install_packagesAllow package installation
can_use_toolCustom callback function
tool_allowlistOptional character vector of allowed tool names
tool_denylistOptional character vector of denied tool names
permission_prompt_tool_nameOptional dedicated approval-tool name to suggest in permission deny messages for gated tools. Native capability-bearing tools cannot be used as approval prompts.
Permissions$check()
Check if a tool is allowed to execute.
Usage
Permissions$check(tool_name, tool_input, context = list())Arguments
tool_nameName of the tool
tool_inputArguments passed to the tool
contextAdditional context (e.g., working_dir, tool_annotations)