Package: gptr 1.0.0

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.

Authors:Wanjun Gu [aut, cre, cph], Mario Zechner [ctb, cph]

gptr_1.0.0.tar.gz
gptr_1.0.0.zip(r-4.7-any)gptr_1.0.0.zip(r-4.6-any)gptr_1.0.0.zip(r-4.5-any)
gptr_1.0.0.tgz(r-4.6-any)gptr_1.0.0.tgz(r-4.5-any)
gptr_1.0.0.tar.gz(r-4.7-any)gptr_1.0.0.tar.gz(r-4.6-any)
gptr_1.0.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
gptr/json (API)

# Install 'gptr' in R:
install.packages('gptr', repos = c('https://broccolito.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/broccolito/gptr/issues

Pkgdown/docs site:https://broccolito.github.io

On CRAN:

Conda:

6.53 score 2 stars 80 scripts 276 downloads 64 exports 8 dependencies

Last updated from:4e784ddb05. Checks:2 ERROR, 7 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develERROR1164
source / vignettesOK288
linux-releaseERROR871
macos-releaseOK768
macos-oldrelOK897
windows-develOK1032
windows-releaseOK1749
windows-oldrelOK1431
wasm-releaseOK139

Exports:gptr_adaptergptr_agentgptr_agentsgptr_apigptr_artifactsgptr_backendgptr_blocksgptr_cachegptr_cancelgptr_checkgptr_checkpointsgptr_commandgptr_configgptr_context_blockgptr_describegptr_docgptr_envgptr_exportgptr_fake_providergptr_forkgptr_hookgptr_initgptr_jobsgptr_lastgptr_logingptr_logoutgptr_mcpgptr_mcp_addgptr_mcp_removegptr_mcp_servegptr_modelsgptr_ongptr_parallelgptr_permissionsgptr_pluginsgptr_policygptr_preimagegptr_probgptr_promptgptr_prompt_sectiongptr_providergptr_providersgptr_redactgptr_registergptr_registrygptr_reloadgptr_resumegptr_returngptr_rewindgptr_riskgptr_routergptr_scrubgptr_sessionsgptr_skillsgptr_sourcegptr_specgptr_steergptr_stepgptr_toolgptr_tool_resultgptr_trustgptr_usagegptr_waitpeter

Dependencies:clicurljsonliteprocessxpsR6rlangyaml

Configuration
Scope and precedence | Settings by purpose | R options | Environment and credentials

Last update: 2026-10-16
Started: 2026-10-10

Execution model
One language model turn | Where objects live | What the session retains | Permissions and concurrency

Last update: 2026-10-16
Started: 2026-10-10

Extending gptr
A tool the model calls as an R function | A permission policy | A hook on a session | Prompt sections, context blocks and commands | Other kinds | Extensions and plugins

Last update: 2026-10-16
Started: 2026-10-07

Getting started
A first call | Try it offline | The pipe steers one session | Stopping instead of guessing | At the console | Connecting a real model | Where to go next

Last update: 2026-10-16
Started: 2026-10-07

Interactive console
Enter prompts, objects and your own R | Commands | Approve, interrupt and continue

Last update: 2026-10-16
Started: 2026-10-10

Language models
Choose and connect a model | API providers | Azure OpenAI and Amazon Bedrock | Subscription command-line tools | Local Ollama models | Work with a session | Put calls in functions and scripts

Last update: 2026-10-16
Started: 2026-10-10

MCP
List first, connect when needed | Register a server | Call tools as R functions | Authenticate an HTTP server | Serve your R session

Last update: 2026-10-16
Started: 2026-10-10

Script as history
Program in natural language, then use ordinary R | Calls inside functions | Recording a designated R script | Inspecting and replaying | R Markdown, Quarto and Jupyter | Exporting a recorded script | Asking Peter to summarize a completed workflow

Last update: 2026-10-16
Started: 2026-10-07

Skills and plugins
Find and use skills | Write a skill | Prompt templates and project instructions | Agent definition files | Package a plugin | Trust and precedence

Last update: 2026-10-16
Started: 2026-10-10

System 1 decisions
Logical decisions and probabilities | Structured inputs and batch shape | Uncertainty in filters, functions and loops | Choices and fractional scores | Provenance and caching | System 1 routes or judges System 2 | Native Jev, local Ollama and explicit emulation

Last update: 2026-10-16
Started: 2026-10-07

Teams and background work
A team of named roles | A fan-out over input elements | Independent calls with gptr_parallel() | Deferred sessions and SDK control | Experimental background work | Checkpoints, usage and durable history

Last update: 2026-10-16
Started: 2026-10-10

Token efficiency
Inspecting the prompt | Object descriptions and result size | Reported usage and estimated components | Budgets and partial results | Compaction | Three different caches | Explicit ways to reduce context

Last update: 2026-10-16
Started: 2026-10-07

Tools and artifacts
Inspect objects, files and output | Shell commands and scripts | Background programs | Python, SQL and other engines | Build a versioned artifact | Inspect, reopen and stop artifacts

Last update: 2026-10-16
Started: 2026-10-10

Why Peter?
Peter Naur: make the program readable | Peter Cathcart Wason: examine the reasoning | Two ideas in one R workflow

Last update: 2026-10-16
Started: 2026-10-10

Readme and manuals

Help Manual

Help pageTopics
Convert a session summary to a data frameas.data.frame.gptr_session_summary
Format a risk classificationformat.gptr_risk print.gptr_risk
Format a session as its textas.character.gptr_session format.gptr_session
Define a wire adaptergptr_adapter
Define a sub-agentgptr_agent
Extension API version and featuresgptr_api
List, open, relaunch and stop artifactsgptr_artifacts
Define a sub-agent backendgptr_backend
List the agent blocks of a documentgptr_blocks
Inspect, prune or clear gptr's cachesgptr_cache
Cancel running sessionsgptr_cancel
Check an extension for conformancegptr_check
Define a slash commandgptr_command
Show or change gptr's settingsgptr_config
Define a context blockgptr_context_block
Compact, budgeted description of an R objectgptr_describe gptr_describe.ArrowTabular gptr_describe.data.frame gptr_describe.Dataset gptr_describe.DBIConnection gptr_describe.default gptr_describe.dgCMatrix gptr_describe.environment gptr_describe.formula gptr_describe.function gptr_describe.ggplot gptr_describe.list gptr_describe.lm gptr_describe.matrix gptr_describe.Seurat gptr_describe.SingleCellExperiment
Bind this R process to a history documentgptr_doc
Data egress: what gptr sends to model providersgptr_egress
Load keys from a .env filegptr_env
Export a recorded R document as ordinary R or a clean Peter scriptgptr_export
A scripted, offline fake model providergptr_fake_provider
Fork a sessiongptr_fork
Define an event hookgptr_hook
Create the project workspace .gptr/gptr_init
List or stop gptr's background jobs and child processesgptr_jobs
Sign in to a model provider or an MCP servergptr_login gptr_logout
List MCP servers and their toolsgptr_mcp
Add or remove an MCP server in gptr's configurationgptr_mcp_add gptr_mcp_remove
Serve the live R session to other agents over MCPgptr_mcp_serve
List models from the model cataloggptr_models
Listen to a session's eventsgptr_on
Options that control gptrgptr_options
Run several agent calls concurrentlygptr_parallel
Manage permission rulesgptr_permissions
Plugins known to this sessiongptr_plugins
Define a permission policygptr_policy
Tell the object checkpointer how to capture an objectgptr_preimage gptr_preimage.data.table gptr_preimage.default
Probabilities and confidence of System 1 answersgptr_prob
Show the frozen system prompt, tool array and first messagegptr_prompt print.gptr_prompt_view
Define a system-prompt sectiongptr_prompt_section
Define a model providergptr_provider
List the configured model providersgptr_providers
Redact secrets from text or from a nested listgptr_redact
Register a capability specgptr_register
List the extension registrygptr_registry
Reload extensionsgptr_reload
Designate the result of an agent rungptr_return
Rewind a session: undo turns, restore objects and files, move the conversationgptr_checkpoints gptr_rewind
Classify the risk of R code without running itgptr_risk
Define a model routergptr_router
Find, and optionally remove, registered secrets in persisted filesgptr_scrub
Security considerationsgptr_security
Stored and live sessionsgptr_last gptr_resume gptr_sessions
Discovered skills and agentsgptr_agents gptr_skills
Source a history document, regenerating stale blocks without running the old codegptr_source
Build a spec of any registered kindgptr_spec
Steer a sessiongptr_steer
Advance a sessiongptr_step
Define a toolgptr_tool
Build a tool resultgptr_tool_result
Record or read whether a project is trustedgptr_trust
Token usage and costgptr_usage
Wait for sessions to settlegptr_wait
Background sessions (experimental)background-sessions gptr-background
Run an agent in this R sessionpeter
Print a sessionprint.gptr_session
Print a session summaryprint.gptr_session_summary
Show a session's structurestr.gptr_session
Summarize a session as its historysummary.gptr_session