| Type: | Package |
| Title: | AI-Powered R Console Assistant |
| Version: | 0.3.3 |
| Description: | An AI-powered assistant for the R console. Type natural language or incorrect R code directly in the console, and 'agenticr' routes it to an AI agent for processing. Focused on statistical analysis, data transformation, and visualization, https://github.com/panlanfeng/AgenticR. |
| License: | MIT + file LICENSE |
| SystemRequirements: | ripgrep (optional, for fast file search; install with 'winget install BurntSushi.ripgrep.MSVC' on Windows or see https://github.com/BurntSushi/ripgrep) |
| Encoding: | UTF-8 |
| Imports: | httr, jsonlite, cli, utils, yaml, processx |
| Suggests: | testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| Config/roxygen2/version: | 8.0.0 |
| NeedsCompilation: | no |
| Packaged: | 2026-07-19 15:08:19 UTC; lf |
| Author: | Lanfeng Pan [aut, cre] |
| Maintainer: | Lanfeng Pan <panlanfeng@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-07-28 16:40:21 UTC |
AI-Powered R Console Assistant
Description
An AI-powered assistant for the R console. Type natural language or incorrect R code directly in the console, and agenticr routes it to an LLM agent for processing.
Author(s)
Maintainer: Lanfeng Pan panlanfeng@gmail.com
Examples
agentic_providers()
agentic_skills()
Start an AgenticR session
Description
Start an interactive AI-powered R console session. Type R code for direct execution, natural language for LLM processing, or slash commands for meta-operations. Press Ctrl+C twice to exit.
Usage
agentic(auto = TRUE, ...)
Arguments
auto |
If TRUE, tries to auto-configure from environment variables. |
... |
Not used |
Details
Valid R code executes directly with zero LLM overhead. Natural language queries are routed to the configured LLM provider, which generates and executes R code in the current session.
The ; prefix forces natural language mode for any input (e.g. ;hist(mtcars[[\"mpg\"]]) sends it to the LLM instead of executing directly).
Value
Invisible. Called for its side effects.
Examples
## Not run: agentic()
Chat with the agent
Description
Send a single natural language query to the LLM agent and get a response. Useful for programmatic use or one-off queries without entering the interactive REPL.
Usage
agentic_chat(query)
Arguments
query |
The natural language query string. |
Value
Invisible. Agent output is printed to the console.
Examples
## Not run: agentic_chat("what is the mean of mpg?")
Read and manage configuration
Description
Read, update, and persist agenticr configuration. Switching providers auto-loads the provider's defaults (model, base URL, context window).
Usage
agentic_config(..., save = FALSE)
Arguments
... |
Named arguments to set: |
save |
If TRUE, save configuration to |
Details
reasoning_effort controls DeepSeek's thinking depth. Valid values: "minimal", "low", "medium", "high". Default is "medium".
When switching provider (e.g. provider = "openai"), the preset model and base URL are auto-loaded. Individual fields can be overridden.
Value
Invisibly returns the updated config list.
Examples
cfg <- agentic_config()
cat("Default provider:", cfg$provider, "\n")
Disable error interceptor
Description
See package documentation for details.
Usage
agentic_disable()
Value
No return value, called for side effects.
Examples
agentic_enable()
agentic_disable()
Enable error interceptor
Description
See package documentation for details.
Usage
agentic_enable(auto_process = TRUE)
Arguments
auto_process |
If TRUE, processes NL errors with the LLM agent. |
Value
No return value, called for side effects.
Examples
agentic_enable()
# Normal R code runs directly without involving the LLM
mean(1:10)
agentic_disable()
Install a skill from a URL
Description
Downloads a SKILL.md file from a URL and installs it to agenticr data directory. Skills are opt-in prompt templates that modify agent behavior.
Usage
agentic_install_skill(url, name = NULL)
Arguments
url |
URL to the SKILL.md file (raw GitHub URL or similar). |
name |
Skill name (optional; derived from URL if NULL). |
Value
Invisible.
Examples
## Not run: agentic_install_skill("https://raw.githubusercontent.com/user/skill/main/SKILL.md")
List connected MCP servers
Description
See package documentation for details.
Usage
agentic_mcp()
Value
No return value, called for side effects.
Examples
agentic_mcp()
Add an MCP server
Description
Connect to an external Model Context Protocol (MCP) server via JSON-RPC over stdio. Tools from the server are merged into the agent's tool list.
Usage
agentic_mcp_add(name, command, args = character(0), env = list(), save = FALSE)
Arguments
name |
Server name for display and tool prefixing (e.g. |
command |
Executable to run (e.g. |
args |
Command-line arguments. |
env |
Environment variables as a named list. |
save |
If TRUE, persist the server config to |
Value
Invisible.
Examples
## Not run: agentic_mcp_add("search", "npx", args = c("-y", "mcp-server"))
Process a single natural language query
Description
Internal function that processes a query through the agent loop. This is what the error interceptor calls when it detects natural language input.
Usage
agentic_process(query)
Arguments
query |
The natural language query to process. |
Value
Invisible. Results are printed to the console.
Examples
## Not run: agentic_process("what is 2+2?")
List available provider presets
Description
See package documentation for details.
Usage
agentic_providers()
Value
No return value, called for side effects.
Examples
agentic_providers()
Resume a previous agentic session
Description
Resume a previous agentic session from its turns.jsonl log file. Restores conversation history so the agent has full context of the prior session.
Usage
agentic_resume(session_id, ...)
Arguments
session_id |
Session ID (e.g. |
... |
Not used |
Value
Invisible. Starts the REPL with prior conversation restored.
Examples
## Not run:
agentic_sessions()
agentic_resume("20250515_120000_a1b2c3d4")
## End(Not run)
List available sessions for resuming
Description
See package documentation for details.
Usage
agentic_sessions()
Value
No return value, called for side effects.
Examples
agentic_sessions()
Interactive setup wizard
Description
Walks the user through configuring an API key and provider interactively. Creates agenticr config file if it does not exist.
Usage
agentic_setup()
Details
The wizard prompts for API key, provider, and optional model override. Configuration is saved to agenticr config file and can be edited manually later.
Value
Invisible.
Examples
## Not run: agentic_setup()
List installed skills
Description
See package documentation for details.
Usage
agentic_skills()
Value
No return value, called for side effects.
Examples
agentic_skills()
Print agenticr configuration
Description
Pretty-prints the current agenticr configuration using cli formatting. Shows provider, model, temperature, max tokens, and API key status (masked).
Usage
## S3 method for class 'agenticr_config'
print(x, ...)
Arguments
x |
An agenticr_config object (from |
... |
Additional arguments (ignored). |
Value
Invisibly returns x.
Examples
## Not run: agentic_config()