gptr 1.0.0
gptr 1.0.0 is a complete rewrite: an agent harness that runs inside the live R session and works on the objects already in memory.
Breaking changes
- The 0.7.0 interface,
get_response()anddataframe_to_text(), is removed with no aliases. - Instead of
get_response(), usesession = peter("your prompt", model = "openai/gpt-6-sol"), which returns a session object; its answer issession$text, andsession |> peter("next prompt")continues the conversation. The key comes fromOPENAI_API_KEY(or a.envfile read withgptr_env()) instead of theapi_keyargument, instructions that went intosystem_specificationgo into the prompt or the project instructions file.gptr/vignette.Rmd, and answers stream to the console when a person is present instead of throughprint_response. - Instead of
dataframe_to_text(), pass the data frame topeter()as context, for examplepeter("Which variables are correlated?", mtcars): gptr describes the object compactly and the model computes on it in your session. - Providers and models are chosen with the
modelargument or withgptr_config(). - ‘RCurl’ is no longer used; HTTP is handled by ‘curl’.
- R 4.2.0 or later is required.
New features
-
peter()is the single entry point. Without a prompt it opens a chat in the console; with a prompt it runs the agent loop and returns the session. The pipe steers one session:peter("...") |> peter("...")adds turns to the same object.gptr_fork()is the only way to branch. Sessions are saved in the project and resumed withgptr_sessions(),gptr_resume()andgptr_last(). - With no default model, the interactive console offers Claude Code CLI or Codex CLI setup, or API instructions;
gptr_providers(check_login = TRUE)shows CLI sign-in status. - The agent evaluates R code in the environment you pass (by default the caller’s frame), so objects it creates stay in your workspace. It reads, writes and edits files, and searches them with
peter$grep(),peter$find()andpeter$ls(); shell, Python, SQL and knitr engines are reached throughpeter$sh(),peter$py(),peter$sql()andpeter$knit(). - Providers are implemented in R: Anthropic, OpenAI, Google Gemini, OpenAI-compatible endpoints and local Ollama servers, with streaming, tool calls, images, reasoning controls, prompt caching and cost accounting where the model supports them. The Claude plan (through the
claudecommand-line tool, experimental) and the ChatGPT plan (throughcodex) are supported without keys. Seegptr_providers()andgptr_models(). - System 1 decisions: with a typed decision model, TypeSafe AI’s Jev or Clef and Clef Flash on a local Ollama server (0.35.1 or later),
peter()returns logical, choice or score vectors with their probabilities (gptr_prob()) that work insideif,forandwhile, one element per input. A generative model can emulate them; emulated answers are marked as uncalibrated. - Permission modes
manual(default),edits,autoandplan, rules withgptr_permissions(), and an advisory risk classifier,gptr_risk(). A permission question without a person present stops the run with a classed condition. - Scripts and notebooks are the history: code the agent ran is recorded below each
peter()call in.R,.Rmd,.qmdand.ipynbdocuments and replays without model calls (gptr_doc(),gptr_source(),gptr_blocks(),gptr_cache()). -
gptr_init()creates a.gptr/project workspace with the project instructions file.gptr/vignette.Rmd;gptr_config()andgptr_trust()manage settings and trust. - Checkpoints:
gptr_rewind(),gptr_checkpoints()and/undorestore objects, files and the conversation. - Sub-agents, teams and fan-outs (
agents =,parallel =,gptr_parallel()), across providers. - Skills, prompt templates, agent files, extensions and plugins in R packages, all on one versioned extension API (
gptr_register(),gptr_spec()and the spec constructors). - MCP: a client for both protocol eras (
gptr_mcp(),gptr_mcp_add()) that exposes server tools as R functions, andgptr_mcp_serve(), which serves the live session to other agents. - Artifacts are Shiny apps launched in the background from the live session (
gptr_artifacts()). - Secrets are kept in a private vault and redacted everywhere;
gptr_login()signs in to providers and MCP servers,gptr_env()loads.envfiles (including thejev-keyalias) andgptr_scrub()cleans files that captured a key. - Token accounting and budgets:
gptr_usage(),gptr_prompt(),gptr_describe()and thebudgetargument. - Background sessions (
background = TRUE) are experimental. - See
?gptr_securityand?gptr_egressfor what gptr does on your behalf and what it sends to model providers, and?gptr_optionsfor every option. - Successful removal of CLI billing variables emits an informational
gptr_message_billing_envcondition with the removed names, never their values. Handlers usemuffleMessage; the notice respectsgptr.quiet. Actual billing refusals remain errors.