gptr - Language Model Agents Inside the Live 'R' Session
Runs large language model agents inside the running 'R'
session, so that models inspect and modify objects that are
already in memory instead of re-running scripts from scratch. A
single function, peter(), opens an interactive chat in the
console or, given a prompt, runs the agent loop and returns a
value that can be piped into further prompts. Supports the
'Anthropic', 'OpenAI' and 'Google Gemini' application
programming interfaces, 'OpenAI'-compatible endpoints, the
'Claude Code' and 'Codex' command line tools, local 'Ollama'
conversational models, and System One typed-decision models
such as 'Jev', 'Clef' and 'Clef Flash'
<https://typesafe.ai/blog/introducing-system-one-models-and-jev>,
whose typed yes/no, choice and score answers can be used
directly in if() and for() statements. Tools for reading,
writing, editing and searching files and for evaluating 'R'
code are implemented in 'R'; skills, extensions, Model Context
Protocol ('MCP') servers, sub-agents and 'shiny' apps are
supported. Sessions are recorded as 'R' scripts, 'R Markdown',
'Quarto' or 'Jupyter' documents that can be re-run. Writing
files and evaluating model-generated code require the user's
permission by default.