ExAgent.Eval.Capture (ExAgent v3.0.0)

View Source

Export a settled C7 agent turn as a redacted Eval case and an offline cassette.

Stability — Candidate.

Summary

Functions

Capture a trusted diagnostic read from ExAgent.Continuation.get/3 with diagnostics: true. The host authorizes the exact Store scope and run before supplying the read. Supply the suite's test agent and the same :run_opts it uses in CI, for example to apply its permissions and synthetic dependencies. Capture uses an isolated ETS Store, a scripted Models.Test and strict tool substitutes. It runs the test agent's application hooks and validators.

Types

field()

@type field() ::
  :input
  | :expected
  | :output
  | :model_text
  | :tool_name
  | :tool_arguments
  | :tool_result
  | :denial_message

redactor()

@type redactor() :: (field(), term() -> {:ok, term()} | :drop)

Functions

from_run(details, agent, opts)

@spec from_run(ExAgent.Continuation.run_details(), ExAgent.t(), keyword()) ::
  {:ok, %{case: Path.t(), fixture: Path.t()}} | {:error, term()}

Capture a trusted diagnostic read from ExAgent.Continuation.get/3 with diagnostics: true. The host authorizes the exact Store scope and run before supplying the read. Supply the suite's test agent and the same :run_opts it uses in CI, for example to apply its permissions and synthetic dependencies. Capture uses an isolated ETS Store, a scripted Models.Test and strict tool substitutes. It runs the test agent's application hooks and validators.

Required options are the non-secret identifiers :suite and :name, and a :redact function of arity two. It must supply safe replacements for model text, tool names and arguments, replayable tool results and any custom denial message. The :input, :expected, :output redaction fields and options follow ExAgent.Eval.Case.from_run/2. Supply a text prompt, either redacted from the journal or with :input. The host can supply a synthetic history prefix through :run_opts. Reasoning, citations, provider references, raw requests and review actor identities are omitted.

The case and cassette are published together under :dir (default "evals/fixtures"). An existing capture with the same suite and case name is kept. Replay uses mix exagent.eval --suite NAME. The source can include root approval pauses and failed turns with retained evidence. Set :retain_failed_turn in the source continuation configuration to retain failed turn bodies for authorized diagnostics. An output guardrail failure requires a test guardrail that reproduces the stored verdict. Fatal tool errors use a synthetic cause and retain any qualified usage.

A missing body returns {:error, {:capture_body_unavailable, body, cause}}. Supply a synthetic :input when only the prompt is missing. For a purged, withheld or never-retained model reply or tool result, write a synthetic fixture. Capture rejects deferral resolutions, workflows and unsettled effects. Grading belongs to the suite's replay.