| Title: | 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 AI agent for processing. Focused on statistical analysis, data transformation, and visualization, <https://github.com/panlanfeng/AgenticR>. |
| Authors: | Lanfeng Pan [aut, cre] |
| Maintainer: | Lanfeng Pan <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.3.3 |
| Built: | 2026-09-27 08:41:34 UTC |
| Source: | https://github.com/panlanfeng/agenticr |
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.
Maintainer: Lanfeng Pan [email protected]
agentic_providers() agentic_skills()agentic_providers() agentic_skills()
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.
agentic(auto = TRUE, ...)agentic(auto = TRUE, ...)
auto |
If TRUE, tries to auto-configure from environment variables. |
... |
Not used |
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).
Invisible. Called for its side effects.
## Not run: agentic()## Not run: agentic()
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.
agentic_chat(query)agentic_chat(query)
query |
The natural language query string. |
Invisible. Agent output is printed to the console.
## Not run: agentic_chat("what is the mean of mpg?")## Not run: agentic_chat("what is the mean of mpg?")
Read, update, and persist agenticr configuration. Switching providers auto-loads the provider's defaults (model, base URL, context window).
agentic_config(..., save = FALSE)agentic_config(..., save = FALSE)
... |
Named arguments to set: |
save |
If TRUE, save configuration to |
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.
Invisibly returns the updated config list.
cfg <- agentic_config() cat("Default provider:", cfg$provider, "\n")cfg <- agentic_config() cat("Default provider:", cfg$provider, "\n")
See package documentation for details.
agentic_disable()agentic_disable()
No return value, called for side effects.
agentic_enable() agentic_disable()agentic_enable() agentic_disable()
See package documentation for details.
agentic_enable(auto_process = TRUE)agentic_enable(auto_process = TRUE)
auto_process |
If TRUE, processes NL errors with the LLM agent. |
No return value, called for side effects.
agentic_enable() # Normal R code runs directly without involving the LLM mean(1:10) agentic_disable()agentic_enable() # Normal R code runs directly without involving the LLM mean(1:10) agentic_disable()
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.
agentic_install_skill(url, name = NULL)agentic_install_skill(url, name = NULL)
url |
URL to the SKILL.md file (raw GitHub URL or similar). |
name |
Skill name (optional; derived from URL if NULL). |
Invisible.
## Not run: agentic_install_skill("https://raw.githubusercontent.com/user/skill/main/SKILL.md")## Not run: agentic_install_skill("https://raw.githubusercontent.com/user/skill/main/SKILL.md")
See package documentation for details.
agentic_mcp()agentic_mcp()
No return value, called for side effects.
agentic_mcp()agentic_mcp()
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.
agentic_mcp_add(name, command, args = character(0), env = list(), save = FALSE)agentic_mcp_add(name, command, args = character(0), env = list(), save = FALSE)
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 |
Invisible.
## Not run: agentic_mcp_add("search", "npx", args = c("-y", "mcp-server"))## Not run: agentic_mcp_add("search", "npx", args = c("-y", "mcp-server"))
Internal function that processes a query through the agent loop. This is what the error interceptor calls when it detects natural language input.
agentic_process(query)agentic_process(query)
query |
The natural language query to process. |
Invisible. Results are printed to the console.
## Not run: agentic_process("what is 2+2?")## Not run: agentic_process("what is 2+2?")
See package documentation for details.
agentic_providers()agentic_providers()
No return value, called for side effects.
agentic_providers()agentic_providers()
Resume a previous agentic session from its turns.jsonl log file. Restores conversation history so the agent has full context of the prior session.
agentic_resume(session_id, ...)agentic_resume(session_id, ...)
session_id |
Session ID (e.g. |
... |
Not used |
Invisible. Starts the REPL with prior conversation restored.
## Not run: agentic_sessions() agentic_resume("20250515_120000_a1b2c3d4") ## End(Not run)## Not run: agentic_sessions() agentic_resume("20250515_120000_a1b2c3d4") ## End(Not run)
See package documentation for details.
agentic_sessions()agentic_sessions()
No return value, called for side effects.
agentic_sessions()agentic_sessions()
Walks the user through configuring an API key and provider interactively. Creates agenticr config file if it does not exist.
agentic_setup()agentic_setup()
The wizard prompts for API key, provider, and optional model override. Configuration is saved to agenticr config file and can be edited manually later.
Invisible.
## Not run: agentic_setup()## Not run: agentic_setup()
See package documentation for details.
agentic_skills()agentic_skills()
No return value, called for side effects.
agentic_skills()agentic_skills()
Pretty-prints the current agenticr configuration using cli formatting. Shows provider, model, temperature, max tokens, and API key status (masked).
## S3 method for class 'agenticr_config' print(x, ...)## S3 method for class 'agenticr_config' print(x, ...)
x |
An agenticr_config object (from |
... |
Additional arguments (ignored). |
Invisibly returns x.
## Not run: agentic_config()## Not run: agentic_config()