| agent_solvers | R Documentation |
claude_code() and codex() are solvers that evaluate the Claude Code
and Codex coding agents on your dataset, allowing you to compare
off-the-shelf agent harnesses against your own with the same scorer.
These solvers bridge to Python Inspect's inspect_swe package, which runs the agent's command line interface in a Docker sandbox and proxies its model calls. The agent's transcript is then read back into ellmer Chat objects so that scoring and logging work exactly as they do for any other solver.
claude_code(solver_chat = NULL, ..., version = "auto", sandbox = "docker")
codex(solver_chat = NULL, ..., version = "auto", sandbox = "docker")
solver_chat |
An ellmer chat object, such as from
|
... |
Additional named arguments, routed by name to either the
inspect_swe agent—e.g. |
version |
A string specifying the agent CLI version to use.
|
sandbox |
The Inspect sandbox in which the agent runs: a string
naming the sandbox type, or a length-2 vector pairing a type with a
configuration file, e.g. |
A solver function that can be passed directly to the solver argument of
Task's $new() method. Since the agent runs in a sandbox rather than
through ellmer, the solver's solver_chat output contains copies of
solver_chat whose turns come from the agent's transcript. Each sample's
solver_metadata records the path to the intermediate Inspect log,
the sample's token usage by model, and the agent's error message (if any).
Token usage is recorded in the task's log and in solver_metadata, but
not in Task's $token_usage() method, which only reflects API calls
made through ellmer in the current R session.
These solvers require the reticulate package and a running Docker daemon
(Docker Desktop or
similar). Python dependencies are resolved automatically with
reticulate::py_require(). The first evaluation additionally pulls the
sandbox image and downloads the agent's command line interface into it, so
it takes a few minutes longer than the ones that follow.
Each sample gets its own container, discarded when the sample completes,
so the agent's edits never touch your machine and never leak from one
sample to the next. The agent starts in its image's working directory,
falling back to the sandbox user's home directory when the image sets
none; pass cwd to place it somewhere else.
By default that image is Inspect's own, which contains little more than a
Python installation. To give the agent a repository to work in, or any
other starting state, put a Dockerfile or compose.yaml in your working
directory and Inspect will build the sandbox from it, or point sandbox
at one directly:
claude_code(
chat_anthropic(model = "claude-sonnet-4-5"),
sandbox = c("docker", "path/to/compose.yaml")
)
See Inspect's sandboxing documentation for the configuration these files support.
if (FALSE) {
library(tibble)
library(ellmer)
simple_addition <- tibble(
input = c("What's 2+2?", "What's 2+3?"),
target = c("4", "5")
)
tsk <- Task$new(
dataset = simple_addition,
solver = claude_code(chat_anthropic(model = "claude-sonnet-4-5")),
scorer = detect_includes()
)
tsk$eval()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.