gptr: Language Model Agents in Live 'R' Sessions

Runs language model agents in an existing 'R' session, where generated code can inspect and modify objects already in memory. The peter() function supports interactive chat and programmatic calls. Conversational models use tools and return session objects; typed decision models return logical, character or numeric vectors with associated model probabilities. Supports the 'Anthropic' <https://platform.claude.com/docs/en/api/overview>, 'OpenAI' <https://developers.openai.com/api/reference/overview> and 'Google Gemini' <https://ai.google.dev/gemini-api/docs> APIs, 'OpenAI'-compatible endpoints, local 'Ollama' <https://ollama.com> models, and the 'Claude Code' and 'Codex' command line tools. Decision models include 'Jev', hosted by 'TypeSafe AI' <https://docs.typesafe.ai/introduction>, and the local 'Clef'. Top-level agent calls and their executed code can be recorded in 'R' scripts, 'R Markdown' and 'Quarto' documents, or 'Jupyter' notebooks. Recorded 'R' scripts can be replayed without model calls when the required inputs and packages are available.

Version: 1.0.0
Depends: R (≥ 4.2.0)
Imports: cli (≥ 3.6.2), curl (≥ 6.0.0), graphics, grDevices, jsonlite (≥ 1.8.8), methods, processx (≥ 3.8.6), ps (≥ 1.8.0), rlang (≥ 1.1.0), stats, tools, utils, yaml (≥ 2.3.0)
Suggests: bslib, chromote, codetools, data.table, DBI, duckdb, httpuv, keyring, knitr, later, magick, openssl, ragg, reticulate, rmarkdown, RSQLite, rstudioapi, shiny, stringi, testthat (≥ 3.2.0), vctrs, withr
Enhances: repr
Published: 2026-11-01
DOI: 10.32614/CRAN.package.gptr
Author: Wanjun Gu ORCID iD [aut, cre, cph], Tianlu Zhu [ctb] (UI/UX polishing and CI/CD), Gianmarco Bellucci ORCID iD [ctb] (Testing)
Maintainer: Wanjun Gu <wanjun.gu at ucsf.edu>
BugReports: https://github.com/Broccolito/gptr/issues
License: Apache License (== 2.0)
Copyright: file inst/COPYRIGHTS
gptr copyright details
URL: https://broccolito.github.io/gptr/, https://github.com/Broccolito/gptr
NeedsCompilation: no
SystemRequirements: Optional: Ollama (>= 0.35.1) for native local decision models; other optional external programs: 'claude' (Claude Code) and 'codex' (Codex) for subscription providers, 'quarto' for 'Quarto' documents, and a 'Chrome'-family browser for app screenshots.
Language: en-US
Materials: README, NEWS
CRAN checks: gptr results

Documentation:

Reference manual: gptr.html , gptr.pdf
Vignettes: Configuration (source)
Execution model (source)
Extending gptr (source)
Getting started (source)
Interactive console (source)
Language models (source)
MCP (source)
Record, replay and export (source)
Skills and plugins (source)
Typed decisions (source)
Harnesses and coaching (source)
Teams and background work (source)
Token efficiency (source)
Tools and artifacts (source)
Why Peter? (source)

Downloads:

Package source: gptr_1.0.0.tar.gz
Windows binaries: r-devel: gptr_0.7.0.zip, r-release: gptr_0.7.0.zip, r-oldrel: gptr_0.7.0.zip
macOS binaries: r-release (arm64): gptr_1.0.0.tgz, r-oldrel (arm64): gptr_1.0.0.tgz, r-release (x86_64): gptr_1.0.0.tgz, r-oldrel (x86_64): gptr_1.0.0.tgz
Old sources: gptr archive

Linking:

Please use the canonical form https://CRAN.R-project.org/package=gptr to link to this page.