Skip to contents

gptr reads each option with getOption() at the moment it needs it, so options set with options() take effect at the next call. Options marked settings have no default of their own: when unset, the value comes from the settings layers written by gptr_config() (session, project .gptr/settings.json, user settings). The safety options (gptr.ui, gptr.interactive, the guards, gptr.noninteractive_ask, gptr.protect_size, gptr.mode and gptr.unsafe_no_permissions) are copied when a run starts, so code that the model runs cannot change them for that run.

Interaction and output

  • gptr.quiet (logical, FALSE): silence notices and progress messages.

  • gptr.interactive (logical or NULL, NULL): force the decision whether a person is present to answer questions and permission prompts. This does not supply a UI or an answer in an unattended process.

  • gptr.verbose (integer or NULL, NULL): 0 silent, 1 progress on stderr (stdout in an ordinary IRkernel cell), 2 the streamed console, 3 debugging; NULL chooses by context (0 in knitr and testthat, 1 under Rscript, 2 at the console).

  • gptr.ui (character, UI spec or NULL, NULL): the user-interface backend; NULL means the console when a person is present, else none.

  • gptr.history (logical, TRUE): add console inputs to the R history.

  • gptr.deprecations (character, "warn"): "warn" or "error" for deprecated calls.

Settings, models and replay

  • gptr.model, gptr.mode, gptr.preset, gptr.system1, gptr.small_model (character or NULL, settings): the option layer of the settings of the same names.

  • gptr.project_root (character or NULL, NULL): the project root; also the environment variable GPTR_PROJECT_ROOT.

  • gptr.replay (character or NULL, settings, "auto"): how recorded document blocks are used: "auto", "replay", "live" or "record"; the replay argument of peter() wins.

  • gptr.record (character or NULL, settings, "ask"): whether gptr may write into documents: "auto", "ask" or "off".

  • gptr.interpolate (logical, TRUE): {identifier} interpolation in literal prompts.

Sessions, turns and values

  • gptr.max_turns (integer, 50): turns per programmatic run.

  • gptr.max_turns_console (integer, 200): turns per console prompt.

  • gptr.max_nested_calls (integer, 20): peter() calls per evaluation of model code.

  • gptr.value_copy_max (bytes, 2097152): designated result values below this size are copied; larger ones are kept by name.

  • gptr.values_max_bytes (bytes, 67108864): value copies held per session.

  • gptr.background_tools (character, "idle"): "idle" or "wait" for experimental background sessions.

  • gptr.out_keep (integer, 20): results kept per session for peter$out().

  • gptr.spill_days (number, 7): age in days after which spill files are pruned.

Concurrency and sub-agents

  • gptr.max_active (integer, 8): concurrent HTTP transfers.

  • gptr.subagents.max_active (integer, 8): concurrent inline sub-agents; the default of gptr_parallel()'s max_active.

  • gptr.subagents.max_cli (integer, 4): concurrent command-line sub-agents.

  • gptr.subagents.max_workers (integer or NULL, NULL): worker processes; NULL means min(4, cores - 1). Under R CMD check every pool of child processes is capped at 2.

  • gptr.subagents.max_tasks (integer, 8): children per team or fan-out started by model code.

  • gptr.subagents.max_depth (integer, 1): nesting depth of child sessions (at most 2).

  • gptr.child_text_max (bytes, 51200): text returned per child task.

Transport and processes

  • gptr.connect_timeout (seconds, 20), gptr.first_byte_timeout (seconds, 120) and gptr.idle_timeout (seconds, 90): network timeouts. High-effort reasoning on OpenAI or Google may need options(gptr.idle_timeout = 300).

  • gptr.max_retry_delay (seconds, 60): a longer retry-after from a provider fails at once.

  • gptr.max_attempts (integer, 4): transport attempts per request.

  • gptr.wire_log (logical or path, FALSE): write a redacted log of every request and response inside the workspace or the session temporary directory.

  • gptr.supervise (logical or NULL, NULL): supervise child processes; NULL means yes except under R CMD check.

  • gptr.stdin_timeout (seconds, 60): time allowed to write pending input to a child.

  • gptr.cli_path (named list or NULL, NULL): explicit paths of the claude and codex command-line tools.

  • gptr.cli_turn_timeout (seconds, 3600): wall-clock time per command-line turn.

Evaluation and tools

  • gptr.r_timeout (seconds, 3600): time limit of the r tool when nobody is present. It stops R code that is computing; in a non-interactive R it does not end Sys.sleep() or system(), which peter$sh(timeout = ) does for a command.

  • gptr.r_output_tokens (integer, 4000): estimated tokens of one r result.

  • gptr.r_max_images (integer, 3): plot images attached to one r result.

  • gptr.helper_output_tokens (integer, 1500): printed size of peter$ helper results.

  • gptr.read_max_tokens (integer, 12000): size cap of the read tool.

  • gptr.plot_width, gptr.plot_height, gptr.plot_res (integers, 768, 512, 120): plots sent to the model.

Permissions

  • gptr.noninteractive_ask (character, "stop"): what a permission question does when nobody can answer: "stop" ends the run with status blocked and a gptr_error_permission condition (gptr_error_noninteractive when the ask tool has no one to answer); "deny" returns a denial to the model.

  • gptr.critical_guard (logical, TRUE): level-4 actions ask even in auto mode.

  • gptr.secret_guard (logical, TRUE): reads of registered secrets ask even in auto mode; gptr_security lists the reads.

  • gptr.protect_size (bytes, 1e8): overwriting a larger object is a level-3 action. Each version of an object is sized once and the size reused: after code you run between requests (at R's prompt once a request ran, a console ! line, a notebook cell, a knitr chunk) the next check sizes what it overwrites again; an edit in place made otherwise, by a callback say, counts once the object is rebound or Peter's code changes it. An object with more than 12.5 million strings is sized from a sample of them: an estimate, at or above its true size on average.

  • gptr.plan_handoff (logical, TRUE): hand the plan a plan run proposes, once, to the next top-level peter() call from the same environment, within an hour and in another mode; another peter() call first, or a next call inside a loop or a run, discards it.

  • gptr.unsafe_no_permissions (logical, FALSE): turns the permission gate off entirely; honored only when set outside a run, for sandboxed continuous integration.

Context, caching and compaction

  • gptr.compact_at (tokens or NULL, 200000): the compaction soft cap; NULL disables the cap.

  • gptr.compact_cold_min (tokens, 100000): the size above which a cold cache compacts.

  • gptr.cache_ttl (character, "gap"): prompt-cache lifetime policy: "gap", "5m" or "1h".

  • gptr.cache_gap (seconds, 240): a pause between requests longer than this switches the cache lifetime to one hour.

  • gptr.check_prefix (character, "event"): what a broken cache prefix does: "event", "warn" or "error".

  • gptr.skills_budget (integer, 1500) and gptr.mcp_budget (integer, 1500): tokens of the skill and MCP tool catalogs.

Checkpoints and undo

  • gptr.checkpoint (character, "on"): "on", "files" or "off".

  • gptr.undo.capture_max (bytes, settings, 1e8), the option layer of the setting undo.capture_max (see gptr_rewind()): every object up to this size is kept by reference before a call that runs R code.

  • gptr.undo.memory (bytes, settings, 1e9), the option layer of undo.memory: an object the code is predicted to change is kept up to this size; the images of a session hold at most this many bytes in memory.

  • gptr.undo.disk (bytes, settings, 2e9), the option layer of undo.disk: bytes of images spilled to disk per session.

  • gptr.undo.turns (integer, settings, 20), the option layer of undo.turns: images older than this many turns are dropped.

  • gptr.checkpoint_disk_bytes (bytes, 2e9), gptr.checkpoint_days (days, 30) and gptr.checkpoint_turns (integer, 100): retention of the checkpoint store.

  • gptr.checkpoint_track_file_max (bytes, 1e6) and gptr.checkpoint_track_total (bytes, 1e8): the largest file the first scan stores, and what one scan stores in all.

  • gptr.checkpoint_capture_max (bytes, 5e7): a larger changed file gets no stored copy.

  • gptr.checkpoint_scan_budget (seconds, 0.25): project scan time per request; past it, its calls back up the files they name and one scan at its end records the rest, edits you made to the project meanwhile included. An incomplete scan spends the budget at once.

  • gptr.checkpoint_scan_timeout (seconds, 2): the longest an automatic file scan runs. Scans inspect at most 2,000 entries and back up at most 256 files within the byte limits above. Incomplete scans are reported; unvisited files have no automatic undo coverage. Predicted write targets are backed up separately.

  • gptr.checkpoint_rng (logical, TRUE): report changes of the random-number state in the rewind report (gptr never changes your random seed).

  • gptr.checkpoint_close_devices (logical, FALSE): close graphics devices opened by an undone turn.

Secrets

  • gptr.redact_min_chars (integer, 8): the shortest secret value that is redacted.

  • gptr.redact_patterns (logical, TRUE): also redact text that looks like a key; known values are always redacted.

  • gptr.stream_hold_max (integer, 4096): characters held back while redacting a stream.

  • gptr.env_export (logical, TRUE): the default of gptr_env(set_env =).

  • gptr.prompt_secrets (character, "redact"): secret-looking text in prompts: "redact" or "ask".

System 1

  • gptr.s1_max_active (integer, 8): concurrent System 1 requests.

  • gptr.s1_rounds (integer, 3): retry rounds for failed elements.

  • gptr.s1_state_max (integer, 2000): characters of a session's state sent to System 1.

  • gptr.s1_max_elements (integer, 10000): elements per System 1 call.

Documents, MCP and artifacts

  • gptr.doc_output_lines (integer, 12): output lines recorded per execution.

  • gptr.doc_source_frames (logical, TRUE): let gptr find the calling line of a script run with source().

  • gptr.mcp_timeout (seconds, 60) and gptr.mcp_probe_timeout (seconds, 5): MCP request and protocol-probe time limits.

  • gptr.mcp_debug (logical, FALSE): keep redacted MCP server logs in the user cache.

  • gptr.artifact_max_bytes (bytes, 5e8): the largest artifact data snapshot.

Environment variables

  • GPTR_REPLAY: the replay mode below the gptr.replay option; GPTR_REPLAY=replay proves that a script makes no model calls.

  • GPTR_PROJECT_ROOT: overrides the project root, like gptr.project_root.

  • ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY, TYPESAFE_API_KEY and the other provider keys: read at the first use of a provider; see gptr_env() for .env files.

  • R_USER_CONFIG_DIR, XDG_CONFIG_HOME and HOME (on Windows also APPDATA and USERPROFILE): they place tools::R_user_dir("gptr", "config"), which holds gptr's settings, permission rules, trust decisions and credentials, and your home directory. Setting or unsetting one of them from model code changes gptr's own configuration, as does a variable a registered provider reads (its key or base-URL variable, such as AWS_REGION for Bedrock, or a variable gptr keeps for the claude or codex command-line tool: its login, its folder or the path of Git Bash, such as CODEX_HOME), a GPTR_* or *_BASE_URL variable, R_ENVIRON_USER, R_PROFILE_USER, R_ENVIRON or R_PROFILE, whatever the letter case. Every mode but yolo asks you first, auto included, before Sys.setenv(), Sys.unsetenv(), withr::local_envvar() or withr::with_envvar() of such a name or of a name the classifier cannot read, before readRenviron() and dotenv::load_dot_env(), and before an os.environ write in peter$py() or peter$knit("python", code) code that names one in a string or an upper-case word or whose name is not a plain string literal; gptr_security lists what it does not read.

  • GPTR_WORKER, GPTR_SUBAGENT_DEPTH, GPTR_ARTIFACT_PORTS, GPTR_SHELL_CMD and the tree markers GPTR_PROC_<id>: set by gptr in its own child processes only.

  • GPTR_MCP_TOKEN: the variable through which the Codex snippet of gptr_mcp_serve() passes the server's bearer token to the client; gptr itself never reads it.

  • GPTR_LIVE_TESTS: "true" enables the package's live tests; not used at run time.

  • _R_CHECK_PACKAGE_NAME_: set by R CMD check; outside the package's own tests a model call without its own replay argument then runs in replay mode (recorded answers or an offline provider, never a model server), and each child-process pool is capped at two.

See also

gptr_config() for settings stored in files, gptr_security and gptr_egress; vignette("configuration", package = "gptr") for scope, precedence and grouped examples.