evaluation

package
v0.20260803.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Overview

Package evaluation is the future home for evaluator session/point runtime, benchmark orchestration, and bench UI/server implementation.

Index

Constants

View Source
const (
	SignalEvaluationDataReady core.Signal = "EvaluationDataReady"
	SignalEvaluationMissing   core.Signal = "EvaluationMissing"
	SignalEvaluationDenied    core.Signal = "EvaluationDenied"
)
View Source
const (
	ArtifactTrace      = "trace.ndjson"
	ArtifactMeta       = "meta.json"
	ArtifactExperiment = "experiment.yaml"
	ArtifactResult     = "result.json"
	ArtifactDocDir     = "doc"
)

Evaluator artifact file names. These form a contract between the evaluator (which writes them) and the bench API (which reads them). All artifacts are written under the per-point directory.

View Source
const (
	SigAgentCommitRecorded core.Signal = "AgentCommitRecorded"
	SigConfigDumped        core.Signal = "ConfigDumped"
)
View Source
const (
	SigOracleCheckPassed    core.Signal = "OracleCheckPassed"
	SigOracleCheckFailed    core.Signal = "OracleCheckFailed"
	SigTraceTokensCollected core.Signal = "TraceTokensCollected"
	SigAgentVersionChecked  core.Signal = "AgentVersionChecked"
	SigAgentVersionMismatch core.Signal = "AgentVersionMismatch"
	SigResultsCollected     core.Signal = "ResultsCollected"
	SigMetricsCollected     core.Signal = "MetricsCollected"
)

Signals emitted by the per-point evaluation commands.

View Source
const (
	SigHarnessFinished core.Signal = "HarnessFinished"
	SigHarnessFailed   core.Signal = "HarnessFailed"
	SigHarnessTimedOut core.Signal = "HarnessTimedOut"
)

Signals emitted by the CLI tool.

View Source
const (
	SigSuiteConfigParsed      core.Signal = "SuiteConfigParsed"
	SigSuiteSamplesDiscovered core.Signal = "SuiteSamplesDiscovered"
	SigEvalGridExpanded       core.Signal = "EvalGridExpanded"
	SigEvalSessionInitialized core.Signal = "EvalSessionInitialized"
	SigSuiteLoaded            core.Signal = "SuiteLoaded"
	SigEvalPointsMaterialized core.Signal = "EvalPointsMaterialized"
	SigPointDone              core.Signal = "PointDone"
	SigPointsCompleted        core.Signal = "PointsCompleted"
	SigSessionReported        core.Signal = "SessionReported"
)

Session-level signals for the evaluator session machine.

View Source
const (
	SigPointDirCreated core.Signal = "PointDirCreated"
	SigDocsPresent     core.Signal = "SampleDocsPresent"
	SigDocsAbsent      core.Signal = "SampleDocsAbsent"
	SigFailureRecorded core.Signal = "PointFailureRecorded"
)

Signals emitted by atomic evaluator workspace preparation commands.

Variables

This section is empty.

Functions

func AgentVersion

func AgentVersion(spans []*Span) string

AgentVersion extracts gen_ai.agent.version from the first span that carries it.

func EvalPointID

func EvalPointID(sample, harness, model string, gridPoint GridPoint, rep int) string

EvalPointID produces the directory name for a single evaluation point.

func FormatGridPoint

func FormatGridPoint(point GridPoint) string

FormatGridPoint returns a stable string representation for directory naming.

func HasAttr

func HasAttr(s *Span, key string) bool

HasAttr returns true if the span has the given attribute key.

func IntAttr

func IntAttr(s *Span, key string) int

IntAttr returns an integer attribute value by key.

func LoadMultiple

func LoadMultiple(dirs []string) (map[GroupKey][]EvalRunResult, error)

LoadMultiple loads and merges results from one or more session directories. Each directory should contain point subdirectories with meta.json files.

func PrintDetailedTable

func PrintDetailedTable(w io.Writer, rows []SampleModelRow)

PrintDetailedTable writes per-(sample, model) rows with convergence counts.

func PrintModelTable

func PrintModelTable(w io.Writer, stats []ModelStats)

PrintModelTable writes a model-level summary table.

func PrintProgression

func PrintProgression(w io.Writer, groups map[GroupKey][]EvalRunResult)

PrintProgression writes per-run tool progression timelines.

func RegisterEvalFactories

func RegisterEvalFactories(br *toolregistry.BuiltinRegistry, deps EvalFactoryDeps)

RegisterEvalFactories registers all evaluator builtin tool factories (session-level: parse_suite_config, discover_suite_samples, expand_eval_grid, init_eval_session, report_suite_summary, materialize_eval_points, run_point, report_session; per-point: create_point_dir, sample_docs, record_agent_commit, dump_config, run_agent, record_oracle_result, collect_trace_tokens, check_agent_version, summarize_point_results, record_point_failure, collect_metrics) into the provided registry.BuiltinRegistry. Session state is lazily initialized on first factory call.

func RegisterEvalPointFactories added in v0.20260724.1

func RegisterEvalPointFactories(br *toolregistry.BuiltinRegistry, es *EvalState)

RegisterEvalPointFactories registers the stateful critic-point words against an existing EvalState. Nested point registries use this hook alongside the unified declaration registry rather than rebuilding a name switch.

func ReportSessionFactory

func ReportSessionFactory(es *EvalSessionState) toolregistry.BuiltinFactory

ReportSessionFactory creates a registry.BuiltinFactory for report_session.

func RunPointFactory

func RunPointFactory(es *EvalSessionState) toolregistry.BuiltinFactory

RunPointFactory creates a registry.BuiltinFactory for run_point. Nested loop parameters (point_machine, point_tools, agent_name, max_iterations, success_state) are read from the tool declaration config block.

func StrAttr

func StrAttr(s *Span, key string) string

StrAttr returns a string attribute value by key.

func WriteCSV

func WriteCSV(path string, groups map[GroupKey][]EvalRunResult) error

WriteCSV writes detailed per-run data as CSV.

Types

type AttrValue

type AttrValue struct {
	Type  string      `json:"Type"`
	Value interface{} `json:"Value"`
}

AttrValue holds a typed attribute value.

type CheckAgentVersionBuilder

type CheckAgentVersionBuilder struct {
	ES *EvalState
}

CheckAgentVersionBuilder creates checkAgentVersionCmd instances.

func (*CheckAgentVersionBuilder) Build

func (*CheckAgentVersionBuilder) BuildReverser added in v0.20260726.0

func (b *CheckAgentVersionBuilder) BuildReverser() core.Command

type CollectMetricsBuilder

type CollectMetricsBuilder struct {
	ES *EvalState
}

CollectMetricsBuilder creates collectMetricsCmd instances.

func (*CollectMetricsBuilder) Build

func (*CollectMetricsBuilder) BuildReverser added in v0.20260726.0

func (b *CollectMetricsBuilder) BuildReverser() core.Command

type CollectTraceTokensBuilder

type CollectTraceTokensBuilder struct {
	ES *EvalState
}

CollectTraceTokensBuilder creates collectTraceTokensCmd instances.

func (*CollectTraceTokensBuilder) Build

func (*CollectTraceTokensBuilder) BuildReverser added in v0.20260726.0

func (b *CollectTraceTokensBuilder) BuildReverser() core.Command

type Convergence

type Convergence string

Convergence classifies how a run's tool metrics evolved.

const (
	Clean      Convergence = "CLEAN"
	Converged  Convergence = "CONVERGED"
	Improving  Convergence = "IMPROVING"
	Flat       Convergence = "FLAT"
	Regressing Convergence = "REGRESSING"
	NoData     Convergence = "NO_DATA"
)

type CreatePointDirBuilder

type CreatePointDirBuilder struct {
	ES *EvalState
}

CreatePointDirBuilder creates createPointDirCmd instances.

func (*CreatePointDirBuilder) Build

func (*CreatePointDirBuilder) BuildReverser added in v0.20260726.0

func (b *CreatePointDirBuilder) BuildReverser() core.Command

type DiscoverSuiteSamplesBuilder

type DiscoverSuiteSamplesBuilder struct {
	ES *EvalSessionState
}

DiscoverSuiteSamplesBuilder creates discoverSuiteSamplesCmd instances.

func (*DiscoverSuiteSamplesBuilder) Build

func (*DiscoverSuiteSamplesBuilder) BuildReverser added in v0.20260726.0

func (b *DiscoverSuiteSamplesBuilder) BuildReverser() core.Command

type DumpConfigBuilder

type DumpConfigBuilder struct {
	ES *EvalState
}

DumpConfigBuilder creates dumpConfigCmd instances.

func (*DumpConfigBuilder) Build

func (*DumpConfigBuilder) BuildReverser added in v0.20260726.0

func (b *DumpConfigBuilder) BuildReverser() core.Command

type EvalFactoryDeps

type EvalFactoryDeps struct {
	Ctx              context.Context
	Registry         *core.Registry
	Stderr           io.Writer
	SuitePath        string
	OutputDir        string
	OllamaURL        string
	ChildAgentBinary string
	CoreRoot         string
	Directory        string
}

EvalFactoryDeps holds the dependencies needed by evaluator tool factories.

type EvalMeta

type EvalMeta struct {
	Harness      string                 `json:"harness"`
	Model        string                 `json:"model"`
	Sample       string                 `json:"sample"`
	GridParams   map[string]interface{} `json:"grid_params"`
	Repetition   int                    `json:"repetition"`
	ExitCode     int                    `json:"exit_code"`
	Duration     time.Duration          `json:"duration_ns"`
	TestsPassed  bool                   `json:"tests_passed"`
	TestOutput   string                 `json:"test_output"`
	TimedOut     bool                   `json:"timed_out"`
	FailureStage string                 `json:"failure_stage,omitempty"`
	FailureCause string                 `json:"failure_cause,omitempty"`
}

EvalMeta records metadata for a single evaluation point.

type EvalRunResult

type EvalRunResult struct {
	Sample      string
	Model       string
	Repetition  int
	TestsPassed bool
	ExitCode    int
	TimedOut    bool
	Iterations  int
	TokensIn    int
	TokensOut   int
	Duration    time.Duration
	Progression *RunProgression
}

EvalRunResult holds all metrics and analysis for a single evaluation run.

type EvalSessionState

type EvalSessionState struct {
	EvalState

	// Configured from CLI flags / tool YAML config
	SuitePath string
	OutputDir string
	Reps      int
	Timeout   time.Duration
	OllamaURL string
	// ChildAgentBinary overrides the harness binary the evaluator launches for
	// each suite profile. Empty means the default "agent" (resolved from PATH).
	ChildAgentBinary string
	CoreRoot         string

	Suite        SuiteConfig
	SessionDir   string
	PointMachine string
	Result       SessionResult
	Stderr       io.Writer
	// contains filtered or unexported fields
}

EvalSessionState holds session-level state for the evaluator session machine. It extends EvalState (which holds the per-point PC) with suite configuration, grid iteration, and result accumulation.

func (*EvalSessionState) ExpandGrid

func (s *EvalSessionState) ExpandGrid()

ExpandGrid materializes the suite's grid into iteration points.

func (*EvalSessionState) FinalizeSession

func (s *EvalSessionState) FinalizeSession()

FinalizeSession sets the total duration on the result.

func (*EvalSessionState) InitSession

func (s *EvalSessionState) InitSession(outputDir string, reps int, timeout time.Duration, ollamaURL string, llmTimeout time.Duration) error

InitSession prepares the session for iteration. Must be called after Suite is populated, samples are discovered, and the grid has been expanded.

func (*EvalSessionState) RecordPoint

func (s *EvalSessionState) RecordPoint(pc *PointContext)

RecordPoint records a completed point's results into the session accumulator.

type EvalState

type EvalState struct {
	PC  *PointContext
	Ctx context.Context
}

EvalState holds shared mutable state for eval tools, analogous to pipeline.State for pipeline tools. The run_point tool sets PC before each point's nested loop runs.

type EvaluationArtifactBuilder added in v0.20260726.0

type EvaluationArtifactBuilder struct {
	Name      string
	Operation string
	DataDir   string
}

EvaluationArtifactBuilder constructs one read-only query over evaluator artifacts. It contains no HTTP routing or profile workflow policy.

func (*EvaluationArtifactBuilder) Build added in v0.20260726.0

type EvaluationModelStat added in v0.20260726.0

type EvaluationModelStat struct {
	Model         string  `json:"model"`
	Runs          int     `json:"runs"`
	Successes     int     `json:"successes"`
	SuccessRate   float64 `json:"successRate"`
	CleanRate     float64 `json:"cleanRate"`
	RecoveryRate  float64 `json:"recoveryRate"`
	StuckRate     float64 `json:"stuckRate"`
	MeanIter      float64 `json:"meanIter"`
	MeanTokensIn  float64 `json:"meanTokensIn"`
	MeanTokensOut float64 `json:"meanTokensOut"`
	MeanDurationS float64 `json:"meanDurationS"`
}

type EvaluationPoint added in v0.20260726.0

type EvaluationPoint struct {
	PointID     string  `json:"pointId"`
	Sample      string  `json:"sample"`
	Model       string  `json:"model"`
	TestsPassed bool    `json:"testsPassed"`
	TimedOut    bool    `json:"timedOut"`
	ExitCode    int     `json:"exitCode"`
	DurationS   float64 `json:"durationS"`
	Iterations  int     `json:"iterations"`
	TokensIn    int     `json:"tokensIn"`
	TokensOut   int     `json:"tokensOut"`
	Convergence string  `json:"convergence"`
}

func ListEvaluationPoints added in v0.20260726.0

func ListEvaluationPoints(dataDir, suite, timestamp string) ([]EvaluationPoint, error)

type EvaluationSampleStat added in v0.20260726.0

type EvaluationSampleStat struct {
	Sample        string  `json:"sample"`
	Model         string  `json:"model"`
	Runs          int     `json:"runs"`
	SuccessRate   float64 `json:"successRate"`
	MeanIter      float64 `json:"meanIter"`
	MeanTokens    float64 `json:"meanTokens"`
	MeanDurationS float64 `json:"meanDurationS"`
}

type EvaluationSessionDetail added in v0.20260726.0

type EvaluationSessionDetail struct {
	ID            string                 `json:"id"`
	ModelStats    []EvaluationModelStat  `json:"modelStats"`
	SampleStats   []EvaluationSampleStat `json:"sampleStats"`
	TotalPoints   int                    `json:"totalPoints"`
	TotalPassed   int                    `json:"totalPassed"`
	TotalFailed   int                    `json:"totalFailed"`
	TotalTimedOut int                    `json:"totalTimedOut"`
}

func AnalyzeEvaluationSession added in v0.20260726.0

func AnalyzeEvaluationSession(dataDir, suite, timestamp string) (EvaluationSessionDetail, error)

type EvaluationSessionSummary added in v0.20260726.0

type EvaluationSessionSummary struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Timestamp    string `json:"timestamp"`
	PointCount   int    `json:"pointCount"`
	PassCount    int    `json:"passCount"`
	FailCount    int    `json:"failCount"`
	TimeoutCount int    `json:"timeoutCount"`
}

func ListEvaluationSessions added in v0.20260726.0

func ListEvaluationSessions(dataDir string) ([]EvaluationSessionSummary, error)

type EvaluationToolSnapshot added in v0.20260726.0

type EvaluationToolSnapshot struct {
	Tool      string `json:"tool"`
	Signal    string `json:"signal"`
	Iteration int    `json:"iteration"`
	Output    string `json:"output,omitempty"`
}

type EvaluationTrace added in v0.20260726.0

type EvaluationTrace struct {
	PointID   string                   `json:"pointId"`
	Spans     []EvaluationTraceSpan    `json:"spans"`
	Snapshots []EvaluationToolSnapshot `json:"snapshots"`
}

func ReadEvaluationTrace added in v0.20260726.0

func ReadEvaluationTrace(dataDir, suite, timestamp, pointID string) (EvaluationTrace, error)

type EvaluationTraceSpan added in v0.20260726.0

type EvaluationTraceSpan struct {
	Name       string  `json:"name"`
	StartTime  string  `json:"startTime"`
	EndTime    string  `json:"endTime"`
	DurationMs float64 `json:"durationMs"`
	ToolName   string  `json:"toolName,omitempty"`
	Signal     string  `json:"signal,omitempty"`
	TokensIn   int     `json:"tokensIn,omitempty"`
	TokensOut  int     `json:"tokensOut,omitempty"`
}

type Event

type Event struct {
	Name       string     `json:"Name"`
	Attributes []KeyValue `json:"Attributes"`
	Time       time.Time  `json:"Time"`
}

Event is a span event with attributes.

type ExpandEvalGridBuilder

type ExpandEvalGridBuilder struct {
	ES *EvalSessionState
}

ExpandEvalGridBuilder creates expandEvalGridCmd instances.

func (*ExpandEvalGridBuilder) Build

func (*ExpandEvalGridBuilder) BuildReverser added in v0.20260726.0

func (b *ExpandEvalGridBuilder) BuildReverser() core.Command

type GridPoint

type GridPoint map[string]interface{}

GridPoint is a single point in the parameter space.

type GroupKey

type GroupKey struct {
	Sample string
	Model  string
}

GroupKey identifies a (sample, model) combination for aggregating runs.

func (GroupKey) String

func (k GroupKey) String() string

String returns a stable key for sorting.

type Harness

type Harness struct {
	Name    string
	Binary  string
	Version string
}

Harness names the child agent binary used for a resolved suite profile.

type InitEvalSessionBuilder

type InitEvalSessionBuilder struct {
	ES *EvalSessionState
}

InitEvalSessionBuilder creates initEvalSessionCmd instances.

func (*InitEvalSessionBuilder) Build

func (*InitEvalSessionBuilder) BuildReverser added in v0.20260726.0

func (b *InitEvalSessionBuilder) BuildReverser() core.Command

type KeyValue

type KeyValue struct {
	Key   string    `json:"Key"`
	Value AttrValue `json:"Value"`
}

KeyValue is an attribute key-value pair.

type MaterializeEvalPointsBuilder added in v0.20260730.0

type MaterializeEvalPointsBuilder struct {
	ES *EvalSessionState
}

MaterializeEvalPointsBuilder creates the complete deterministic point collection.

func (*MaterializeEvalPointsBuilder) Build added in v0.20260730.0

type ModelStats

type ModelStats struct {
	Model         string
	Runs          int
	Successes     int
	SuccessRate   float64
	CleanRate     float64
	RecoveryRate  float64
	StuckRate     float64
	MeanIter      float64
	MeanTokensIn  float64
	MeanTokensOut float64
	MeanDuration  time.Duration
}

ModelStats aggregates convergence metrics across all runs of a model.

func ComputeModelStats

func ComputeModelStats(groups map[GroupKey][]EvalRunResult) []ModelStats

ComputeModelStats builds model-level statistics from grouped results.

type ParseSuiteConfigBuilder

type ParseSuiteConfigBuilder struct {
	ES *EvalSessionState
}

ParseSuiteConfigBuilder creates parseSuiteConfigCmd instances.

func (*ParseSuiteConfigBuilder) Build

func (*ParseSuiteConfigBuilder) BuildReverser added in v0.20260726.0

func (b *ParseSuiteConfigBuilder) BuildReverser() core.Command

type PointContext

type PointContext struct {
	SessionDir  string
	PointID     string
	Sample      Sample
	Harness     Harness
	Model       string
	ProfilePath string
	CoreRoot    string
	GridPoint   GridPoint
	Rep         int
	Timeout     time.Duration
	LLMTimeout  time.Duration
	OllamaURL   string
	Stderr      io.Writer

	// Populated during execution
	PointDir        string
	TracePath       string
	ResultPath      string
	AgentCommit     string
	Tokens          int
	TestsPassed     bool
	TestOutput      string
	TraceVersion    string
	VersionMismatch bool
	TimedOut        bool
	ExitCode        int
	Duration        time.Duration
	FailureStage    string
	FailureCause    string
}

PointContext holds shared mutable state for a single evaluation point. All per-point commands read and write through this struct.

type PointResult

type PointResult struct {
	PointID     string
	Sample      string
	Harness     string
	Model       string
	TestsPassed bool
	TimedOut    bool
	ExitCode    int
	Tokens      int
	Duration    time.Duration
}

PointResult captures the result of a single evaluation point.

type RecordAgentCommitBuilder added in v0.20260724.1

type RecordAgentCommitBuilder struct {
	ES *EvalState
}

RecordAgentCommitBuilder maps a configured rev_parse result into point state.

func (*RecordAgentCommitBuilder) Build added in v0.20260724.1

func (*RecordAgentCommitBuilder) BuildReverser added in v0.20260726.0

func (b *RecordAgentCommitBuilder) BuildReverser() core.Command

type RecordOracleResultBuilder added in v0.20260724.1

type RecordOracleResultBuilder struct {
	ES *EvalState
}

RecordOracleResultBuilder maps the configured oracle exec result into point state.

func (*RecordOracleResultBuilder) Build added in v0.20260724.1

func (*RecordOracleResultBuilder) BuildReverser added in v0.20260726.0

func (b *RecordOracleResultBuilder) BuildReverser() core.Command

type RecordPointFailureBuilder added in v0.20260730.0

type RecordPointFailureBuilder struct {
	ES *EvalState
}

RecordPointFailureBuilder projects a failed result into point state.

func (*RecordPointFailureBuilder) Build added in v0.20260730.0

func (*RecordPointFailureBuilder) BuildReverser added in v0.20260730.0

func (b *RecordPointFailureBuilder) BuildReverser() core.Command

type ReportSessionBuilder

type ReportSessionBuilder struct {
	ES *EvalSessionState
}

ReportSessionBuilder creates reportSessionCmd instances.

func (*ReportSessionBuilder) Build

func (*ReportSessionBuilder) BuildReverser added in v0.20260726.0

func (b *ReportSessionBuilder) BuildReverser() core.Command

type ReportSuiteSummaryBuilder

type ReportSuiteSummaryBuilder struct {
	ES *EvalSessionState
}

ReportSuiteSummaryBuilder creates reportSuiteSummaryCmd instances.

func (*ReportSuiteSummaryBuilder) Build

type RunAgentBuilder

type RunAgentBuilder struct {
	ES *EvalState
}

RunAgentBuilder creates runAgentCmd instances using the PointContext and tool configuration from EvalState.

func (*RunAgentBuilder) Build

func (b *RunAgentBuilder) Build(_ core.Result) core.Command

func (*RunAgentBuilder) BuildReverser added in v0.20260726.0

func (b *RunAgentBuilder) BuildReverser() core.Command

type RunPointBuilder

type RunPointBuilder struct {
	ES            *EvalSessionState
	PointRegistry *core.Registry
	Config        catalog.RunPointConfig
}

RunPointBuilder creates runPointCmd instances.

func (*RunPointBuilder) Build

func (b *RunPointBuilder) Build(_ core.Result) core.Command

func (*RunPointBuilder) BuildReverser added in v0.20260726.0

func (b *RunPointBuilder) BuildReverser() core.Command

type RunProgression

type RunProgression struct {
	Tools   []ToolProgression `json:"tools"`
	Overall Convergence       `json:"overall"`
	Summary string            `json:"summary"`
}

RunProgression holds the full progression analysis for a single run.

func Classify

func Classify(snapshots []ToolSnapshot, succeeded bool) RunProgression

Classify analyzes the sequence of tool snapshots from a run and returns a RunProgression with convergence classification.

type Sample

type Sample struct {
	Name         string
	PromptPath   string
	DocDir       string
	WorkspaceDir string
}

Sample represents a discovered evaluation sample.

func DiscoverSamples

func DiscoverSamples(dir string) ([]Sample, error)

DiscoverSamples finds evaluation samples in the given directory. Each sample is a subdirectory containing a prompt.yaml and a workspace/ dir.

type SampleDocsBuilder added in v0.20260730.0

type SampleDocsBuilder struct {
	ES *EvalState
}

SampleDocsBuilder exposes optional-docs presence and copy parameters.

func (*SampleDocsBuilder) Build added in v0.20260730.0

type SampleModelRow

type SampleModelRow struct {
	Sample       string
	Model        string
	Runs         int
	SuccessRate  float64
	MeanIter     float64
	MeanTokens   float64
	MeanDuration time.Duration
	Convergences map[Convergence]int
}

SampleModelRow is a per-(sample, model) row with progression data.

func ComputeDetailed

func ComputeDetailed(groups map[GroupKey][]EvalRunResult) []SampleModelRow

ComputeDetailed builds per-(sample, model) rows.

type SessionResult

type SessionResult struct {
	TotalPoints int
	Passed      int
	Failed      int
	TimedOut    int
	Duration    time.Duration
	Points      []PointResult
}

SessionResult holds the outcome of an evaluation session.

type Span

type Span struct {
	Name        string     `json:"Name"`
	SpanContext SpanCtx    `json:"SpanContext"`
	Parent      SpanCtx    `json:"Parent"`
	StartTime   time.Time  `json:"StartTime"`
	EndTime     time.Time  `json:"EndTime"`
	Attributes  []KeyValue `json:"Attributes"`
	Events      []Event    `json:"Events"`
}

Span mirrors the Go SDK stdouttrace NDJSON format.

func ParseNDJSON

func ParseNDJSON(data []byte) ([]*Span, error)

ParseNDJSON extracts spans from NDJSON-encoded trace data.

func ReadTraceFile

func ReadTraceFile(path string) ([]*Span, error)

ReadTraceFile parses an NDJSON trace file into spans.

func ToolSpans

func ToolSpans(spans []*Span) []*Span

ToolSpans returns spans representing tool executions, sorted by start time.

type SpanCtx

type SpanCtx struct {
	SpanID string `json:"SpanID"`
}

SpanCtx holds the span identifier.

type SuiteConfig

type SuiteConfig struct {
	Name       string           `yaml:"name"`
	Profiles   []SuiteProfile   `yaml:"-"`
	Grid       map[string][]any `yaml:"grid,omitempty"`
	SamplesDir string           `yaml:"-"`
	Samples    []Sample         `yaml:"-"`
	Timeout    time.Duration    `yaml:"-"`
	OllamaURL  string           `yaml:"-"`
	Reps       int              `yaml:"-"`
}

SuiteConfig defines a complete evaluation suite.

func LoadSuite

func LoadSuite(path string) (SuiteConfig, error)

LoadSuite reads a suite YAML file and resolves its samples.

func ParseSuite

func ParseSuite(data []byte, baseDir string) (SuiteConfig, error)

ParseSuite parses suite YAML and resolves samples relative to baseDir.

func ParseSuiteConfig

func ParseSuiteConfig(data []byte, baseDir string) (SuiteConfig, error)

ParseSuiteConfig parses suite YAML and validates metadata without discovering samples. Runtime evaluator machines compose sample discovery as a separate word after this parser.

type SuiteProfile

type SuiteProfile struct {
	Path    string               `yaml:"path"`
	Name    string               `yaml:"-"`
	Model   string               `yaml:"-"`
	Binary  string               `yaml:"-"`
	Profile catalog.AgentProfile `yaml:"-"`
}

SuiteProfile is a resolved profile entry in a suite configuration. It bundles the profile path with derived metadata for labeling.

type SummarizePointResultsBuilder

type SummarizePointResultsBuilder struct {
	ES *EvalState
}

SummarizePointResultsBuilder creates summarizePointResultsCmd instances.

func (*SummarizePointResultsBuilder) Build

type ToolProgression

type ToolProgression struct {
	Tool        string         `json:"tool"`
	Snapshots   []ToolSnapshot `json:"snapshots"`
	Convergence Convergence    `json:"convergence"`
	Timeline    string         `json:"timeline"`
}

ToolProgression tracks per-tool metrics evolution within a run.

type ToolSnapshot

type ToolSnapshot struct {
	Tool   string `json:"tool"`
	Signal string `json:"signal"`
	Total  int    `json:"total"`
	Passed int    `json:"passed"`
	Failed int    `json:"failed"`
}

ToolSnapshot captures the state of a tool at a single invocation point.

func ExtractToolSnapshots

func ExtractToolSnapshots(spans []*Span) []ToolSnapshot

ExtractToolSnapshots returns a chronological sequence of tool invocation snapshots from trace spans. Prefers structured tool.metrics.* attributes and falls back to text parsing for legacy traces.

Jump to

Keyboard shortcuts

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