Skip to contents

An agent definition names a specialist for peter(agents = ...): its model, tools, skills, system text, backend, preset and limits. model and skills may be bare identifiers; they are stored unevaluated (as written) and resolved by the gateway. gptr_agent("name") alone (or with only file) loads a saved definition. Package code should pass strings.

Usage

gptr_agent(
  name = NULL,
  description = NULL,
  model = NULL,
  tools = NULL,
  skills = NULL,
  system = NULL,
  backend = c("auto", "inline", "worker", "cli"),
  preset = "minimal",
  max_turns = NULL,
  mode = NULL,
  objects = NULL,
  export = NULL,
  returns = NULL,
  file = NULL
)

Arguments

name

Agent name.

description

One line describing the specialist.

model

Model reference: a string, a bare identifier or a provider spec.

tools

Tool names (or specs) the agent may use.

skills

Skills to preload.

system

System text of the agent.

backend

"auto", "inline", "worker", "cli" or a registered backend name.

preset

Tool preset of the agent's session.

max_turns

Turn limit, or NULL.

mode

Permission mode ("plan", "manual", "edits", "auto", "yolo"), or NULL to inherit; a sub-agent never runs looser than its caller.

objects

Names of objects the agent may see.

export

Names of objects the agent returns. Keep them self-contained: a worker agent sends back only these objects, so an exported function or plot finds the caller's objects but none of the agent's others.

returns

JSON Schema of a structured answer, or NULL.

file

Path of an agent definition file.

Value

A spec of class c("gptr_agent", "gptr_spec").

Examples

gptr_agent("stats", description = "Statistical reviewer", model = "anthropic/claude-opus-5-5",
           skills = "statistics")
#> <gptr_agent stats>
#>   description: Statistical reviewer
#>   model: anthropic/claude-opus-5-5
#>   skills: statistics
#>   backend: auto
#>   preset: minimal
#>   api_version: 1.0