Skip to contents

Agent

Run a task and inspect its response, tool calls, and usage.

Agent
Agent R6 Class
AgentResult()
Create a completed agent result
result_n_turns()
Count conversation turns
result_tool_calls()
Inspect tool calls
result_tool_results()
Inspect completed tool calls
result_text_chunks()
Inspect streamed text
result_is_success()
Inspect run success
AgentEvent()
Create an agent event
AgentUsage()
Create an agent usage record
UsageLimits()
Configure run-scoped usage limits
ContextPolicy()
Configure automatic context management
DeputyCompaction()
Record a conversation compaction outcome

Tools

Built-in tools and tool bundles

tool_read_file()
Read file contents
tool_read_markdown()
Convert a file to markdown using MarkItDown
tool_write_file()
Write content to a file
tool_edit_file()
Edit file contents by replacing text
tool_multi_edit()
Apply multiple text edits to a file
tool_list_files()
List files in a directory
tool_glob_files()
Find files using a glob pattern
tool_grep_files()
Search file contents with grep-like matching
tool_run_r_code()
Execute R code
RSession
Own a conversation's trusted R session
tool_run_bash()
Execute bash commands
tool_read_csv()
Read a CSV file
tool_web_fetch()
Fetch web page content
tool_web_search()
Search the web
tool_ask_user()
Ask user tool
tools_file()
File operation tools
tools_code()
Code execution tools
tools_data()
Data reading tools
tools_web()
Web tools
tools_all()
All built-in tools
tools_preset()
Get a tool preset by name
tools_interactive()
Tools for interactive workflows
tools_mcp()
Get tools from MCP servers
McpConnection
Own an isolated MCP client connection
tool_metadata()
Inspect a tool's origin and annotation coverage
tools_mcp_repl()
Load an R REPL with an enforced OS sandbox
mcp_repl_connection()
Connect an Agent to an independent sandboxed REPL
mcp_repl_control()
Request an upstream REPL interrupt or reset
set_ask_user_callback()
Set callback for non-interactive user input

Permissions

Control what agents can do

Permissions()
Create a permission policy
permissions_check()
Evaluate a tool call against a permission policy
PermissionMode
Permission modes for agent tool access
PermissionResultAllow()
Create an allow permission result
PermissionResultDeny()
Create a deny permission result
PermissionResultPending()
Request a durable tool approval
ApprovalContinuation()
Durable approval inspection value
approval_read()
Inspect a durable approval continuation
permissions_standard()
Create a standard permission policy
permissions_readonly()
Create a read-only permission policy
permissions_plan()
Create a planning permission policy
permissions_full()
Create a full access permission policy

Hooks

Intercept and customize agent behavior

HookEvent
Hook events supported by deputy
HookMatcher()
Match a lifecycle hook
hook_matches()
Test whether a hook matches a tool name
HookResult() PermissionResult()
Callback result value families
HookResultPreToolUse()
Create a PreToolUse hook result
HookResultPostToolUse()
Create a PostToolUse hook result
HookResultPreCompact()
Create a PreCompact hook result
hook_log_tools()
Create a hook that logs all tool calls
hook_block_dangerous_bash()
Create a hook that blocks dangerous bash commands
hook_limit_file_writes()
Create a hook that limits file writes to a directory

Skills

Load reusable instructions for an agent.

Skill()
Declarative Skill Configuration
skill_load()
Load a skill from a directory
skill_create()
Create a skill programmatically
skill_check_requirements()
Check Skill Requirements
skills_list()
List available skills in a directory

Multi-Agent

Coordinate multiple specialized agents

LeadAgent
LeadAgent R6 Class
AgentDefinition() agent_definition()
Create an Agent Definition
agent_definition_read() agent_definition_write() agent_definitions()
Read, write, and discover AgentDefinition files

Errors

Catch errors by class and inspect their details.

deputy-errors DeputyError
Deputy Error Classes
is_deputy_error()
Check if an object is a deputy error