eval

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 42 Imported by: ? 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 binds immutable datasets and scenario assertions to agenttest sessions.

Items and JSONL eagerly capture validation errors in a Dataset, allowing datasets to be declared as package variables. Validate joins all scenario problems before execution. JSONL version 1 starts with a format/version header, rejects unknown and duplicate members, and preserves number tokens in item data and tool arguments. Hash addresses the canonical JSONL bytes, independently of their source file.

Execute handles one attempt. The default driver runs scripted user inputs in one new session; Drive may replace it and Assert may add checks, scores and claims. Task and Reference resolve from the item before falling back to scenario defaults. Evaluation orders runs_succeeded, scenario expectations, item expected tools, then Assert checks. Failed checks describe quality failures. Outcome.Err describes infrastructure errors, panics, timeouts and broken assertion contracts. The error return is reserved for invalid arguments. The mandatory health check alone does not satisfy the requirement for user checks or claims.

Plan validates all scenarios, variants and selectors, then enumerates variant, scenario, item and repeat keys in declaration order. Run constructs a fresh harness per attempt, starts longest timeouts first (zero is longest), bounds concurrency and retains declaration-ordered records. Repeats and Concurrency default to one. Selectors combine with OR within a kind and AND across kinds.

NewHarnessFunc forwards base then variant options and closes failed setups. Factories must forward supplied options and return fresh harnesses. Prefer ScriptedModel, which creates one script per harness, over ScriptedModelFrom with a shared script. Variant labels and cloned policy are run defaults; context compaction and recovery settings belong in Variant.Policy.Context.

Verdict precedence is error, failed, pending, passed. Gating claims remain pending until judging; informational claims do not gate. HarnessErr records factory/setup/panic/reuse/Close failures. NotRun records identify attempts skipped by cancellation, token limits, disabled live models or an OnAttempt panic; the first stop reason wins. Run returns a partial report and an error for caller cancellation, disabled live use or an OnAttempt panic (with its stack). A token limit alone is not a Run error; later cancellation, disabled live use or callback panic still returns an error without replacing that stop. Other recorded failures are not Run errors. Run never enables live models. OnAttempt is serial, at most once per record, with skipped records delivered last in declaration order; a panic disables later callbacks and records the panic in the triggering record's HarnessErr. Groups reports counts without a pass threshold.

Tokens come from all completed calls in each returned run record, including descendants and abandoned calls. TotalTokens is used when positive, otherwise input, output and both cache fields are summed. Usage preserves the raw field sums, so Usage.TotalTokens can be lower than Tokens when recorded totals are missing. Decide calls inside Assert and runs omitted from a custom Drive's returned session are not counted. A token limit stops new attempts at >= MaxTokens; running attempts finish, allowing up to Concurrency-1 additional attempts beyond the crossing attempt. Callback order and skipped keys are nondeterministic under concurrency; record order is stable. Runs exposes runrecord exports for storage; AttemptKey is the identity because run and session IDs may repeat across isolated harnesses. Exports are retained in memory for the entire experiment.

Open creates a self-gitignored experiment store. Begin validates the plan, stages both headers, and atomically publishes the experiment directory. Readers ignore hidden staging directories. Writer.OnAttempt streams complete attempt lines before progress. Finish atomically replaces the attempt log from the final report, including callback panic errors, then writes the terminal summary. Write failures are sticky and WithOnError reports the first failure once. Oversized records omit exports and retain a StorageError diagnostic. Schema version 1 reserves StoredClaim subjects and tool selectors, judgment subjects and step locators, and separate judge usage and tokens. These optional fields survive decoding; the runner populates them when a judge is configured.

Load rejects invalid schemas and exports but retains complete lines before a torn final line. StoredRun.Record and Trajectory restore evidence after harness closure, including final messages, event verification and trace IDs. Fingerprints summarize recorded model/prompt identities and system, tool and context hashes. List, Resolve, Last and Find locate experiments and attempts. RerunSelection selects failed, error and not-run groups as a variant/item cross-product superset. Full prompts and server-only content remain local without redaction. Directories created by the store use mode 0700 and new files use mode 0600. Callers own existing directory permissions, which Open preserves. The store never deletes experiments.

Show renders stored checks, scores, judgments and reconstructed session evidence. Default trajectory limits apply unless Full is set. Missing exports and render panics produce diagnostics. ShowJSON embeds trajectories; Export adds raw exports. Summary and SummaryJSON order non-passed groups first and use full-ID references.

Compare pools repeats of shared scenario/item pairs within selected variants. CompareExperiments aligns shared variants, or the two sole variants regardless of name. CompareVariants compares one experiment's first variant with the rest. CompareOptions.Parent overlays whole candidate groups on their recorded parent. Pass fractions exclude not_run but include pending; integer cross-products set status. Deltas include changed check/claim fractions, score medians and modal tool-sequence LCS edits with depth-first child tools. Totals cover the intersection. Warnings expose changed datasets, agent and judge provenance, calibration, truncation and incomplete experiments. WriteComparisons renders regressions first; WriteComparisonsJSON preserves declaration order in a version-1 document.

Claim is a declaration only. Judging belongs to a separate layer. Execute may run concurrently on one harness; callbacks and expectation predicates must be concurrency-safe and cooperate with cancellation.

Index

Examples

Constants

View Source
const DefaultVariant = "default"

DefaultVariant identifies the implicit variant when no variants are declared.

Variables

View Source
var ErrEmptyDataset = errors.New("eval: empty dataset")

ErrEmptyDataset means a dataset has no items.

View Source
var ErrNoAssertions = errors.New("eval: no assertions")

ErrNoAssertions means no user quality checks or claim declarations were supplied. The mandatory runs_succeeded health check does not satisfy this requirement.

View Source
var ErrNothingToRerun = errors.New("eval: nothing to rerun")

ErrNothingToRerun means no failed, error or not-run groups exist.

View Source
var ErrProbeRerunUnsupported = errors.New("eval: probe rerun unsupported; submit a new probe")

ErrProbeRerunUnsupported rejects evaluation rerun overlays for operational probes.

Functions

func DefaultStoreDir

func DefaultStoreDir(start string) (string, error)

DefaultStoreDir finds .loom-evals beside the nearest ancestor go.mod.

func EncodeJSONL

func EncodeJSONL(w io.Writer, d Dataset) error

EncodeJSONL writes canonical version-1 JSONL with LF endings and a final LF.

func Show

func Show(w io.Writer, e *Experiment, a *StoredAttempt, opts ShowOptions) error

Show renders one stored attempt and its session, degrading unavailable evidence.

func ShowJSON

func ShowJSON(w io.Writer, e *Experiment, a *StoredAttempt, opts ShowOptions) error

ShowJSON embeds decoded trajectories, adding raw exports only when requested.

func Summary

func Summary(w io.Writer, e *Experiment) error

Summary renders stored verdict groups failing first, followed by failing refs.

func SummaryJSON

func SummaryJSON(w io.Writer, e *Experiment) error

SummaryJSON writes the header, failing-first groups and full failing references.

func Validate

func Validate(scenarios ...Scenario) error

Validate joins all scenario and item problems with their declaration locations.

func WriteComparisons

func WriteComparisons(w io.Writer, cs []*Comparison) error

WriteComparisons renders regressions first, collapsing unchanged groups. Comparisons of multiple variants in one experiment share a column table.

func WriteComparisonsJSON

func WriteComparisonsJSON(w io.Writer, cs []*Comparison) error

WriteComparisonsJSON writes deterministic version-1 comparison documents.

Types

type Assertions

type Assertions struct {
	Checks []expect.Check
	Claims []Claim
	Scores []expect.Score
}

Assertions contains additional quality checks, claim declarations and scores.

type Attempt

type Attempt struct {
	Scenario string
	Item     Item
	Harness  *agenttest.Harness
	Session  *agenttest.SessionResult
}

Attempt binds a resolved item to its harness and session evidence.

func (*Attempt) Final

func (a *Attempt) Final() *model.Message

Final returns the final message from the last session trajectory, if present.

func (*Attempt) Subject

func (a *Attempt) Subject() expect.Subject

Subject returns the session trajectory as an expectation subject.

type AttemptEvidence

type AttemptEvidence struct {
	Key      AttemptKey
	Index    int
	Snapshot *agenttest.EvidenceSnapshot
	Error    string
}

AttemptEvidence binds private canonical evidence to a planned eval attempt. Error is explicit when capture is absent, corrupt, or not reconstructable. No quality verdict is inferred from lifecycle evidence.

type AttemptHarnessConfig

type AttemptHarnessConfig struct {
	Register agenttest.Register
	Options  []agenttest.Option
	Setup    func(*agenttest.Harness) error
}

AttemptHarnessConfig declares application setup for one isolated attempt. Register is required. Options configure models and other application settings; Setup optionally installs fixtures after registration. Runner-owned options are applied by NewAttemptHarnessFunc before Register, without callback forwarding.

type AttemptHarnessFunc

type AttemptHarnessFunc func(ctx context.Context, attempt AttemptInfo, opts ...agenttest.Option) (*agenttest.Harness, error)

AttemptHarnessFunc constructs a fresh harness using planned attempt metadata. Like HarnessFunc, it must forward opts to agenttest.NewHarness.

func NewAttemptHarnessFunc

func NewAttemptHarnessFunc(configure func(context.Context, AttemptInfo) (AttemptHarnessConfig, error), base ...agenttest.Option) AttemptHarnessFunc

NewAttemptHarnessFunc constructs a fresh harness from per-attempt declarations. Options apply in base, configure, runner order. Conflicting evidence options fail before registration; runner-owned stores are never installed after setup. Configure receives owned metadata and must be safe for concurrent calls. Setup errors or panics close the constructed harness before returning an error.

type AttemptInfo

type AttemptInfo struct {
	Key     AttemptKey
	Item    Item
	Variant Variant
}

AttemptInfo supplies an owned snapshot of one planned attempt before harness construction. Key identifies its scenario, item, variant and one-based repeat. Item contains dataset values before scenario defaults are resolved by Execute. Mutating this snapshot does not change the plan, dataset or another attempt.

type AttemptKey

type AttemptKey struct {
	Variant  string `json:"variant"`
	Scenario string `json:"scenario"`
	Item     string `json:"item"`
	Repeat   int    `json:"repeat"`
}

AttemptKey identifies an attempt independently of harness-local run IDs.

func Plan

func Plan(cfg Config) ([]AttemptKey, error)

Plan validates the entire configuration and returns keys in declaration order.

func (AttemptKey) String

func (k AttemptKey) String() string

String returns the unambiguous variant:scenario:item:repeat identity.

type AttemptRecord

type AttemptRecord struct {
	ExecutionKind ExecutionKind
	Prepared      *PreparedReceipt
	Probe         *ProbeStatus
	Artifacts     []StoredArtifact
	AttemptKey
	Index       int
	Outcome     *Outcome
	HarnessErr  error
	NotRun      StopReason
	Started     time.Time
	Duration    time.Duration
	Usage       model.TokenUsage
	Tokens      int
	JudgeUsage  model.TokenUsage
	JudgeTokens int
}

AttemptRecord retains quality results and harness failures for one planned key.

func (*AttemptRecord) Runs

func (r *AttemptRecord) Runs() []RunEvidence

Runs returns exports for the completed session prefix, including on harness errors.

func (*AttemptRecord) Verdict

func (r *AttemptRecord) Verdict() Verdict

Verdict gives not-run and harness errors precedence over the outcome.

type CheckCounts

type CheckCounts struct {
	Passed int `json:"passed"`
	Total  int `json:"total"`
}

CheckCounts records the passed fraction of observed checks.

type CheckDelta

type CheckDelta struct {
	Name       string      `json:"name"`
	Baseline   CheckCounts `json:"baseline"`
	Candidate  CheckCounts `json:"candidate"`
	Diagnostic string      `json:"diagnostic"`
}

CheckDelta reports a changed check fraction and a failing sample diagnostic.

type Claim

type Claim struct {
	ID            string
	Text          string
	Informational bool
	// Subject defaults to answer. Tool selects calls only for step subjects.
	Subject Subject
	Tool    tools.Ident
}

Claim declares a criterion for a judge; Execute does not judge it.

func ArgumentCorrectness

func ArgumentCorrectness() Claim

ArgumentCorrectness judges each adopted model call that chose tools.

func ConversationCompleteness

func ConversationCompleteness() Claim

ConversationCompleteness judges the conversation's expected outcome.

func StepEfficiency

func StepEfficiency() Claim

StepEfficiency judges whether the trajectory used unnecessary steps.

func TaskCompletion

func TaskCompletion() Claim

TaskCompletion judges whether the trajectory completed the item's task.

func ToolArgumentCorrectness

func ToolArgumentCorrectness(t tools.Named) Claim

ToolArgumentCorrectness judges calls to t. Its ID is lowercase ASCII, with non-alphanumeric characters replaced by underscores, truncated to 64 bytes. Validate rejects collisions between sanitized IDs.

type ClaimCounts

type ClaimCounts struct {
	Entailed     int `json:"entailed"`
	Total        int `json:"total"`
	Errors       int `json:"errors"`
	Uncalibrated int `json:"uncalibrated"`
	Truncated    int `json:"truncated"`
}

ClaimCounts includes every judged unit, including errors, in Total.

type ClaimDelta

type ClaimDelta struct {
	ClaimID      string      `json:"claim_id"`
	Subject      string      `json:"subject"`
	Tool         string      `json:"tool"`
	Baseline     ClaimCounts `json:"baseline"`
	Candidate    ClaimCounts `json:"candidate"`
	Uncalibrated bool        `json:"uncalibrated"`
	Truncated    bool        `json:"truncated"`
	Rationale    string      `json:"rationale"`
}

ClaimDelta pools judgments by claim, subject and declared tool selector.

type CollectedArtifact

type CollectedArtifact struct {
	Name      string
	MediaType string
	Data      []byte
}

CollectedArtifact owns bytes returned by the host; empty Data is a retained empty output.

type CollectionInput

type CollectionInput struct {
	Key           AttemptKey
	Receipt       PreparedReceipt
	Evidence      *agenttest.EvidenceSnapshot
	EvidenceError error
	Provisional   bool
}

CollectionInput supplies owned receipt and canonical capture to a host collector.

type CompareOptions

type CompareOptions struct{ Parent *Experiment }

CompareOptions optionally overlays a candidate rerun on its recorded parent.

type Comparison

type Comparison struct {
	Baseline      SideInfo     `json:"baseline"`
	Candidate     SideInfo     `json:"candidate"`
	Warnings      []Warning    `json:"warnings"`
	OnlyBaseline  []Pair       `json:"only_baseline"`
	OnlyCandidate []Pair       `json:"only_candidate"`
	Groups        []GroupDelta `json:"groups"`
	Totals        Totals       `json:"totals"`
}

Comparison contains intersection-only deltas in candidate declaration order.

func Compare

func Compare(base, cand Side, opts CompareOptions) (*Comparison, error)

Compare compares two distinct experiments restricted to selected variants.

func CompareExperiments

func CompareExperiments(base, cand *Experiment, opts CompareOptions) ([]*Comparison, error)

CompareExperiments compares only variants shared by both experiments, except that two single-variant experiments compare even when their variant IDs differ.

func CompareVariants

func CompareVariants(e *Experiment, variants []string) ([]*Comparison, error)

CompareVariants compares the first named variant to every subsequent variant.

type Config

type Config struct {
	// PrepareAttempt is exclusive with both legacy harness factories.
	PrepareAttempt PrepareAttemptFunc
	// PreparedWriter binds prepared attempts to an explicitly begun experiment.
	PreparedWriter *Writer
	// PrepareTimeout and CleanupTimeout must be positive for prepared attempts.
	PrepareTimeout time.Duration
	CleanupTimeout time.Duration
	Harness        HarnessFunc
	// AttemptHarness receives owned attempt metadata before harness construction.
	// Exactly one of Harness, AttemptHarness and PrepareAttempt must be set.
	AttemptHarness                  AttemptHarnessFunc
	Scenarios                       []Scenario
	Variants                        []Variant
	Select                          Selection
	Repeats, Concurrency, MaxTokens int
	OnAttempt                       func(*AttemptRecord)
	Judge                           OutcomeJudge
	// JudgeTimeout bounds judging per attempt, separately from Scenario.Timeout.
	// Zero uses five minutes; negative values are invalid.
	JudgeTimeout time.Duration
}

Config declares an experiment. Zero Repeats and Concurrency both mean one. OnAttempt runs serially once per record; callbacks must not mutate configuration. A callback panic stops new attempts and disables subsequent callbacks.

type Dataset

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

Dataset is an immutable collection with an eagerly captured, deferred error. Its zero value is an empty, invalid dataset.

func DecodeJSONL

func DecodeJSONL(r io.Reader, source string) (Dataset, error)

DecodeJSONL reads strict version-1 item JSONL with a mandatory header. Raw data and argument number tokens retain their exact spelling.

func Items

func Items(items ...Item) Dataset

Items validates and owns copies of the supplied items.

Example
package main

import (
	"fmt"

	"github.com/CaliLuke/loom-mcp/v2/eval"
	"github.com/CaliLuke/loom-mcp/v2/expect"
)

func main() {
	// snippet:start eval-scenarios
	scenario := eval.Scenario{
		ID:    "status",
		Agent: "assistant.assistant_runtime",
		Task:  "Report the current status",
		Items: eval.Items(eval.Item{
			ID:    "ready",
			Input: "What is the status?",
			ExpectedTools: &expect.ExpectedTools{
				Tools: []expect.ExpectedTool{{Name: "projected.projected_status_tool"}},
				Exact: true,
			},
		}),
	}
	// snippet:end eval-scenarios
	fmt.Println(eval.Validate(scenario))
	fmt.Println(scenario.Items.Len())
}
Output:
<nil>
1

func JSONL

func JSONL(fsys fs.FS, name string) Dataset

JSONL eagerly reads a file and defers read and decoding errors to Err.

func (Dataset) Err

func (d Dataset) Err() error

Err returns the deferred validation or read error.

func (Dataset) Hash

func (d Dataset) Hash() string

Hash returns sha256:<lowercase hex> of canonical JSONL, or empty for invalid data.

func (Dataset) Items

func (d Dataset) Items() []Item

Items returns a deep copy of the dataset's items.

func (Dataset) Len

func (d Dataset) Len() int

Len returns the number of items.

func (Dataset) Source

func (d Dataset) Source() string

Source returns "go" or the file name used at construction.

type DecodeError

type DecodeError struct {
	Source string
	Line   int
	Err    error
}

DecodeError identifies the source and one-based line of a JSONL error.

func (*DecodeError) Error

func (e *DecodeError) Error() string

Error reports the JSONL location and underlying failure.

func (*DecodeError) Unwrap

func (e *DecodeError) Unwrap() error

Unwrap exposes the underlying decoding or item validation error.

type Deliverable

type Deliverable struct {
	Name      string `json:"name"`
	MediaType string `json:"media_type"`
}

Deliverable declares one confined output expected from the host collector.

type EnvironmentIdentity

type EnvironmentIdentity struct {
	Mode       string `json:"mode"`
	SnapshotID string `json:"snapshot_id"`
}

EnvironmentIdentity binds an attempt to a host-owned immutable environment.

type ExecutionKind

type ExecutionKind string

ExecutionKind identifies evaluation or operational probe execution.

const (
	// ExecutionEvaluation marks an opt-in prepared evaluation.
	ExecutionEvaluation ExecutionKind = "evaluation"
	// ExecutionProbe marks an operational attempt without quality assessment.
	ExecutionProbe ExecutionKind = "probe"
)

type Experiment

type Experiment struct {
	Dir           string
	Header        ExperimentHeader
	Attempts      []*StoredAttempt
	TruncatedTail bool
}

Experiment is a loaded summary and its attempts in Index order.

func (*Experiment) Complete

func (e *Experiment) Complete() bool

Complete reports whether a terminal experiment contains all planned attempts. A stopped experiment can be complete when every not-run key is recorded.

func (*Experiment) Find

func (e *Experiment) Find(ref string) (*StoredAttempt, error)

Find selects #index, a full attempt key, or an unambiguous scenario:item:repeat.

func (*Experiment) RerunSelection

func (e *Experiment) RerunSelection() (Selection, error)

RerunSelection selects failed, error and not-run groups, including all repeats. Selection combines variants and qualified items as a cross-product superset.

type ExperimentHeader

type ExperimentHeader struct {
	ExecutionKind ExecutionKind          `json:"execution_kind,omitempty"`
	Format        string                 `json:"format"`
	Version       int                    `json:"version"`
	ID            string                 `json:"id"`
	Label         string                 `json:"label"`
	Parent        string                 `json:"parent"`
	Status        string                 `json:"status"`
	Started       time.Time              `json:"started"`
	Finished      time.Time              `json:"finished"`
	Stop          StopReason             `json:"stop"`
	RunError      string                 `json:"run_error"`
	Source        VCS                    `json:"source"`
	Versions      Versions               `json:"versions"`
	Config        StoredConfig           `json:"config"`
	Scenarios     []ScenarioInfo         `json:"scenarios"`
	Variants      []StoredVariant        `json:"variants"`
	Planned       int                    `json:"planned"`
	Tokens        int                    `json:"tokens"`
	Fingerprints  map[string]Fingerprint `json:"fingerprints"`
	Judge         *JudgeInfo             `json:"judge,omitempty"`
}

ExperimentHeader is the versioned summary stored in experiment.json.

func DecodeExperimentHeader

func DecodeExperimentHeader(data []byte, id string) (*ExperimentHeader, error)

DecodeExperimentHeader strictly decodes a persisted header without opening or creating a store. Offline inventory tools use the same format and nested wire validation as Store.Load, including the expected experiment ID.

type ExperimentMeta

type ExperimentMeta struct {
	Label, Parent string
	Identity      *Identity
}

ExperimentMeta supplies human labels, lineage and optional injected provenance.

type Fingerprint

type Fingerprint struct {
	ContextFingerprints []string                      `json:"context_fingerprints,omitempty"`
	Models              map[model.ModelClass][]string `json:"models"`
	Prompts             []prompt.PromptRef            `json:"prompts"`
	SystemHashes        []string                      `json:"system_hashes"`
	ToolHashes          []string                      `json:"tool_hashes"`
	Context             []string                      `json:"context"`
}

Fingerprint summarizes recorded model, prompt, tool and context evidence. Context retains legacy root-settings hashes. ContextFingerprints contains sorted, unique recorded settings identities from every root and child run.

type Group

type Group struct {
	Variant, Scenario, Item                            string
	Attempts, Passed, Failed, Errored, Pending, NotRun int
	Probes                                             int `json:"probes,omitempty,omitzero"`
	Unassessed                                         int `json:"unassessed,omitempty,omitzero"`
}

Group counts verdicts for one variant, scenario and item.

type GroupDelta

type GroupDelta struct {
	Scenario     string       `json:"scenario"`
	Item         string       `json:"item"`
	Status       string       `json:"status"`
	Uncalibrated bool         `json:"uncalibrated"`
	Truncated    bool         `json:"truncated"`
	Baseline     GroupStats   `json:"baseline"`
	Candidate    GroupStats   `json:"candidate"`
	Checks       []CheckDelta `json:"checks"`
	Claims       []ClaimDelta `json:"claims"`
	Scores       []ScoreDelta `json:"scores"`
	Tools        *ToolDelta   `json:"tools,omitempty"`
	// Judgment counts qualify a group even when no claim fraction changed.
	Judgments          int `json:"judgments"`
	TruncatedJudgments int `json:"truncated_judgments"`
}

GroupDelta compares all repeats of one shared scenario item.

type GroupStats

type GroupStats struct {
	Quality          string        `json:"quality,omitempty"`
	Probes           int           `json:"probes,omitempty,omitzero"`
	Unassessed       int           `json:"unassessed,omitempty,omitzero"`
	Attempts         int           `json:"attempts"`
	Ran              int           `json:"ran"`
	Passed           int           `json:"passed"`
	Failed           int           `json:"failed"`
	Errored          int           `json:"errored"`
	Pending          int           `json:"pending"`
	NotRun           int           `json:"not_run"`
	MedianTokens     int           `json:"median_tokens"`
	MedianDuration   time.Duration `json:"median_duration"`
	ToolsUnavailable int           `json:"tools_unavailable"`
}

GroupStats counts stored verdicts; medians include only attempts that ran.

type HarnessFunc

type HarnessFunc func(ctx context.Context, v Variant, opts ...agenttest.Option) (*agenttest.Harness, error)

HarnessFunc constructs a fresh harness per attempt and forwards opts to NewHarness.

func NewHarnessFunc

func NewHarnessFunc(register agenttest.Register, setup func(*agenttest.Harness, Variant) error, base ...agenttest.Option) HarnessFunc

NewHarnessFunc constructs isolated harnesses with base options before variant options. A failed setup closes its harness before returning the joined error.

type Identity

type Identity struct {
	Source   VCS
	Versions Versions
}

Identity records source provenance and compiled dependency versions.

func DetectIdentity

func DetectIdentity(ctx context.Context, dir string) Identity

DetectIdentity reads build provenance, then tries git with a five-second deadline. Missing source metadata never fails an experiment.

type Item

type Item struct {
	ID              string                `json:"id"`
	Input           string                `json:"input,omitempty"`
	Turns           []string              `json:"turns,omitempty"`
	Task            string                `json:"task,omitempty"`
	ExpectedOutcome string                `json:"expected_outcome,omitempty"`
	Persona         string                `json:"persona,omitempty"`
	Reference       string                `json:"reference,omitempty"`
	ExpectedTools   *expect.ExpectedTools `json:"expected_tools,omitempty"`
	Data            json.RawMessage       `json:"data,omitzero"`
}

Item is a single input or scripted conversation with data-driven expectations. Persona is reserved for simulated users and must be empty in version 1.

type JudgeInfo

type JudgeInfo struct {
	ModelID        string `json:"model_id"`
	PromptHash     string `json:"prompt_hash"`
	CalibrationKey string `json:"calibration_key"`
	Calibrated     bool   `json:"calibrated"`
}

JudgeInfo records judge provenance for schema version 1.

type JudgeResult

type JudgeResult struct {
	Judgments []Judgment
	Usage     model.TokenUsage
	Tokens    int
}

JudgeResult preserves claim order, then unit order, and excludes calibration usage.

type JudgedStep

type JudgedStep struct {
	Run, Index int
	Tool       tools.Ident
	CallID     string
}

JudgedStep locates a unit by zero-based session run and trajectory step index.

type Judgment

type Judgment struct {
	ClaimID                                string
	Subject                                Subject
	Step                                   *JudgedStep
	Label                                  Label
	Rationale                              string
	Informational, Uncalibrated, Truncated bool
	Err                                    error
}

Judgment retains one claim's result, or a batch infrastructure error. Step claims have one judgment per matching unit, or one synthetic missing unit.

type Label

type Label string

Label describes how the evidence supports a claim.

const (
	// Entailed means the evidence supports the claim.
	Entailed Label = "entailed"
	// Contradicted means the evidence opposes the claim.
	Contradicted Label = "contradicted"
	// NotAddressed means the evidence does not address the claim.
	NotAddressed Label = "not_addressed"
	// Indeterminate means the evidence cannot resolve the claim.
	Indeterminate Label = "indeterminate"
)

type Outcome

type Outcome struct {
	Scenario  string
	Item      string
	Task      string
	Reference string
	Session   *agenttest.SessionResult
	Checks    []expect.Check
	Scores    []expect.Score
	Claims    []Claim
	Judgments []Judgment
	Err       error
}

Outcome separates quality results from execution and assertion failures. Err is an infrastructure error; failed quality checks leave Err nil.

func Execute

func Execute(ctx context.Context, h *agenttest.Harness, s Scenario, item Item) (*Outcome, error)

Execute drives one item and evaluates its session. Only invalid arguments return a non-nil error; infrastructure failures are retained in Outcome.Err. Timeout covers BuildInputs, Drive and Assert, whose callbacks must cooperate with cancellation. Callbacks and expectation predicates must be safe for concurrent execution.

func (*Outcome) Verdict

func (o *Outcome) Verdict() Verdict

Verdict applies error, failed, pending, passed precedence.

type OutcomeJudge

type OutcomeJudge interface {
	Prepare(ctx context.Context) error
	JudgeOutcome(ctx context.Context, out *Outcome) (JudgeResult, error)
	Info() JudgeInfo
}

OutcomeJudge adapts an external judge without coupling eval to eval/judge. Implementations must support concurrent JudgeOutcome calls and honor context.

type Pair

type Pair struct {
	Scenario string `json:"scenario"`
	Item     string `json:"item"`
}

Pair identifies a scenario item independently of variant and repeat.

type PrepareAttemptFunc

type PrepareAttemptFunc func(context.Context, PreparedAttemptInfo) (*PreparedAttempt, error)

PrepareAttemptFunc acquires one isolated lease, including partial leases on error. Callbacks cooperate with cancellation and must be safe for concurrent attempts.

type PreparedAttempt

type PreparedAttempt struct {
	BaseOptions  []agenttest.Option
	Harness      AttemptHarnessConfig
	Inputs       []agenttest.Input
	Drive        PreparedDriver
	Receipt      PreparedReceipt
	Deliverables []Deliverable
	Quiesce      func(context.Context) error
	Collect      func(context.Context, CollectionInput) ([]CollectedArtifact, error)
	Release      func(context.Context) error
}

PreparedAttempt binds installation, inputs and environment lifecycle to one lease. Exactly one of Inputs and Drive is required. Every acquired lease needs Release. Host callbacks must cooperate with their supplied bounded contexts.

type PreparedAttemptInfo

type PreparedAttemptInfo struct {
	Key     AttemptKey
	Item    Item
	Variant Variant
}

PreparedAttemptInfo owns resolved item defaults and metadata for preparation.

type PreparedBinding

type PreparedBinding struct {
	ID      string `json:"id"`
	Version string `json:"version"`
}

PreparedBinding identifies a versioned host installation contract.

type PreparedBuild

type PreparedBuild struct {
	Compiler         string `json:"compiler"`
	Dependencies     string `json:"dependencies"`
	ExecutableDigest string `json:"executable_digest"`
}

PreparedBuild records the executable provenance of submitted source.

type PreparedDriver

type PreparedDriver func(context.Context, *agenttest.Harness, Item) (*agenttest.SessionResult, error)

PreparedDriver executes a fixed driver against its frozen input snapshot.

type PreparedReceipt

type PreparedReceipt struct {
	CandidateDigest string              `json:"candidate_digest"`
	SurfaceID       string              `json:"surface_id"`
	SurfaceVersion  string              `json:"surface_version"`
	Bindings        []PreparedBinding   `json:"bindings"`
	TaskSnapshot    string              `json:"task_snapshot"`
	SourceSnapshot  string              `json:"source_snapshot"`
	InputSnapshot   string              `json:"input_snapshot"`
	DriverVersion   string              `json:"driver_version,omitempty"`
	ModelConfig     string              `json:"model_config"`
	Environment     EnvironmentIdentity `json:"environment"`
	Build           *PreparedBuild      `json:"build,omitempty"`
}

PreparedReceipt binds frozen content, inputs and environment before registration.

type ProbeConfig

type ProbeConfig struct {
	Key            AttemptKey
	Item           Item
	Variant        Variant
	Agent          agent.Ident
	Timeout        time.Duration
	PrepareAttempt PrepareAttemptFunc
	PreparedWriter *Writer
	PrepareTimeout time.Duration
	CleanupTimeout time.Duration
	OnAttempt      func(*AttemptRecord)
}

ProbeConfig declares one prepared operational attempt without quality assessment. Key is complete and agrees with Item and Variant. The caller begins and finishes storage; Probe requires its matching PreparedWriter before acquiring resources.

type ProbeStatus

type ProbeStatus struct {
	Execution string `json:"execution"`
	Delivery  string `json:"delivery"`
	Evidence  string `json:"evidence"`
	Quality   string `json:"quality"`
}

ProbeStatus separates execution, delivery, evidence and unassessed quality.

type QualityCheck

type QualityCheck struct {
	ExecutionKind ExecutionKind `json:"execution_kind,omitempty"`
	Policy        string        `json:"policy"`
	Passed        bool          `json:"passed"`
	Status        string        `json:"status"`
	Planned       int           `json:"planned"`
	Attempts      int           `json:"attempts"`
	Counts        QualityCounts `json:"counts"`
	Reasons       []string      `json:"reasons"`
}

QualityCheck is an offline decision over one stored experiment. Reasons are stable codes so callers can inspect a rejection without parsing prose.

func CheckQualityStrict

func CheckQualityStrict(e *Experiment) QualityCheck

CheckQualityStrict decides whether stored results meet the strict policy. It is pure: it does not read storage, rerun attempts, or invoke a judge. A pass requires a complete experiment, a nonempty contiguous plan, an intact attempts file, and a passed verdict for every attempt.

type QualityCounts

type QualityCounts struct {
	Probes     int `json:"probes,omitempty,omitzero"`
	Unassessed int `json:"unassessed,omitempty,omitzero"`
	Passed     int `json:"passed"`
	Failed     int `json:"failed"`
	Error      int `json:"error"`
	Pending    int `json:"pending"`
	NotRun     int `json:"not_run"`
}

QualityCounts tallies stored attempt verdicts for a quality check.

type Report

type Report struct {
	ExecutionKind                           ExecutionKind
	Variants                                []Variant
	Scenarios                               []ScenarioInfo
	Selection                               Selection
	Repeats, Concurrency, MaxTokens, Tokens int
	Started, Finished                       time.Time
	Stop                                    StopReason
	Attempts                                []*AttemptRecord
	Judge                                   *JudgeInfo
}

Report retains every planned attempt in declaration order.

func Probe

func Probe(ctx context.Context, cfg ProbeConfig) (*Report, error)

Probe executes one prepared attempt, retaining evidence without assessing quality.

func Run

func Run(ctx context.Context, cfg Config) (*Report, error)

Run executes a validated matrix with isolated harnesses and bounded concurrency. A stopped experiment retains one record per planned key. Only invalid config, caller cancellation, disabled live models, prepared persistence errors and callback panics return errors; quality and harness failures remain in records. The first stop reason wins. Already running attempts finish after a token stop or callback panic.

func (*Report) Groups

func (r *Report) Groups() []Group

Groups returns verdict counts in declaration order without gating the experiment.

type RunEvidence

type RunEvidence struct {
	RunID, SessionID, TraceID string
	Export                    runrecord.Export
}

RunEvidence exports one returned session run including its descendants.

type Scenario

type Scenario struct {
	// ID uniquely identifies the scenario in a suite.
	ID string
	// Agent names the registered agent used by the default driver.
	Agent agent.Ident
	// Task supplies the default task description when an item omits it.
	Task string
	// Reference supplies the default reference when an item omits it.
	Reference string
	// Tags label the scenario for selection.
	Tags []string
	// Timeout bounds BuildInputs, Drive and Assert; zero uses the caller's context.
	Timeout time.Duration
	// Items contains the immutable dataset executed for this scenario.
	Items Dataset
	// Claims declares judge criteria shared by all items.
	Claims []Claim
	// Expect contains deterministic expectations evaluated against each session.
	Expect []expect.Expectation
	// BuildInputs constructs ordered turns for the standard sequential driver.
	// It receives the resolved item and must honor ctx; it cannot be used with Drive.
	BuildInputs func(ctx context.Context, item Item) ([]agenttest.Input, error)
	// Drive replaces the default sequential RunSession driver when non-nil.
	Drive func(ctx context.Context, h *agenttest.Harness, item Item) (*agenttest.SessionResult, error)
	// Assert adds checks, scores and claims after the declared expectations.
	Assert func(ctx context.Context, a *Attempt) (Assertions, error)
}

Scenario shares defaults, assertions and optional driving code across items. BuildInputs, Drive, Assert and expectation predicates must be safe for concurrent calls.

type ScenarioInfo

type ScenarioInfo struct {
	ID                         string
	Agent                      agent.Ident
	Tags                       []string
	Timeout                    time.Duration
	DatasetSource, DatasetHash string
	Items                      []string
}

ScenarioInfo describes selected items and their full dataset's provenance.

type ScoreDelta

type ScoreDelta struct {
	Name      string   `json:"name"`
	Baseline  *float64 `json:"baseline"`
	Candidate *float64 `json:"candidate"`
	Threshold *float64 `json:"threshold,omitempty"`
}

ScoreDelta compares medians; nil denotes a score absent on that side. Threshold is the candidate's threshold, or the baseline's if absent there.

type Selection

type Selection struct {
	Variants, Scenarios, Tags, Items []string
	// Keys selects exact expanded attempts. Nil uses ordinary selectors; a
	// non-nil slice must be nonempty and cannot be mixed with other selectors.
	Keys []AttemptKey
}

Selection combines selectors with OR within each kind and AND across kinds. Items may be bare item IDs or qualified scenario/item IDs.

type ShowOptions

type ShowOptions struct {
	Render trajectory.RenderOptions
	Full   bool
	Export bool
}

ShowOptions controls trajectory rendering and optional raw JSON exports.

type Side

type Side struct {
	Experiment *Experiment
	Variant    string
}

Side selects one experiment variant; empty Variant selects its only variant.

type SideInfo

type SideInfo struct {
	ExecutionKind ExecutionKind `json:"execution_kind,omitempty"`
	Version       int           `json:"version,omitempty,omitzero"`
	ID            string        `json:"id"`
	Label         string        `json:"label"`
	Variant       string        `json:"variant"`
	Status        string        `json:"status"`
	Complete      bool          `json:"complete"`
}

SideInfo identifies an experiment side without retaining its stored exports.

type StopReason

type StopReason string

StopReason describes why further attempts did not start.

const (
	// StopStoreError means durable prepared publication failed.
	StopStoreError StopReason = "store_error"
	// StopCanceled means the caller context stopped new attempts.
	StopCanceled StopReason = "canceled"
	// StopTokenLimit means the token budget was reached.
	StopTokenLimit StopReason = "token_limit"
	// StopLiveModelDisabled means live use was not explicitly enabled.
	StopLiveModelDisabled StopReason = "live_model_disabled"
	// StopCallbackPanic means the attempt observer panicked.
	StopCallbackPanic StopReason = "callback_panic"
)

type Store

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

Store reads and writes experiments in a caller-selected directory.

func Open

func Open(dir string, opts ...StoreOption) (*Store, error)

Open creates a self-gitignored store without deleting existing data. New directories use mode 0700. Callers own the permissions of existing directories.

func (*Store) Begin

func (s *Store) Begin(ctx context.Context, cfg Config, meta ExperimentMeta) (*Writer, error)

Begin stages both headers privately, then atomically publishes the experiment directory.

func (*Store) BeginProbe

func (s *Store) BeginProbe(ctx context.Context, cfg ProbeConfig, meta ExperimentMeta) (*Writer, error)

BeginProbe admits one explicit operational probe without evaluation assertions.

func (*Store) Dir

func (s *Store) Dir() string

Dir returns the absolute directory selected when Open created the store. Host binders can use it to locate adjacent state without selecting another root.

func (*Store) Last

func (s *Store) Last(pairs [][2]string, exclude string) (*ExperimentHeader, error)

Last finds the newest non-running experiment sharing a pair, excluding one ID. It returns nil, nil when no experiment overlaps.

func (*Store) List

func (s *Store) List() ([]ExperimentHeader, error)

List returns summaries newest first by (Started, ID), ignoring reserved/temp paths. Invalid entries are skipped and reported in the error alongside valid summaries.

func (*Store) Load

func (s *Store) Load(id string) (*Experiment, error)

Load strictly reads a canonical ID, retaining complete lines before a torn tail.

func (*Store) ReadArtifact

func (s *Store) ReadArtifact(ctx context.Context, experimentID string, key AttemptKey, name string) ([]byte, error)

ReadArtifact resolves an exact retained descriptor and verifies its owned bytes.

func (*Store) ReadEvidence

func (s *Store) ReadEvidence(ctx context.Context, experimentID string) ([]AttemptEvidence, error)

ReadEvidence reads bound captures independently of completed attempt records. Missing or corrupt captures remain rows with Error and contribute to the error return. Without capture enabled, the returned slice is empty.

func (*Store) Resolve

func (s *Store) Resolve(ref string) (string, error)

Resolve accepts a full ID, a unique prefix of at least eight bytes, or last. Last means the newest experiment whose status is not running.

type StoreOption

type StoreOption func(*storeOptions)

StoreOption configures record size and write-error reporting.

func WithMaxRecordBytes

func WithMaxRecordBytes(n int) StoreOption

WithMaxRecordBytes sets the export-omission threshold; n must be positive.

func WithOnError

func WithOnError(fn func(error)) StoreOption

WithOnError receives the first sticky write error for each writer.

type StoredArtifact

type StoredArtifact struct {
	Name        string `json:"name"`
	MediaType   string `json:"media_type"`
	Digest      string `json:"digest"`
	Size        int64  `json:"size"`
	Provisional bool   `json:"provisional,omitempty,omitzero"`
}

StoredArtifact describes verified bytes retained outside the released environment.

type StoredAttempt

type StoredAttempt struct {
	ExecutionKind ExecutionKind    `json:"execution_kind,omitempty"`
	Prepared      *PreparedReceipt `json:"prepared,omitempty"`
	Probe         *ProbeStatus     `json:"probe,omitempty"`
	Artifacts     []StoredArtifact `json:"artifacts,omitempty"`
	AttemptKey
	Index        int              `json:"index"`
	Key          string           `json:"key"`
	Verdict      Verdict          `json:"verdict"`
	NotRun       StopReason       `json:"not_run"`
	HarnessError string           `json:"harness_error"`
	Error        string           `json:"error"`
	Started      time.Time        `json:"started"`
	Duration     time.Duration    `json:"duration"`
	Usage        model.TokenUsage `json:"usage"`
	Tokens       int              `json:"tokens"`
	JudgeUsage   model.TokenUsage `json:"judge_usage,omitempty,omitzero"`
	JudgeTokens  int              `json:"judge_tokens,omitempty,omitzero"`
	Task         string           `json:"task"`
	Reference    string           `json:"reference"`
	Checks       []expect.Check   `json:"checks"`
	Scores       []expect.Score   `json:"scores"`
	Claims       []StoredClaim    `json:"claims"`
	Judgments    []StoredJudgment `json:"judgments,omitempty"`
	Runs         []StoredRun      `json:"runs"`
	Fingerprint  Fingerprint      `json:"fingerprint"`
	StorageError string           `json:"storage_error,omitempty"`
}

StoredAttempt owns one attempt's durable quality results and run evidence.

func (*StoredAttempt) Session

func (a *StoredAttempt) Session() (trajectory.Session, error)

Session restores trajectories in the original session run order.

type StoredClaim

type StoredClaim struct {
	ID            string      `json:"id"`
	Text          string      `json:"text"`
	Informational bool        `json:"informational"`
	Subject       string      `json:"subject,omitempty"`
	Tool          tools.Ident `json:"tool,omitempty"`
}

StoredClaim retains a claim and its optional judging subject and tool selector. Subject and Tool retain the resolved claim and selector.

type StoredConfig

type StoredConfig struct {
	PrepareTimeout time.Duration `json:"prepare_timeout,omitempty,omitzero"`
	CleanupTimeout time.Duration `json:"cleanup_timeout,omitempty,omitzero"`
	Repeats        int           `json:"repeats"`
	Concurrency    int           `json:"concurrency"`
	MaxTokens      int           `json:"max_tokens"`
	Selection      Selection     `json:"selection"`
}

StoredConfig contains the reproducible runner settings.

type StoredJudgedStep

type StoredJudgedStep struct {
	Run    int         `json:"run"`
	Index  int         `json:"index"`
	Tool   tools.Ident `json:"tool"`
	CallID string      `json:"call_id"`
}

StoredJudgedStep locates a judged step in an attempt's ordered runs.

type StoredJudgment

type StoredJudgment struct {
	ClaimID       string            `json:"claim_id"`
	Subject       string            `json:"subject,omitempty"`
	Step          *StoredJudgedStep `json:"step,omitempty"`
	Label         string            `json:"label"`
	Rationale     string            `json:"rationale"`
	Informational bool              `json:"informational"`
	Uncalibrated  bool              `json:"uncalibrated"`
	Truncated     bool              `json:"truncated"`
	Error         string            `json:"error"`
}

StoredJudgment retains one claim judgment for schema version 1. Step is present only for judgments about a step.

type StoredRun

type StoredRun struct {
	RunID            string         `json:"run_id"`
	SessionID        string         `json:"session_id"`
	TraceID          string         `json:"trace_id"`
	RunError         string         `json:"run_error"`
	EventsUnverified bool           `json:"events_unverified"`
	Final            *model.Message `json:"final"`
	Export           jsontext.Value `json:"export"`
}

StoredRun retains all inputs needed to reconstruct the harness trajectory.

func (StoredRun) Record

func (r StoredRun) Record() (*runrecord.RunRecord, error)

Record restores and verifies the embedded export without a harness or store.

func (StoredRun) Trajectory

func (r StoredRun) Trajectory() (*trajectory.Trajectory, error)

Trajectory reconstructs the exact root trajectory and its child trajectories.

type StoredVariant

type StoredVariant struct {
	ID     string               `json:"id"`
	Labels map[string]string    `json:"labels"`
	Policy *api.PolicyOverrides `json:"policy"`
}

StoredVariant excludes opaque harness options; policy retains its Go field names.

type Subject

type Subject string

Subject selects the evidence evaluated for a claim.

const (
	// SubjectAnswer judges the last run's final message.
	SubjectAnswer Subject = "answer"
	// SubjectTrajectory judges the last run, including its children.
	SubjectTrajectory Subject = "trajectory"
	// SubjectSession judges every run in the conversation.
	SubjectSession Subject = "session"
	// SubjectStep judges each matching root-run call against its preceding context.
	SubjectStep Subject = "step"
)

type ToolDelta

type ToolDelta struct {
	Baseline  ToolSequence `json:"baseline"`
	Candidate ToolSequence `json:"candidate"`
	Edits     []ToolEdit   `json:"edits"`
}

ToolDelta compares modal sequences using a longest common subsequence edit list.

type ToolEdit

type ToolEdit struct {
	Op   string `json:"op"`
	Name string `json:"name"`
}

ToolEdit inserts or removes a tool from the baseline modal sequence.

type ToolSequence

type ToolSequence struct {
	Sequence []string `json:"sequence"`
	Count    int      `json:"count"`
	Total    int      `json:"total"`
}

ToolSequence describes a modal sequence and its share of available attempts.

type Totals

type Totals struct {
	Baseline  GroupStats `json:"baseline"`
	Candidate GroupStats `json:"candidate"`
}

Totals aggregates only the compared groups on each side.

type TrialComparison

type TrialComparison struct {
	Warnings      []Warning    `json:"warnings"`
	OnlyBaseline  []Pair       `json:"only_baseline"`
	OnlyCandidate []Pair       `json:"only_candidate"`
	Groups        []GroupDelta `json:"groups"`
	Totals        Totals       `json:"totals"`
}

TrialComparison pools independent trials without assigning a synthetic experiment identity. Totals include only shared scenario/item cases; repeats are pooled, never paired.

func CompareTrials

func CompareTrials(base, cand []Side) (*TrialComparison, error)

CompareTrials compares nonempty selections of complete single-attempt experiments. Each original experiment/attempt may appear once across both selections. Variant names and repeat numbers remain local to their experiments; cases match by scenario/item. Callers own authorization, selection limits and binding checks.

type VCS

type VCS struct {
	System   string `json:"system"`
	Revision string `json:"revision"`
	Modified bool   `json:"modified"`
	Origin   string `json:"origin"`
}

VCS records source control evidence and where it was detected.

type Variant

type Variant struct {
	ID      string
	Labels  map[string]string
	Policy  *api.PolicyOverrides
	Options []agenttest.Option
}

Variant configures one isolated harness and its run defaults.

type Verdict

type Verdict string

Verdict separates execution errors, quality failures and unjudged gating claims.

const (
	// VerdictUnassessed means a successful probe has no quality assessment.
	VerdictUnassessed Verdict = "unassessed"
	// VerdictPassed means every quality gate passed and no gating claim is pending.
	VerdictPassed Verdict = "passed"
	// VerdictFailed means a check or score threshold failed.
	VerdictFailed Verdict = "failed"
	// VerdictError means execution or harness infrastructure failed.
	VerdictError Verdict = "error"
	// VerdictPending means a gating claim awaits judging.
	VerdictPending Verdict = "pending"
	// VerdictNotRun means the attempt never started.
	VerdictNotRun Verdict = "not_run"
)

type Versions

type Versions struct {
	Go          string `json:"go"`
	MainModule  string `json:"main_module"`
	MainVersion string `json:"main_version"`
	LoomMCP     string `json:"loom_mcp"`
	Loom        string `json:"loom"`
}

Versions records the Go toolchain and relevant module versions.

type Warning

type Warning struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

Warning qualifies a comparison using a stable machine-readable code.

type Writer

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

Writer streams one experiment, retaining the first persistence failure. Methods are concurrency-safe; callbacks run after releasing the writer lock.

func (*Writer) Append

func (w *Writer) Append(r *AttemptRecord) error

Append durably stores one planned attempt. Duplicate indices are rejected.

func (*Writer) CaptureHarness

func (w *Writer) CaptureHarness(factory AttemptHarnessFunc) AttemptHarnessFunc

CaptureHarness binds a planned attempt before factory entry and enables private durable evidence. The factory must forward opts to agenttest.NewHarness. Binding and ignored-option errors are sticky writer errors. Factory errors, including capture initialization errors, remain attempt-local and explicit.

func (*Writer) Err

func (w *Writer) Err() error

Err returns the first persistence failure, if any.

func (*Writer) Finish

func (w *Writer) Finish(report *Report, runErr error) error

Finish atomically replaces attempts from the final report, then commits the summary.

func (*Writer) ID

func (w *Writer) ID() string

ID returns the experiment's canonical UUIDv7.

func (*Writer) OnAttempt

func (w *Writer) OnAttempt(next func(*AttemptRecord)) func(*AttemptRecord)

OnAttempt persists first and invokes next even when persistence fails.

func (*Writer) SetJudge

func (w *Writer) SetJudge(j JudgeInfo)

SetJudge supplies optional judge provenance for Finish.

Directories

Path Synopsis
Package candidate stores versioned, immutable candidate content without runtime execution dependencies.
Package candidate stores versioned, immutable candidate content without runtime execution dependencies.
Package control exposes opt-in scoped candidate, trial and evidence operations.
Package control exposes opt-in scoped candidate, trial and evidence operations.
testfixture
Package testfixture provides an explicitly driven durable host executor for control tests.
Package testfixture provides an explicitly driven durable host executor for control tests.
Package controlcli adds explicitly bound experiment controls to an eval CLI.
Package controlcli adds explicitly bound experiment controls to an eval CLI.
Package evalcli embeds a local experiment CLI in an application's eval program.
Package evalcli embeds a local experiment CLI in an application's eval program.
Package evidence classifies deterministic evidence from exported run records.
Package evidence classifies deterministic evidence from exported run records.
Package gate implements paired release criteria without model or harness I/O.
Package gate implements paired release criteria without model or harness I/O.
Package inspect publishes immutable, authorized experiment evidence.
Package inspect publishes immutable, authorized experiment evidence.
Package judge labels claims against already rendered evaluation subjects.
Package judge labels claims against already rendered evaluation subjects.
Package judging adapts eval outcomes to the rendered-text judge.
Package judging adapts eval outcomes to the rendered-text judge.
Package summaryeval evaluates recorded compaction cuts independently of agent execution.
Package summaryeval evaluates recorded compaction cuts independently of agent execution.
Package testfixture provides executable application hosts for eval contract tests.
Package testfixture provides executable application hosts for eval contract tests.

Jump to

Keyboard shortcuts

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