Runs R code in the current session and captures return values, printed
output, messages, warnings, errors, and plots. Because arbitrary R execution
can read/write files, hit the network, or mutate global state, the call is
gated through check_permission() under the tool name "RunR".
Usage
run_r_tool(mode = "default", rules = list(), ask_fn = NULL, sandbox = NULL)Arguments
- mode
Character. Permission mode (see PermissionMode).
- rules
List.
PermissionRule()objects.- ask_fn
Function or NULL.
function(tool_name, input) -> logical. Called when permission resolves to"ask".- sandbox
List or NULL. Sandbox profile (see
.sandbox_profile()). Enabling sandboxing fails closed unlessrun_r_backend = "process"is explicitly selected. That fallback uses a separatecallrprocess with a timeout and best-effort environment hygiene, but is not an OS security boundary and does not restrict filesystem, network, or process access.
Value
An ellmer::tool() object, or NULL if btw is unavailable.