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., "AskUserQuestion").
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 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.
max_turnsMaximum number of turns before stopping. Read-only after construction.
max_cost_usdMaximum cost in USD before stopping. 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
Method new()
Create a new Permissions object.
Usage
Permissions$new(
mode = "default",
file_read = TRUE,
file_write = NULL,
bash = FALSE,
r_code = TRUE,
web = FALSE,
install_packages = FALSE,
max_turns = 25,
max_cost_usd = NULL,
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 directory path)
bashAllow bash commands
r_codeAllow R code execution
webAllow web requests
install_packagesAllow package installation
max_turnsMaximum turns
max_cost_usdMaximum cost
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 tool name to suggest in permission deny messages for gated tools
Method 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)