Thin wrapper that shells out to the rmorie command-line agent (the
launcher install_cli writes). The agent can run R,
read/write files, remember notes, and use any configured model backend
(Anthropic, OpenAI-compatible, Google Gemini, or a local Ollama model).
The CLI is the single implementation; this function only forwards to it,
so every MORIE package can offer agentic help without duplicating logic.
Arguments
- task
Character scalar. The task/prompt for the agent.
- model
Optional model id, e.g.
"claude-sonnet-5","gpt-4o","gemini-2.5-flash", or any tag your Ollama server serves. Defaults to the CLI's default model.- backend
Optional backend:
"auto"(route on the model id),"anthropic","openai","gemini", or"ollama".- dry_run
Logical; if
TRUEthe agent only plans (no network).
Details
Requires the rmorie binary on PATH. Cloud backends
read RMORIE_AGENT_API_KEY from the environment (the key is never
passed through R). If the binary is absent a clear message is returned
instead of an error.
Examples
# \donttest{
agent("use R to compute the mean of 1:10")
#> [1] "the rmorie launcher is not on PATH: run Rscript -e 'rmorie::install_cli()' once, then agent() works."
agent("summarize mtcars", model = "gemini-2.5-flash", backend = "gemini")
#> [1] "the rmorie launcher is not on PATH: run Rscript -e 'rmorie::install_cli()' once, then agent() works."
# }
