eval

package
v0.807.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2026 License: AGPL-3.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package eval provides the PromptZero golden evaluation harness (roadmap P2-25). Scenarios exercise the top-level agent flows — handoff round-trip, snapshot / rewind, ATT&CK constraint, detector verdicts, prompt-injection quarantine — against mock Flipper + Marauder transports. A scenario pass means the agent glue still wires up end-to-end; a fail signals a regression that CI might not otherwise catch at the unit-test layer.

The harness is deliberately plain Go: each scenario is a func that returns an error (or nil). Runner collects timings + tool-call counts + error state per scenario. Cost metrics are computed from `cost.Tracker` when the scenario installs one.

Scenarios are also discoverable as Go tests (see `scenario_tests.go`) so they run under `go test`, `task test`, and CI without a custom binary — the Runner type just gives us a structured aggregate when the operator wants a summary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllPassed

func AllPassed(results []Result) bool

AllPassed reports whether every result in the slice is a pass. CI gates on this.

func Summarise

func Summarise(results []Result) string

Summarise renders a compact, human-readable report from a Result slice. Two-column table with pass/fail marker, name, duration, and error (if any). Grouped by tag when the Runner supplied tags.

The format is stable — external tooling (the `task eval` target) can grep on "PASS:" / "FAIL:" prefixes.

Types

type Result

type Result struct {
	Name     string
	Pass     bool
	Err      error
	Duration time.Duration
	// ToolCalls is optional; scenarios that thread a counter through
	// the mock agent can populate it for a richer summary. Scenarios
	// that don't care leave it zero.
	ToolCalls int
}

Result captures the outcome of one scenario pass.

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner holds a registered set of scenarios and executes them in deterministic order. Safe to reuse across calls.

func NewRunner

func NewRunner() *Runner

NewRunner returns an empty Runner.

func (*Runner) Names

func (r *Runner) Names() []string

Names returns the registered scenario names in registration order.

func (*Runner) Register

func (r *Runner) Register(s Scenario) *Runner

Register adds a scenario. Duplicate names are allowed — the Runner reports them verbatim — but downstream consumers should prefer unique names for clean summaries.

func (*Runner) RegisterAll

func (r *Runner) RegisterAll(scenarios ...Scenario) *Runner

RegisterAll is a convenience for batch registration.

func (*Runner) Run

func (r *Runner) Run() []Result

Run executes every registered scenario sequentially. Each scenario is independent: a panic in one does not abort the rest (the Runner recovers and reports the panic as an error).

func (*Runner) RunMatching

func (r *Runner) RunMatching(tags ...string) []Result

RunMatching filters scenarios by tag and runs the subset. Empty tag list matches everything. Tags use OR semantics — a scenario runs if ANY of its tags matches ANY of the filter tags.

type Scenario

type Scenario struct {
	Name        string
	Description string
	// Tags group scenarios so a later filter ("only RF scenarios")
	// can subset a run. Examples: "handoff", "snapshot", "attack",
	// "detector", "quarantine".
	Tags []string
	Run  func() error
}

Scenario is a named integration-level check that exercises one or more agent features end-to-end. Run returns nil on success; any non-nil error is surfaced as a scenario fail. Description is optional operator-facing prose.

func Default

func Default(t *testing.T) []Scenario

Default returns the canonical scenario suite used by CI and `task eval`. Covers one end-to-end flow per critical agent layer so a PR that regresses any of them trips the gate loudly.

Adding a scenario: append a new function below (keep them pure — no network, no live Anthropic API) and wire it into this constructor.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL