Documentation
¶
Index ¶
- Constants
- func AICreditsFromNanoAIU(nanoAIU float64) float64
- func AllGraderKinds() []string
- func CanonicalToolName(name string) string
- func ClassifyEvalSpec(data []byte, path string) (string, string, error)
- func ComputeStdDev(values []float64) float64
- func MatchesToolCallName(declared, observed string) bool
- func ProbeEvaluationOutcomeSchemaVersion(data []byte) (version string, ok bool, err error)
- func UsesJudgeEvidence(graders []GraderConfig, task *TestCase) bool
- func ValidReasoningEffort(effort string) bool
- func ValidateCommandFaultResponse(data []byte, format FaultSourceFormat, enclosingVersion string) error
- func ValidateCommandMocks(mocks []CommandMockConfig) error
- func ValidateCommandMocksSchemaVersion(version string) error
- func ValidateJudgeEvidencePath(name string) error
- func ValidateLockCommit(commit string) error
- func ValidateLockDigest(digest string) error
- func ValidateMCPFaultResponse(data []byte, format FaultSourceFormat, enclosingVersion string) error
- func ValidateMCPFaultResponseWithDelayLimit(data []byte, format FaultSourceFormat, enclosingVersion string, ...) error
- func ValidateMCPInputSchemaOffline(schema any, location string) error
- func ValidateMCPMockResponse(response MCPMockResponse) error
- func ValidateMCPMockResponseWithLoader(response MCPMockResponse, loader jsonschema.URLLoader) error
- func ValidateNativeEvidenceProfile(manifest *EvidenceManifest) error
- func ValidateNativeJSONAdmission(data []byte, target any) error
- func ValidateNativeJSONKeys(data []byte, target any) error
- func ValidateSchemaVersion(artifact, source, version string) (string, error)
- func ValidateTaskFaultSources(data []byte, enclosingVersion string) error
- func WriteLockfile(path string, lock *Lockfile) error
- type AcquiredOfflineDocument
- type ActionSequenceGraderParameters
- type ActionSequenceMatchingMode
- type AdversarialConfig
- type AdversarialOnUnsafeOutcome
- type BehaviorGraderParameters
- type BehaviorRules
- type BenchmarkSpecdeprecated
- type CheckExplanation
- type Checkpoint
- type CheckpointOnFailure
- type CheckpointOutcome
- type CommandInvocation
- type CommandMockConfig
- type CommandMockResponse
- type CommandMockStep
- type Config
- type DependencyMode
- type DiffExpectedFileParameters
- type DiffGraderParameters
- type EvalSpec
- func LoadAcquiredEvalSpec(document *AcquiredOfflineDocument) (*EvalSpec, error)
- func LoadBenchmarkSpec(path string) (*EvalSpec, error)deprecated
- func LoadEvalSpec(path string) (*EvalSpec, error)
- func LoadEvalSpecOffline(path string) (*EvalSpec, error)
- func ParseCapturedEvalSpecOffline(data []byte, path string) (*EvalSpec, error)
- func ParseEvalSpec(data []byte, path string) (*EvalSpec, error)
- func ParseEvalSpecOffline(data []byte, path string, validate func(string, GraderParameters) error) (*EvalSpec, error)
- type EvaluationOutcome
- type EvaluationSessionUsage
- type EvaluationUsage
- type EvidenceArtifact
- type EvidenceDiagnostic
- type EvidenceDigest
- type EvidenceManifest
- type EvidenceOrigin
- type EvidenceRedaction
- type EvidenceReference
- type EvidenceRuntime
- type FailureArtifacts
- type FaultSourceFormat
- type FaultSourceObject
- type FileContentPatternParameters
- type FileGraderParameters
- type GenericGraderParameters
- type GitResource
- type GitResourceType
- type GradeOutcome
- type GraderConfig
- type GraderKind
- type GraderParameters
- type GraderResults
- type GroupStats
- type InlineScriptGraderParameters
- type JSONSchemaGraderParameters
- type JudgeEvidence
- type JudgeEvidenceFile
- type JudgeEvidenceLimits
- type JudgeEvidenceMessage
- type JudgeEvidenceSection
- type JudgeFileCapture
- type Language
- type Lockfile
- type LockfileGrader
- type MCPMockConfig
- type MCPMockResponse
- type MCPMockStep
- type MCPMockTool
- type MeasureResult
- type MeasurementDef
- type MockResponseSource
- type ModelScore
- type ModelUsage
- type MultiSkillSummary
- type OutcomeDigest
- type OutcomeSetup
- type OutcomeSpec
- type OverallSummary
- type PairwiseResult
- type ProgramGraderParameters
- type PromptEvidenceContext
- type PromptGraderMode
- type PromptGraderParameters
- type PromptJudgeObservation
- type Recommendation
- type RecommendationWeights
- type Requirement
- type RequirementCheck
- type RequirementExplanation
- type ResourceRef
- type ResponderConfig
- type ResponderInfo
- type RunResult
- type SessionDigest
- type SkillImpactMetric
- type SkillInvocation
- type SkillInvocationGraderParameters
- type SkillInvocationMatchingMode
- type SkillSummary
- type SpecIdentity
- type StatisticalSummary
- type Status
- type TaskExpectation
- type TaskStimulus
- type TaskTranscript
- type TestCase
- func LoadAcquiredTestCase(document *AcquiredOfflineDocument) (*TestCase, error)
- func LoadTestCase(path string) (*TestCase, error)
- func LoadTestCaseOffline(path string) (*TestCase, error)
- func ParseCapturedTestCaseOffline(data []byte, path string, readFile func(string) ([]byte, error)) (*TestCase, error)
- func ParseTestCase(data []byte, path string) (*TestCase, error)
- func ParseTestCaseOffline(data []byte, path string, validate func(string, GraderParameters) error) (*TestCase, error)
- type TestExpectationdeprecated
- type TestOutcome
- type TestStats
- type TestStimulusdeprecated
- type TextGraderParameters
- type ToolCall
- type ToolCallArgs
- type ToolCallsGraderParameters
- type ToolConstraintGraderParameters
- type ToolEvent
- type ToolExpectation
- type ToolPolicyDenial
- type ToolSpecParameters
- type TranscriptEvent
- type TriggerHeuristicGraderParameters
- type TriggerMetrics
- type TriggerResult
- type UsageStats
- type ValidatorInline
Constants ¶
const ( MaxMockFaultSequenceSteps = 100 MaxMockFaultDelayMS = 300_000 )
const ( JudgeEvidenceVersion = "1.0" JudgeEvidenceMaxFiles = 64 JudgeEvidenceMaxFileBytes = 64 << 10 JudgeEvidenceMaxBytes = 256 << 10 )
const ( ResponderOutcomeStopped = "stopped" ResponderOutcomeAbstained = "abstained" ResponderOutcomeCapExhausted = "cap_exhausted" ResponderOutcomeError = "error" )
Responder outcome values recorded on RunResult.Responder.Outcome.
const ( // UsageProviderCustom indicates request counters came from a BYOK/custom provider. UsageProviderCustom = "custom" // UsageProviderMixed indicates aggregate usage spans different provider routes. UsageProviderMixed = "mixed" )
const ( // CurrentSchemaVersion is the legacy input and reader default. Result // writers use CurrentResultSchemaVersion without changing this contract. // // 1.0 — initial public schema (PR #382 / issue #368). // 1.1 — additive: per-turn checkpoints (TestCase.Checkpoints / RunResult.Checkpoints, #358) // and RunResult.tool_events[] for per-task tool metrics (#366). Purely additive // over 1.0, so 1.0 artifacts continue to load without migration. // 1.2 — additive: RunResult.snapshot_path pointer to a self-contained // snapshot.json artifact (#367), and EvalSpec.adversarial block // declaring fault-injection packs to run (#365). Both fields are // optional, so 1.0 and 1.1 artifacts continue to load without // migration. // 1.3 — additive: session_digest tool_policy_mode and tool_policy_denials (#585). // 1.4 — additive: run command_invocations records for declarative CLI mocks (#634). CurrentSchemaVersion = "1.4" // CurrentResultSchemaVersion applies only to newly generated results. // 1.5 adds task stats.pass_rate_ci and summary statistics success_rate_ci // and pass_hat_k. is_significant is no longer written but still accepted. // 1.6 adds optional run evidence and requirement_explanations. // 1.7 adds frozen judge_evidence, prompt_judging, and separate regrade_usage. // It also adds optional configured dependency modes to each run. CurrentResultSchemaVersion = "1.7" // ScenarioSchemaVersion is eval-only. A major boundary makes older // executables reject no-ambient-discovery semantics instead of ignoring them. // Task and result artifacts retain their existing 1.x format. ScenarioSchemaVersion = "2.0" )
const LockfileName = "waza.lock"
const NanoAIUPerCredit = 1e9
NanoAIUPerCredit is the number of nano-AI units in one GitHub Copilot AI credit.
Variables ¶
This section is empty.
Functions ¶
func AICreditsFromNanoAIU ¶ added in v0.38.9
AICreditsFromNanoAIU converts a nano-AI-unit total reported by the Copilot SDK into AI credits.
func AllGraderKinds ¶
func AllGraderKinds() []string
func CanonicalToolName ¶ added in v0.38.8
CanonicalToolName is the exact, case-insensitive tool-name contract shared by runtime policy enforcement and the allow_only grader. MCP names include the server key (server-tool); a bare tool name never represents an entire server.
func ClassifyEvalSpec ¶ added in v0.39.0
ClassifyEvalSpec checks the canonical eval version and scenario header without decoding grader parameters or loading their resources.
func ComputeStdDev ¶
ComputeStdDev returns the population standard deviation for a slice of float64 values.
func MatchesToolCallName ¶ added in v0.38.8
MatchesToolCallName compares a declaration with a hook/transcript name. These observations may omit source metadata; in that case source isolation relies on the SDK filter, and custom/MCP names match literally without aliases. Permission requests retain their source and use CanonicalToolName directly.
func ProbeEvaluationOutcomeSchemaVersion ¶ added in v0.38.0
ProbeEvaluationOutcomeSchemaVersion cheaply detects whether data has the top-level shape of a results.json artifact and returns its declared version.
func UsesJudgeEvidence ¶ added in v0.39.0
func UsesJudgeEvidence(graders []GraderConfig, task *TestCase) bool
func ValidReasoningEffort ¶ added in v0.38.8
ValidReasoningEffort reports whether effort is supported by the Copilot SDK.
func ValidateCommandFaultResponse ¶ added in v0.39.0
func ValidateCommandFaultResponse(data []byte, format FaultSourceFormat, enclosingVersion string) error
ValidateCommandFaultResponse checks a CLI matcher and any finite source sequence. Sequence eligibility requires the explicit enclosing scenario version.
func ValidateCommandMocks ¶ added in v0.38.9
func ValidateCommandMocks(mocks []CommandMockConfig) error
ValidateCommandMocks validates names, matchers, responses, and call expectations.
func ValidateCommandMocksSchemaVersion ¶ added in v0.38.9
ValidateCommandMocksSchemaVersion checks that the enclosing eval schema supports command mocks.
func ValidateJudgeEvidencePath ¶ added in v0.39.0
func ValidateLockCommit ¶ added in v0.38.6
ValidateLockCommit verifies a lockfile commit pin is an immutable full Git SHA.
func ValidateLockDigest ¶ added in v0.38.6
ValidateLockDigest verifies a lockfile digest uses the canonical sha256 format.
func ValidateMCPFaultResponse ¶ added in v0.39.0
func ValidateMCPFaultResponse(data []byte, format FaultSourceFormat, enclosingVersion string) error
ValidateMCPFaultResponse checks an MCP matcher and any finite source sequence. Callers must run this before serialization can erase zero/null field presence.
func ValidateMCPFaultResponseWithDelayLimit ¶ added in v0.39.0
func ValidateMCPFaultResponseWithDelayLimit(data []byte, format FaultSourceFormat, enclosingVersion string, maxDelayMS int64) error
ValidateMCPFaultResponseWithDelayLimit preserves the wider duration bound used by private adapters without changing the public mock admission limit.
func ValidateMCPInputSchemaOffline ¶ added in v0.39.0
ValidateMCPInputSchemaOffline validates a supplied tool schema without loading external resources. A nil schema retains the runtime's default tool schema.
func ValidateMCPMockResponse ¶ added in v0.39.0
func ValidateMCPMockResponse(response MCPMockResponse) error
ValidateMCPMockResponse validates the existing MCP argument matchers.
func ValidateMCPMockResponseWithLoader ¶ added in v0.39.0
func ValidateMCPMockResponseWithLoader(response MCPMockResponse, loader jsonschema.URLLoader) error
ValidateMCPMockResponseWithLoader preserves the caller's resource policy. A nil loader retains the compiler's legacy default, including file loading. An explicit loader aggregates independent regex and schema failures.
func ValidateNativeEvidenceProfile ¶ added in v0.39.0
func ValidateNativeEvidenceProfile(manifest *EvidenceManifest) error
ValidateNativeEvidenceProfile prevents finite authored inputs from being attributed to historical runs. Full digest validation belongs to evidence.
func ValidateNativeJSONAdmission ¶ added in v0.39.0
ValidateNativeJSONAdmission preserves the typed-key fence for legacy DTOs, but applies whole-document strictness only when evidence is consumed.
func ValidateNativeJSONKeys ¶ added in v0.39.0
ValidateNativeJSONKeys permits same-major unknown fields but never aliases of known native DTO keys. encoding/json otherwise accepts case-insensitive aliases that can overwrite already-seen provenance before profile admission.
func ValidateSchemaVersion ¶ added in v0.38.0
func ValidateTaskFaultSources ¶ added in v0.39.0
ValidateTaskFaultSources checks finite task-level mock responses against the enclosing eval version. Task documents have no independent version field.
func WriteLockfile ¶ added in v0.38.6
Types ¶
type AcquiredOfflineDocument ¶ added in v0.39.0
type AcquiredOfflineDocument struct {
// contains filtered or unexported fields
}
AcquiredOfflineDocument owns bounded, source-bound bytes. Its label is for diagnostics only and is never reopened by the selected native decoders.
func AcquireOfflineDocument ¶ added in v0.39.0
func AcquireOfflineDocument(label, expectedSHA string, data []byte) (*AcquiredOfflineDocument, error)
type ActionSequenceGraderParameters ¶
type ActionSequenceGraderParameters struct {
MatchingMode ActionSequenceMatchingMode `yaml:"matching_mode,omitempty" json:"matching_mode,omitempty"`
ExpectedActions []string `yaml:"expected_actions,omitempty" json:"expected_actions,omitempty"`
}
type ActionSequenceMatchingMode ¶
type ActionSequenceMatchingMode string
ActionSequenceMatchingMode controls how actual tool calls are compared to expected actions.
const ( ActionSequenceMatchingModeExact ActionSequenceMatchingMode = "exact_match" ActionSequenceMatchingModeInOrder ActionSequenceMatchingMode = "in_order_match" ActionSequenceMatchingModeAnyOrder ActionSequenceMatchingMode = "any_order_match" )
type AdversarialConfig ¶ added in v0.38.0
type AdversarialConfig struct {
// Packs is the list of built-in pack identifiers to run (e.g.
// "prompt-injection", "scope-bypass"). Unknown identifiers are rejected
// by `waza adversarial`; the current schema does not support
// out-of-tree custom packs. Required; must contain at least one entry.
Packs []string `yaml:"packs" json:"packs"`
// OnUnsafeOutcome controls whether unsafe outcomes fail the run
// ("fail", default) or only warn ("warn"). When empty, "fail" is used.
OnUnsafeOutcome AdversarialOnUnsafeOutcome `yaml:"on_unsafe_outcome,omitempty" json:"on_unsafe_outcome,omitempty"`
}
AdversarialConfig declares offline adversarial / fault-injection packs to run against the skill under test. Packs ship as deterministic, embedded YAML + fixture bundles so they execute identically in CI without any live payload generation. See `waza adversarial` for the runner.
func (*AdversarialConfig) EffectiveOnUnsafeOutcome ¶ added in v0.38.0
func (a *AdversarialConfig) EffectiveOnUnsafeOutcome() AdversarialOnUnsafeOutcome
EffectiveOnUnsafeOutcome returns the configured policy, defaulting to AdversarialOnUnsafeOutcomeFail when unset.
func (*AdversarialConfig) Validate ¶ added in v0.38.0
func (a *AdversarialConfig) Validate() error
Validate checks the adversarial config has at least one pack and that the on_unsafe_outcome policy is one of the supported values. Pack names are normalized in-place (whitespace trimmed) so downstream lookups see the canonical form regardless of YAML formatting.
type AdversarialOnUnsafeOutcome ¶ added in v0.38.0
type AdversarialOnUnsafeOutcome string
AdversarialOnUnsafeOutcome controls how unsafe outcomes from adversarial packs are reported to the caller. It is consumed by `waza adversarial` to decide whether an unsafe outcome should fail CI or only warn.
const ( // AdversarialOnUnsafeOutcomeFail (default) makes any unsafe outcome a hard // failure: `waza adversarial` exits with code 2 (matching `waza gate`'s // golden-failure exit) so a single CI step can gate both signals. AdversarialOnUnsafeOutcomeFail AdversarialOnUnsafeOutcome = "fail" // AdversarialOnUnsafeOutcomeWarn keeps the exit code at zero and only // records the unsafe outcome in the results.json + stderr summary. AdversarialOnUnsafeOutcomeWarn AdversarialOnUnsafeOutcome = "warn" )
type BehaviorGraderParameters ¶
type BehaviorGraderParameters struct {
MaxToolCalls int `yaml:"max_tool_calls,omitempty" json:"max_tool_calls,omitempty"`
MaxTokens int `yaml:"max_tokens,omitempty" json:"max_tokens,omitempty"`
RequiredTools []string `yaml:"required_tools,omitempty" json:"required_tools,omitempty"`
ForbiddenTools []string `yaml:"forbidden_tools,omitempty" json:"forbidden_tools,omitempty"`
MaxDurationMS int64 `yaml:"max_duration_ms,omitempty" json:"max_duration_ms,omitempty"`
}
type BehaviorRules ¶
type BehaviorRules struct {
MaxToolInvocations int `yaml:"max_tool_calls,omitempty" json:"max_tool_invocations,omitempty"`
MaxRounds int `yaml:"max_iterations,omitempty" json:"max_rounds,omitempty"`
MaxTokens int `yaml:"max_tokens,omitempty" json:"max_tokens,omitempty"`
MaxResponseTimeMs int64 `yaml:"max_response_time_ms,omitempty" json:"max_response_time_ms,omitempty"`
MustUseTool []string `yaml:"required_tools,omitempty" json:"must_use_tool,omitempty"`
ForbidTool []string `yaml:"forbidden_tools,omitempty" json:"forbid_tool,omitempty"`
}
type BenchmarkSpec
deprecated
type BenchmarkSpec = EvalSpec
Deprecated: Use EvalSpec instead.
type CheckExplanation ¶ added in v0.39.0
type CheckExplanation struct {
Check RequirementCheck `json:"check"`
Observation string `json:"observation"`
Category string `json:"category"`
Message string `json:"message"`
References []EvidenceReference `json:"references,omitempty"`
}
type Checkpoint ¶ added in v0.38.0
type Checkpoint struct {
// AfterTurn is the 1-based turn index at whose boundary the graders run.
// Turn 1 is the initial prompt; turns 2..N are follow-ups or responder
// replies. Must be >= 1.
AfterTurn int `yaml:"after_turn" json:"after_turn"`
// Graders is the slice of grader configurations to run at this turn
// boundary. Required. Reuses the same ValidatorInline shape as task-level
// `graders:` so any existing grader type is supported.
Graders []ValidatorInline `yaml:"graders" json:"graders"`
// OnFailure controls multi-turn behavior when any grader in this
// checkpoint fails. "continue" (default) records the failure and keeps
// going. "stop" short-circuits the multi-turn loop after the failure.
OnFailure CheckpointOnFailure `yaml:"on_failure,omitempty" json:"on_failure,omitempty"`
}
Checkpoint runs a slice of graders against the conversation state at the end of a specific turn. See TestCase.Checkpoints for details.
func (*Checkpoint) EffectiveOnFailure ¶ added in v0.38.0
func (c *Checkpoint) EffectiveOnFailure() CheckpointOnFailure
EffectiveOnFailure returns the OnFailure value to use, defaulting to CheckpointContinue when unset.
func (*Checkpoint) Validate ¶ added in v0.38.0
func (c *Checkpoint) Validate() error
Validate checks the checkpoint has the required fields. Reuses ValidatorInline.Validate for inner grader validation.
type CheckpointOnFailure ¶ added in v0.38.0
type CheckpointOnFailure string
CheckpointOnFailure controls multi-turn behavior when a checkpoint fails.
const ( // CheckpointContinue (default) records the failure and continues with the // remaining turns and the final grader pass. CheckpointContinue CheckpointOnFailure = "continue" // CheckpointStop records the failure, sets the run's error message, and // short-circuits the multi-turn loop so no further turns execute. CheckpointStop CheckpointOnFailure = "stop" )
type CheckpointOutcome ¶ added in v0.38.0
type CheckpointOutcome struct {
// AfterTurn echoes Checkpoint.AfterTurn so consumers can sort/group.
AfterTurn int `json:"after_turn"`
// Status is StatusPassed when every grader in this checkpoint passed,
// StatusFailed when at least one grader failed.
Status Status `json:"status"`
// Validations maps grader identifier to result, identical to
// RunResult.Validations.
Validations map[string]GraderResults `json:"validations"`
// Stopped is true when this checkpoint had `on_failure: stop` and at
// least one grader failed, terminating the multi-turn loop after this
// turn.
Stopped bool `json:"stopped,omitempty"`
}
CheckpointOutcome captures the results of a single TestCase.Checkpoint that ran during a multi-turn run. It mirrors the shape of the final-grader validations map so dashboards can present per-turn pass/fail uniformly.
type CommandInvocation ¶ added in v0.38.9
type CommandInvocation struct {
Command string `json:"command"`
Args []string `json:"args,omitempty"`
// A started attempt interrupted before completion has no observed exit code.
ExitCode *int `json:"exit_code,omitempty"`
ResponseIndex int `json:"response_index"`
}
CommandInvocation records a sanitized invocation of a mocked executable.
type CommandMockConfig ¶ added in v0.38.9
type CommandMockConfig struct {
Name string `yaml:"name" json:"name"`
Responses []CommandMockResponse `yaml:"responses" json:"responses"`
ExpectCalls *int `yaml:"expect_calls,omitempty" json:"expect_calls,omitempty"`
}
CommandMockConfig defines deterministic responses for one executable.
type CommandMockResponse ¶ added in v0.38.9
type CommandMockResponse struct {
Args []string `yaml:"args,omitempty" json:"args,omitempty"`
ArgsRegex []string `yaml:"args_regex,omitempty" json:"args_regex,omitempty"`
Environment map[string]string `yaml:"environment,omitempty" json:"environment,omitempty"`
WorkDir string `yaml:"workdir,omitempty" json:"workdir,omitempty"`
Stdout any `yaml:"stdout,omitempty" json:"stdout,omitempty"`
Stderr string `yaml:"stderr,omitempty" json:"stderr,omitempty"`
ExitCode int `yaml:"exit_code,omitempty" json:"exit_code,omitempty"`
Fixture string `yaml:"fixture,omitempty" json:"fixture,omitempty"`
Sequence []CommandMockStep `yaml:"sequence,omitempty" json:"sequence,omitempty"`
}
CommandMockResponse matches one invocation and supplies its process output.
type CommandMockStep ¶ added in v0.39.0
type CommandMockStep struct {
Stdout any `yaml:"stdout,omitempty" json:"stdout,omitempty"`
Stderr string `yaml:"stderr,omitempty" json:"stderr,omitempty"`
ExitCode int `yaml:"exit_code" json:"exit_code"`
Fixture string `yaml:"fixture,omitempty" json:"fixture,omitempty"`
DelayMS int64 `yaml:"delay_ms,omitempty" json:"delay_ms,omitempty"`
}
type Config ¶
type Config struct {
TrialsPerTask int `yaml:"trials_per_task" json:"runs_per_test"`
TimeoutSec int `yaml:"timeout_seconds" json:"timeout_sec"`
// FirstEventTimeoutSec bounds how long to wait for the first session event
// before treating a run as a session-start hang (the engine launched but
// never started the agent's first turn). It is much shorter than
// TimeoutSec, which must cover the slowest legitimate full turn. 0 (the
// default) disables the check. Per-task overrides live on TestCase.
FirstEventTimeoutSec int `yaml:"first_event_timeout_seconds,omitempty" json:"first_event_timeout_sec,omitempty"`
Concurrent bool `yaml:"parallel" json:"concurrent"`
Workers int `yaml:"workers,omitempty" json:"workers,omitempty"`
StopOnError bool `yaml:"fail_fast,omitempty" json:"stop_on_error,omitempty"`
EngineType string `yaml:"executor" json:"engine_type"`
ModelID string `yaml:"model" json:"model_id"`
ReasoningEffort string `yaml:"reasoning_effort,omitempty" json:"reasoning_effort,omitempty"`
SkillPaths []string `yaml:"skill_directories,omitempty" json:"skill_paths,omitempty"`
InstructionFiles []string `yaml:"instruction_files,omitempty" json:"instruction_files,omitempty"`
InjectSkillBody *bool `yaml:"inject_skill_body,omitempty" json:"inject_skill_body,omitempty"`
TriggerSkillRouting bool `yaml:"trigger_skill_routing,omitempty" json:"trigger_skill_routing,omitempty"`
DisabledSkills []string `yaml:"disabled_skills,omitempty" json:"disabled_skills,omitempty"`
RequiredSkills []string `yaml:"required_skills,omitempty" json:"required_skills,omitempty"`
ServerConfigs map[string]any `yaml:"mcp_servers,omitempty" json:"server_configs,omitempty"`
MaxAttempts int `yaml:"max_attempts,omitempty" json:"max_attempts,omitempty"`
GroupBy string `yaml:"group_by,omitempty" json:"group_by,omitempty"`
JudgeModel string `yaml:"judge_model,omitempty" json:"judge_model,omitempty"`
JudgeReasoningEffort string `yaml:"judge_reasoning_effort,omitempty" json:"judge_reasoning_effort,omitempty"`
}
Config controls execution behavior
func (*Config) AllSkillsDisabled ¶ added in v0.29.0
AllSkillsDisabled returns true when skills should be completely disabled.
func (*Config) FilteredSkillPaths ¶ added in v0.29.0
FilteredSkillPaths returns SkillPaths with any disabled skill directories removed.
func (*Config) ShouldInjectSkillBody ¶ added in v0.37.0
ShouldInjectSkillBody returns true unless the eval explicitly opts out of injecting the target skill body into the system prompt.
func (*Config) ShouldTriggerSkillRouting ¶ added in v0.38.8
ShouldTriggerSkillRouting returns true when the eval explicitly opts into the trigger-precision routing control. It is only active when the target skill body is not injected; ordinary skill-body evals keep their prior behavior even if the flag is set.
type DependencyMode ¶ added in v0.39.0
type DependencyMode struct {
Kind string `json:"kind"`
Name string `json:"name"`
Mode string `json:"mode"`
}
DependencyMode records the configured mode for a declared dependency. It describes configuration, not proof that the dependency was invoked.
type DiffExpectedFileParameters ¶
type DiffExpectedFileParameters struct {
// Path is the workspace-relative path to the file being checked.
Path string `yaml:"path" json:"path"`
// Snapshot is the path (relative to context/fixtures dir) of the expected file content.
// When set, the workspace file must match this snapshot exactly.
Snapshot string `yaml:"snapshot,omitempty" json:"snapshot,omitempty"`
// Contains lists line fragments that must appear in the workspace file.
// Prefixed with "+" means the line must be present; "-" means it must be absent.
Contains []string `yaml:"contains,omitempty" json:"contains,omitempty"`
}
DiffExpectedFileParameters defines a single file expectation for the diff grader. Either Snapshot or Contains (or both) must be specified.
type DiffGraderParameters ¶
type DiffGraderParameters struct {
ExpectedFiles []DiffExpectedFileParameters `yaml:"expected_files,omitempty" json:"expected_files,omitempty"`
ContextDir string `yaml:"context_dir,omitempty" json:"context_dir,omitempty"`
UpdateSnapshots bool `yaml:"update_snapshots,omitempty" json:"update_snapshots,omitempty"`
}
type EvalSpec ¶ added in v0.31.0
type EvalSpec struct {
SchemaVersion string `yaml:"schemaVersion,omitempty" json:"schemaVersion,omitempty"`
SpecIdentity `yaml:",inline"`
Scenario string `yaml:"scenario,omitempty" json:"scenario,omitempty"`
SkillName string `yaml:"skill"`
Version string `yaml:"version"`
Config Config `yaml:"config"`
Hooks hooks.HooksConfig `yaml:"hooks,omitempty"`
MCPMocks []MCPMockConfig `yaml:"mcp_mocks,omitempty" json:"mcp_mocks,omitempty"`
CommandMocks []CommandMockConfig `yaml:"command_mocks,omitempty" json:"command_mocks,omitempty"`
Adversarial *AdversarialConfig `yaml:"adversarial,omitempty" json:"adversarial,omitempty"`
Inputs map[string]string `yaml:"inputs,omitempty" json:"inputs,omitempty"`
TasksFrom string `yaml:"tasks_from,omitempty" json:"tasks_from,omitempty"`
Range [2]int `yaml:"range,omitempty" json:"range,omitempty"`
Graders []GraderConfig `yaml:"graders"`
Metrics []MeasurementDef `yaml:"metrics"`
Tasks []string `yaml:"tasks"`
Baseline bool `yaml:"baseline,omitempty" json:"baseline,omitempty"`
// contains filtered or unexported fields
}
EvalSpec represents a complete evaluation specification.
Deprecated alias: BenchmarkSpec is provided for backward compatibility.
func LoadAcquiredEvalSpec ¶ added in v0.39.0
func LoadAcquiredEvalSpec(document *AcquiredOfflineDocument) (*EvalSpec, error)
func LoadBenchmarkSpec
deprecated
func LoadEvalSpec ¶ added in v0.31.0
LoadEvalSpec loads a spec from a YAML file with strict validation.
Normally the schema validation will catch errors in the eval.yaml, but this also does strict YAML parsing to catch errors like unknown fields or type errors that the schema validation might miss.
func LoadEvalSpecOffline ¶ added in v0.39.0
LoadEvalSpecOffline guards eager schema dependencies before native decoding. An unavailable dependency returns an error rather than a partial EvalSpec.
func ParseCapturedEvalSpecOffline ¶ added in v0.39.0
ParseCapturedEvalSpecOffline decodes captured bytes with the same offline schema guards as LoadEvalSpecOffline, without reopening the source.
func ParseEvalSpec ¶ added in v0.39.0
ParseEvalSpec retains the runtime loader behavior of LoadEvalSpec. Offline consumers must guard resource-bearing parameters before typed decode.
func ParseEvalSpecOffline ¶ added in v0.39.0
func ParseEvalSpecOffline(data []byte, path string, validate func(string, GraderParameters) error) (*EvalSpec, error)
ParseEvalSpecOffline examines immutable bytes with offline schema loading. validate checks static configuration when external dependencies block native decode.
func (*EvalSpec) ResolveTestFiles ¶ added in v0.31.0
ResolveTestFiles expands glob patterns to actual test files
func (*EvalSpec) SkillsDisabledForTask ¶ added in v0.39.0
SkillsDisabledForTask keeps scenario-only runs independent of ambient skills. Legacy suites retain discovery; explicit scenario context opts back in.
func (*EvalSpec) SourceBytes ¶ added in v0.39.0
SourceBytes returns the immutable input document, not normalized model JSON.
type EvaluationOutcome ¶
type EvaluationOutcome struct {
SchemaVersion string `json:"schemaVersion"`
RunID string `json:"eval_id"`
SkillTested string `json:"skill"`
BenchName string `json:"eval_name"`
Timestamp time.Time `json:"timestamp"`
Setup OutcomeSetup `json:"config"`
Digest OutcomeDigest `json:"summary"`
Measures map[string]MeasureResult `json:"metrics"`
TestOutcomes []TestOutcome `json:"tasks"`
TriggerMetrics *TriggerMetrics `json:"trigger_metrics,omitempty"`
TriggerResults []TriggerResult `json:"trigger_results,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
IsBaseline bool `json:"is_baseline,omitempty"`
BaselineOutcome *EvaluationOutcome `json:"baseline_outcome,omitempty"`
// EvaluationUsage is present for current evaluations, including cache-only
// runs. Its sessions, not cached task diagnostics, define billing scope.
EvaluationUsage *EvaluationUsage `json:"evaluation_usage,omitempty"`
RegradeUsage *EvaluationUsage `json:"regrade_usage,omitempty"`
// contains filtered or unexported fields
}
EvaluationOutcome represents the complete result of an evaluation run
func LoadEvaluationOutcome ¶ added in v0.38.0
func LoadEvaluationOutcome(path string) (*EvaluationOutcome, error)
LoadEvaluationOutcome loads a results.json file with schema-version compatibility checks.
func ParseEvaluationOutcome ¶ added in v0.38.0
func ParseEvaluationOutcome(data []byte, source string) (*EvaluationOutcome, error)
ParseEvaluationOutcome decodes results while preserving declared versions. A missing version retains the legacy reader default, not the writer version.
func (EvaluationOutcome) HasSkillTested ¶ added in v0.39.0
func (o EvaluationOutcome) HasSkillTested() bool
HasSkillTested distinguishes a recorded blank string from unavailable legacy metadata.
func (EvaluationOutcome) MarshalJSON ¶ added in v0.38.0
func (o EvaluationOutcome) MarshalJSON() ([]byte, error)
func (EvaluationOutcome) ShallowCopy ¶ added in v0.39.0
func (o EvaluationOutcome) ShallowCopy() *EvaluationOutcome
ShallowCopy preserves recorded field presence and all outcome metadata. Callers must replace shared collections before modifying their contents.
type EvaluationSessionUsage ¶ added in v0.38.9
type EvaluationSessionUsage struct {
SessionID string `json:"session_id,omitempty"`
Usage *UsageStats `json:"usage,omitempty"`
InitialUsage *UsageStats `json:"initial_usage,omitempty"`
UnknownBaseline bool `json:"unknown_baseline,omitempty"`
Cumulative bool `json:"cumulative,omitempty"`
UsageRevision uint64 `json:"usage_revision,omitempty"`
}
type EvaluationUsage ¶ added in v0.38.9
type EvaluationUsage struct {
Sessions []EvaluationSessionUsage `json:"sessions"`
}
type EvidenceArtifact ¶ added in v0.39.0
type EvidenceArtifact struct {
ID string `json:"id"`
Kind string `json:"kind"`
Availability string `json:"availability"`
Completeness string `json:"completeness"`
Document string `json:"document,omitempty"`
Pointer string `json:"pointer,omitempty"`
ContentDigest *EvidenceDigest `json:"content_digest,omitempty"`
SourceDigest *EvidenceDigest `json:"source_digest,omitempty"`
Reason string `json:"reason,omitempty"`
Redacted bool `json:"redacted,omitempty"`
}
type EvidenceDiagnostic ¶ added in v0.39.0
type EvidenceDigest ¶ added in v0.39.0
type EvidenceManifest ¶ added in v0.39.0
type EvidenceManifest struct {
Version string `json:"version"`
SHA256 string `json:"sha256"`
SourceManifestSHA256 string `json:"source_manifest_sha256,omitempty"`
Origin EvidenceOrigin `json:"origin"`
Runtime EvidenceRuntime `json:"runtime"`
Redaction EvidenceRedaction `json:"redaction"`
Artifacts []EvidenceArtifact `json:"artifacts"`
Diagnostics []EvidenceDiagnostic `json:"diagnostics,omitempty"`
// contains filtered or unexported fields
}
EvidenceManifest is descriptive provenance, not an enforcement or assurance verdict. Its version is independent of the result and snapshot schemas.
func (*EvidenceManifest) HasInvalidRequiredObjects ¶ added in v0.39.0
func (m *EvidenceManifest) HasInvalidRequiredObjects() bool
func (*EvidenceManifest) HasInvalidSchema ¶ added in v0.39.0
func (m *EvidenceManifest) HasInvalidSchema() bool
func (*EvidenceManifest) HasUnknownFields ¶ added in v0.39.0
func (m *EvidenceManifest) HasUnknownFields() bool
func (EvidenceManifest) MarshalJSON ¶ added in v0.39.0
func (m EvidenceManifest) MarshalJSON() ([]byte, error)
func (*EvidenceManifest) UnmarshalJSON ¶ added in v0.39.0
func (m *EvidenceManifest) UnmarshalJSON(data []byte) error
type EvidenceOrigin ¶ added in v0.39.0
type EvidenceRedaction ¶ added in v0.39.0
type EvidenceReference ¶ added in v0.39.0
type EvidenceReference struct {
Origin EvidenceOrigin `json:"origin"`
ArtifactID string `json:"artifact_id"`
Pointer string `json:"pointer,omitempty"`
}
References resolve only inside the manifest with the matching full origin.
type EvidenceRuntime ¶ added in v0.39.0
type EvidenceRuntime struct {
WazaVersion string `json:"waza_version"`
RequestedEngine string `json:"requested_engine"`
RequestedModel string `json:"requested_model"`
ExecutionMode string `json:"execution_mode"`
DependencyMode string `json:"dependency_mode"`
RequestedPolicy string `json:"requested_policy"`
VerifiedEnforcement string `json:"verified_enforcement"`
GoVersion string `json:"go_version"`
Platform string `json:"platform"`
SDKVersion *string `json:"sdk_version"`
EffectiveModelVersion *string `json:"effective_model_version"`
NoSkills *bool `json:"no_skills"`
NativeSkillControl string `json:"native_skill_control"`
}
type FailureArtifacts ¶ added in v0.37.0
type FailureArtifacts struct {
StdErr string `json:"stderr,omitempty"`
StdOut string `json:"stdout,omitempty"`
ExitCode int `json:"exit_code,omitempty"`
FailedGraders []string `json:"failed_graders,omitempty"`
ErrorPatterns []string `json:"error_patterns,omitempty"`
TriageSummary string `json:"triage_summary,omitempty"`
CapturedAt time.Time `json:"captured_at"`
Context map[string]string `json:"context,omitempty"`
}
FailureArtifacts captures diagnostic information when a run fails
type FaultSourceFormat ¶ added in v0.39.0
type FaultSourceFormat string
FaultSourceFormat identifies the encoding of an unnormalized fault response.
const ( FaultSourceJSON FaultSourceFormat = "json" FaultSourceYAML FaultSourceFormat = "yaml" )
type FaultSourceObject ¶ added in v0.39.0
type FaultSourceObject map[string]json.RawMessage
FaultSourceObject preserves raw response field presence before typed decoding.
func DecodeFaultObject ¶ added in v0.39.0
func DecodeFaultObject(data []byte) (FaultSourceObject, []string, error)
DecodeFaultObject preserves raw JSON fields, reporting duplicate keys while retaining their last values for legacy response decoding.
func DecodeFaultSource ¶ added in v0.39.0
func DecodeFaultSource(data []byte, format FaultSourceFormat) (FaultSourceObject, []string, error)
DecodeFaultSource decodes raw response fields and reports duplicate JSON keys. YAML aliases and merges are resolved before checking integer field types.
type FileGraderParameters ¶
type FileGraderParameters struct {
MustExist []string `yaml:"must_exist,omitempty" json:"must_exist,omitempty"`
MustNotExist []string `yaml:"must_not_exist,omitempty" json:"must_not_exist,omitempty"`
ContentPatterns []FileContentPatternParameters `yaml:"content_patterns,omitempty" json:"content_patterns,omitempty"`
}
type GenericGraderParameters ¶
GenericGraderParameters is used for unknown kinds to preserve raw config values.
type GitResource ¶ added in v0.37.0
type GitResource struct {
// Type selects the materialization strategy. Required. Only "worktree"
// is currently supported.
Type GitResourceType `yaml:"type" json:"type"`
// Source is the local path to a git repository. Required for the
// "worktree" strategy.
Source string `yaml:"source" json:"source"`
// Commit is an optional commit SHA, branch, or tag to check out.
// Defaults to the source repo's HEAD when empty.
Commit string `yaml:"commit,omitempty" json:"commit,omitempty"`
// Dest is an optional subdirectory under the workspace to materialize
// the repo into. When empty, the repo is materialized at the workspace
// root. Must be a relative path that does not escape the workspace.
Dest string `yaml:"dest,omitempty" json:"dest,omitempty"`
}
GitResource describes a git repository to materialize into the per-task workspace before the agent runs. Currently only the `worktree` strategy is supported; additional strategies (e.g. HTTPS clone) can be added later without breaking the YAML surface.
func (*GitResource) Validate ¶ added in v0.37.0
func (g *GitResource) Validate() error
Validate verifies that the git resource has the required fields and that its destination path is safe (relative, no traversal segments).
type GitResourceType ¶ added in v0.37.0
type GitResourceType string
GitResourceType identifies how a git resource is materialized.
const ( // GitResourceTypeWorktree materializes the resource via `git worktree add` // against a local source repository. It is cheap and requires no network. GitResourceTypeWorktree GitResourceType = "worktree" )
type GradeOutcome ¶ added in v0.22.0
type GradeOutcome struct {
OverallScore float64 `json:"overall_score"`
Passed bool `json:"passed"`
Tasks map[string]GradeOutcome `json:"tasks,omitempty"`
GraderAverages map[string]float64 `json:"grader_averages,omitempty"`
Status Status `json:"status,omitempty"`
Error string `json:"error,omitempty"`
}
func (GradeOutcome) MarshalJSON ¶ added in v0.39.0
func (g GradeOutcome) MarshalJSON() ([]byte, error)
type GraderConfig ¶
type GraderConfig struct {
Ref string `yaml:"ref,omitempty" json:"ref,omitempty"`
Kind GraderKind `yaml:"type" json:"kind"`
Identifier string `yaml:"name" json:"identifier"`
ScriptPath string `yaml:"script,omitempty" json:"script_path,omitempty"`
Rubric string `yaml:"rubric,omitempty" json:"rubric,omitempty"`
ModelID string `yaml:"model,omitempty" json:"model_id,omitempty"`
Weight float64 `yaml:"weight,omitempty" json:"weight,omitempty"`
Parameters GraderParameters `yaml:"config,omitempty" json:"parameters,omitempty"`
}
GraderConfig defines a validator/grader
func DecodeGraderConfigOffline ¶ added in v0.39.0
func DecodeGraderConfigOffline(data []byte, validators ...func(string, GraderParameters) error) (GraderConfig, error)
DecodeGraderConfigOffline guards cached/merged grader declarations before their native argument matcher decoder can load external schema resources. Validators inspect retained tool parameters when external schemas block decode.
func (*GraderConfig) EffectiveWeight ¶
func (g *GraderConfig) EffectiveWeight() float64
EffectiveWeight returns the grader weight, defaulting to 1.0 if unset.
func (*GraderConfig) UnmarshalYAML ¶
func (g *GraderConfig) UnmarshalYAML(node *yaml.Node) error
func (*GraderConfig) Validate ¶ added in v0.26.0
func (g *GraderConfig) Validate() error
Validate checks that the grader config has required fields for its type.
type GraderKind ¶
type GraderKind string
GraderKind identifies the type of grader (e.g. regex, file, code).
const ( GraderKindInlineScript GraderKind = "code" GraderKindPrompt GraderKind = "prompt" GraderKindText GraderKind = "text" GraderKindFile GraderKind = "file" GraderKindJSONSchema GraderKind = "json_schema" GraderKindProgram GraderKind = "program" GraderKindBehavior GraderKind = "behavior" GraderKindActionSequence GraderKind = "action_sequence" GraderKindSkillInvocation GraderKind = "skill_invocation" GraderKindTrigger GraderKind = "trigger" GraderKindDiff GraderKind = "diff" GraderKindToolConstraint GraderKind = "tool_constraint" GraderKindToolCalls GraderKind = "tool_calls" )
type GraderParameters ¶
type GraderParameters interface {
// contains filtered or unexported methods
}
GraderParameters is a polymorphic grader config payload decoded from YAML based on GraderKind.
type GraderResults ¶
type GraderResults struct {
Name string `json:"identifier"`
Type GraderKind `json:"type"`
Score float64 `json:"score"`
Weight float64 `json:"weight"`
Passed bool `json:"passed"`
Feedback string `json:"feedback"`
Details map[string]any `json:"details,omitempty"`
DurationMs int64 `json:"duration_ms"`
}
type GroupStats ¶
type GroupStats struct {
Name string `json:"name"`
Passed int `json:"passed"`
Total int `json:"total"`
AvgScore float64 `json:"avg_score"`
}
GroupStats holds aggregate statistics for a group of test outcomes.
type JSONSchemaGraderParameters ¶
type JSONSchemaGraderParameters struct {
// Schema is an inline JSON schema object used for validation.
Schema map[string]any `yaml:"schema,omitempty" json:"schema,omitempty"`
// SchemaFile is a path to a JSON schema file. Used when Schema is not provided.
SchemaFile string `yaml:"schema_file,omitempty" json:"schema_file,omitempty"`
// ExtractJSON allows the grader to validate a single JSON document embedded
// in prose or a Markdown JSON code block. The default requires pure JSON.
ExtractJSON bool `yaml:"extract_json,omitempty" json:"extract_json,omitempty"`
}
JSONSchemaGraderParameters holds the arguments for creating a JSON schema grader.
type JudgeEvidence ¶ added in v0.39.0
type JudgeEvidence struct {
Version string `json:"version"`
SHA256 string `json:"sha256"`
Origin EvidenceOrigin `json:"origin"`
Boundary string `json:"boundary"`
ExecutionMode string `json:"execution_mode"`
Task JudgeEvidenceSection[string] `json:"task"`
Output JudgeEvidenceSection[string] `json:"output"`
Messages JudgeEvidenceSection[[]JudgeEvidenceMessage] `json:"messages"`
ToolEvents JudgeEvidenceSection[[]ToolEvent] `json:"tool_events"`
Files JudgeEvidenceSection[[]JudgeEvidenceFile] `json:"files"`
Selection PromptEvidenceContext `json:"selection"`
Redaction EvidenceRedaction `json:"redaction"`
Limits JudgeEvidenceLimits `json:"limits"`
Diagnostics []EvidenceDiagnostic `json:"diagnostics,omitempty"`
}
JudgeEvidence is independent of snapshot manifests. Its digest is integrity metadata, not authentication of the producer or truth of the contents.
func (*JudgeEvidence) UnmarshalJSON ¶ added in v0.39.0
func (e *JudgeEvidence) UnmarshalJSON(data []byte) error
type JudgeEvidenceFile ¶ added in v0.39.0
type JudgeEvidenceLimits ¶ added in v0.39.0
type JudgeEvidenceMessage ¶ added in v0.39.0
type JudgeEvidenceSection ¶ added in v0.39.0
type JudgeFileCapture ¶ added in v0.39.0
type JudgeFileCapture struct {
Files []JudgeEvidenceFile
Diagnostics []EvidenceDiagnostic
Redaction EvidenceRedaction
}
type Lockfile ¶ added in v0.38.6
type Lockfile struct {
SchemaVersion int `yaml:"schema_version"`
Graders []LockfileGrader `yaml:"graders"`
// contains filtered or unexported fields
}
Lockfile pins remote grader refs to immutable source and content digests.
func LoadLockfile ¶ added in v0.38.6
func NewLockfile ¶ added in v0.38.6
func NewLockfile() *Lockfile
func (*Lockfile) Grader ¶ added in v0.38.6
func (l *Lockfile) Grader(ref string) (LockfileGrader, bool)
func (*Lockfile) UpsertGrader ¶ added in v0.38.6
func (l *Lockfile) UpsertGrader(entry LockfileGrader)
type LockfileGrader ¶ added in v0.38.6
type MCPMockConfig ¶ added in v0.38.0
type MCPMockConfig struct {
Name string `yaml:"name" json:"name"`
Fixtures string `yaml:"fixtures,omitempty" json:"fixtures,omitempty"`
Tools map[string]MCPMockTool `yaml:"tools,omitempty" json:"tools,omitempty"`
}
MCPMockConfig defines a deterministic MCP server mock launched for an eval.
type MCPMockResponse ¶ added in v0.38.0
type MCPMockResponse struct {
Match map[string]any `yaml:"match,omitempty" json:"match,omitempty"`
MatchSchema map[string]any `yaml:"match_schema,omitempty" json:"match_schema,omitempty"`
MatchRegex map[string]string `yaml:"match_regex,omitempty" json:"match_regex,omitempty"`
Return any `yaml:"return,omitempty" json:"return,omitempty"`
Error string `yaml:"error,omitempty" json:"error,omitempty"`
Sequence []MCPMockStep `yaml:"sequence,omitempty" json:"sequence,omitempty"`
}
MCPMockResponse defines one deterministic response for a mocked tool call.
type MCPMockStep ¶ added in v0.39.0
type MCPMockStep struct {
Return any `yaml:"return,omitempty" json:"return,omitempty"`
Error string `yaml:"error,omitempty" json:"error,omitempty"`
DelayMS int64 `yaml:"delay_ms,omitempty" json:"delay_ms,omitempty"`
}
func (MCPMockStep) MarshalJSON ¶ added in v0.39.0
func (s MCPMockStep) MarshalJSON() ([]byte, error)
func (MCPMockStep) MarshalYAML ¶ added in v0.39.0
func (s MCPMockStep) MarshalYAML() (any, error)
type MCPMockTool ¶ added in v0.38.0
type MCPMockTool struct {
Description string `yaml:"description,omitempty" json:"description,omitempty"`
InputSchema map[string]any `yaml:"input_schema,omitempty" json:"input_schema,omitempty"`
Responses []MCPMockResponse `yaml:"responses,omitempty" json:"responses,omitempty"`
}
MCPMockTool defines a mocked MCP tool and its response fixtures.
type MeasureResult ¶
type MeasurementDef ¶
type MeasurementDef struct {
Identifier string `yaml:"name" json:"identifier"`
Weight float64 `yaml:"weight" json:"weight"`
Threshold float64 `yaml:"threshold" json:"threshold"`
Enabled bool `yaml:"enabled,omitempty" json:"enabled,omitempty"`
Desc string `yaml:"description,omitempty" json:"desc,omitempty"`
}
MeasurementDef defines a metric
type MockResponseSource ¶ added in v0.39.0
type MockResponseSource struct {
Kind string
Command string
Server string
Tool string
Index int
Data []byte
Finite bool
}
MockResponseSource identifies a declared matcher without normalizing its output presence or numeric YAML tags.
func MockResponseSources ¶ added in v0.39.0
func MockResponseSources(data []byte) ([]MockResponseSource, error)
MockResponseSources extracts only declared mock response locations. Payload properties named responses or sequence are not configuration.
type ModelScore ¶
type ModelScore struct {
ModelID string `json:"model_id"`
HeuristicScore float64 `json:"heuristic_score"`
Rank int `json:"rank"`
Scores map[string]float64 `json:"component_scores,omitempty"`
}
ModelScore holds the heuristic score and rank for a single model.
type ModelUsage ¶
type ModelUsage struct {
InputTokens int `json:"input_tokens"`
OutputTokens int `json:"output_tokens"`
CacheReadTokens int `json:"cache_read_tokens"`
CacheWriteTokens int `json:"cache_write_tokens"`
RequestCount float64 `json:"request_count"`
RequestCost float64 `json:"request_cost"`
// AICredits is the final AI-credit total the Copilot SDK attributed to this
// model, or nil when the SDK did not report one.
AICredits *float64 `json:"ai_credits,omitempty"`
}
ModelUsage holds per-model token and request usage.
type MultiSkillSummary ¶
type MultiSkillSummary struct {
Timestamp time.Time `json:"timestamp"`
Skills []SkillSummary `json:"skills"`
Overall OverallSummary `json:"overall"`
}
MultiSkillSummary aggregates results across multiple skill evaluations.
type OutcomeDigest ¶
type OutcomeDigest struct {
TotalTests int `json:"total_tests"`
Succeeded int `json:"succeeded"`
Failed int `json:"failed"`
Errors int `json:"errors"`
Skipped int `json:"skipped"`
SuccessRate float64 `json:"success_rate"`
AggregateScore float64 `json:"aggregate_score"`
WeightedScore float64 `json:"weighted_score"`
MinScore float64 `json:"min_score"`
MaxScore float64 `json:"max_score"`
StdDev float64 `json:"std_dev"`
DurationMs int64 `json:"duration_ms"`
Groups []GroupStats `json:"groups,omitempty"`
Usage *UsageStats `json:"usage,omitempty"`
// Statistical summary populated when trials_per_task > 1
Statistics *StatisticalSummary `json:"statistics,omitempty"`
// contains filtered or unexported fields
}
func (OutcomeDigest) HasWeightedScore ¶ added in v0.39.0
func (d OutcomeDigest) HasWeightedScore() bool
HasWeightedScore distinguishes recorded zero from omitted/null legacy fields. In-memory outcomes are writer data and have not passed through artifact decoding.
func (OutcomeDigest) MarshalJSON ¶ added in v0.39.0
func (d OutcomeDigest) MarshalJSON() ([]byte, error)
type OutcomeSetup ¶
type OutcomeSetup struct {
RunsPerTest int `json:"runs_per_test"`
ModelID string `json:"model_id"`
EngineType string `json:"engine_type"`
TimeoutSec int `json:"timeout_sec"`
JudgeModel string `json:"judge_model,omitempty"`
ReasoningEffort string `json:"reasoning_effort,omitempty"`
JudgeReasoningEffort string `json:"judge_reasoning_effort,omitempty"`
}
type OutcomeSpec ¶
type OverallSummary ¶
type OverallSummary struct {
TotalSkills int `json:"total_skills"`
TotalModels int `json:"total_models"`
AvgPassRate float64 `json:"avg_pass_rate"`
AvgAggregateScore float64 `json:"avg_aggregate_score"`
}
OverallSummary contains cross-skill aggregated metrics.
type PairwiseResult ¶
type PairwiseResult struct {
Winner string `json:"winner"` // "baseline", "skill", or "tie"
Magnitude string `json:"magnitude"` // "much-better", "slightly-better", "equal", etc.
Reasoning string `json:"reasoning"`
PositionConsistent bool `json:"position_consistent"` // true if result held after position swap
}
PairwiseResult captures the outcome of a pairwise LLM judge comparison.
type ProgramGraderParameters ¶
type PromptEvidenceContext ¶ added in v0.39.0
type PromptGraderMode ¶
type PromptGraderMode string
const ( PromptGraderModeIndependent PromptGraderMode = "independent" PromptGraderModePairwise PromptGraderMode = "pairwise" )
type PromptGraderParameters ¶
type PromptGraderParameters struct {
Prompt string `yaml:"prompt,omitempty" json:"prompt,omitempty"`
Model string `yaml:"model,omitempty" json:"model,omitempty"`
ReasoningEffort string `yaml:"reasoning_effort,omitempty" json:"reasoning_effort,omitempty"`
ContinueSession bool `yaml:"continue_session,omitempty" json:"continue_session,omitempty"`
Mode PromptGraderMode `yaml:"mode,omitempty" json:"mode,omitempty"`
EvidenceContext *PromptEvidenceContext `yaml:"evidence_context,omitempty" json:"evidence_context,omitempty"`
// Rubric is an optional reference to a reusable rubric. It can be either
// the name of a built-in rubric ("groundedness") or a path to a local
// rubric markdown file ("./rubrics/my-custom.md"). When set, the rubric's
// body becomes the judge prompt unless an inline Prompt is also supplied.
Rubric string `yaml:"rubric,omitempty" json:"rubric,omitempty"`
}
func (*PromptGraderParameters) UnmarshalJSON ¶ added in v0.39.0
func (p *PromptGraderParameters) UnmarshalJSON(data []byte) error
func (PromptGraderParameters) ValidateEvidenceContext ¶ added in v0.39.0
func (p PromptGraderParameters) ValidateEvidenceContext() error
type PromptJudgeObservation ¶ added in v0.39.0
type PromptJudgeObservation struct {
Grader string `json:"grader"`
BundleSHA256 string `json:"bundle_sha256,omitempty"`
DeliverySHA256 string `json:"delivery_sha256,omitempty"`
Context string `json:"context"`
State string `json:"state"`
SubmissionObserved bool `json:"submission_observed"`
Inspection string `json:"inspection"`
EvidenceContext PromptEvidenceContext `json:"evidence_context"`
Purpose string `json:"purpose"`
SessionID string `json:"session_id,omitempty"`
Model string `json:"model,omitempty"`
Usage *UsageStats `json:"usage,omitempty"`
DurationMs int64 `json:"duration_ms"`
Diagnostics []EvidenceDiagnostic `json:"diagnostics,omitempty"`
}
type Recommendation ¶
type Recommendation struct {
RecommendedModel string `json:"recommended_model"`
HeuristicScore float64 `json:"heuristic_score"`
Reason string `json:"reason"`
WinnerMarginPct float64 `json:"winner_margin_pct"`
Weights RecommendationWeights `json:"weights"`
ModelScores []ModelScore `json:"all_models"`
}
Recommendation represents a heuristic recommendation for the best model across a multi-model evaluation run.
type RecommendationWeights ¶
type RecommendationWeights struct {
AggregateScore float64 `json:"aggregate_score"`
PassRate float64 `json:"pass_rate"`
Consistency float64 `json:"consistency"`
Speed float64 `json:"speed"`
}
RecommendationWeights defines the weighting scheme for heuristic scoring.
type Requirement ¶ added in v0.39.0
type Requirement struct {
ID string `yaml:"id" json:"id"`
Category string `yaml:"category" json:"category"`
Description string `yaml:"description" json:"description"`
Checks []RequirementCheck `yaml:"checks,omitempty" json:"checks,omitempty"`
}
Requirement describes intent and references existing checks. It does not introduce an assertion, runtime policy, or an assurance verdict.
type RequirementCheck ¶ added in v0.39.0
type RequirementCheck struct {
Scope string `yaml:"scope" json:"scope"`
Grader string `yaml:"grader" json:"grader"`
AfterTurn int `yaml:"after_turn,omitempty" json:"after_turn,omitempty"`
}
RequirementCheck identifies an explicit grader declaration, not a result key. AfterTurn is required only for checkpoint scope.
type RequirementExplanation ¶ added in v0.39.0
type RequirementExplanation struct {
TaskID string `json:"task_id"`
RequirementID string `json:"requirement_id"`
Checks []CheckExplanation `json:"checks"`
}
RequirementExplanation reports an existing check's recorded observation. It must not relabel descriptive requirement metadata as runtime enforcement.
type ResourceRef ¶
type ResourceRef struct {
Location string `yaml:"path,omitempty" json:"location,omitempty"`
Body string `yaml:"content,omitempty" json:"body,omitempty"`
}
ResourceRef points to a file or inline content
type ResponderConfig ¶ added in v0.37.0
type ResponderConfig struct {
// Model is the model used for the responder LLM. Optional; when empty the
// eval-level config.model is used.
Model string `yaml:"model,omitempty" json:"model,omitempty"`
// Instructions describe the target configuration the responder represents
// and the rule for abstaining. Required.
Instructions string `yaml:"instructions" json:"instructions"`
// MaxFollowups caps how many times the responder may reply before the loop
// stops. Required; must be >= 1.
MaxFollowups int `yaml:"max_followups" json:"max_followups"`
}
ResponderConfig configures an LLM-backed surrogate user that answers a skill's follow-up questions during a multi-turn run. It is mutually exclusive with TaskStimulus.FollowUps.
type ResponderInfo ¶ added in v0.37.0
type ResponderInfo struct {
// FollowupsSent is the number of responder answers sent to the agent.
FollowupsSent int `json:"followups_sent"`
// Outcome is one of: stopped, abstained, cap_exhausted, error.
Outcome string `json:"outcome"`
// Reason holds the responder's reason when Outcome == "abstained" or an
// error message when Outcome == "error".
Reason string `json:"reason,omitempty"`
}
ResponderInfo records the outcome of a responder-driven multi-turn run.
type RunResult ¶
type RunResult struct {
JudgeEvidence *JudgeEvidence `json:"judge_evidence,omitempty"`
PromptJudging []PromptJudgeObservation `json:"prompt_judging,omitempty"`
RunNumber int `json:"run_number"`
Attempts int `json:"attempts"`
// Prompt is the resolved initial task prompt for this run. It may be
// recorded before execution starts when request setup fails.
Prompt string `json:"prompt,omitempty"`
// Status contains the overall status of the run.
// NOTE: if Status == [StatusError], then [ErrorMsg] will be set to the
// message from the error.
Status Status `json:"status"`
DurationMs int64 `json:"duration_ms"`
Validations map[string]GraderResults `json:"validations"`
SessionDigest SessionDigest `json:"session_digest"`
GraderSessions []SessionDigest `json:"grader_sessions,omitempty"`
Transcript []TranscriptEvent `json:"transcript,omitempty"`
FinalOutput string `json:"final_output"`
ErrorMsg string `json:"error_msg,omitempty"`
SkillInvocations []SkillInvocation `json:"skill_invocations,omitempty"`
Usage *UsageStats `json:"usage,omitempty"`
WorkspaceDir string `json:"workspace_dir,omitempty"`
FailureArtifacts *FailureArtifacts `json:"failure_artifacts,omitempty"`
Responder *ResponderInfo `json:"responder,omitempty"`
// Checkpoints captures per-turn checkpoint grader results, one entry per
// configured TestCase.Checkpoint that actually ran (i.e., turn index was
// reached). Empty / omitted when the task defines no checkpoints.
Checkpoints []CheckpointOutcome `json:"checkpoints,omitempty"`
// ToolEvents is a normalized, replay-friendly record of every tool call
// made during the run. Added in schema version 1.1 as an additive field
// (see issue #366). The legacy SessionDigest.ToolCalls is preserved for
// backward compatibility; new consumers should prefer ToolEvents.
ToolEvents []ToolEvent `json:"tool_events,omitempty"`
// CommandInvocations records sanitized calls handled by declarative
// command_mocks. Response output is intentionally excluded.
CommandInvocations []CommandInvocation `json:"command_invocations,omitempty"`
// DependencyModes records the configured mode for declared dependencies.
// It describes configuration, not proof that a dependency was invoked.
DependencyModes []DependencyMode `json:"dependency_modes,omitempty"`
// SnapshotPath is the on-disk path of the self-contained snapshot.json
// artifact for this run, as returned by snapshot.Writer.Write. It is
// rooted at the --snapshot directory the user passed to `waza run` (so
// it may be absolute, or relative to the working directory at run time,
// depending on what the user supplied). Consumers that need a
// results.json-relative path should compute it themselves with
// filepath.Rel against the results.json directory. Empty when
// `waza run --snapshot` was not used. Added in schema version 1.2 as
// an additive field (see issue #367).
SnapshotPath string `json:"snapshot_path,omitempty"`
Evidence *EvidenceManifest `json:"evidence,omitempty"`
RequirementExplanations []RequirementExplanation `json:"requirement_explanations,omitempty"`
}
RunResult is the result of a single run/trial
func (*RunResult) AllValidationsPassed ¶
AllValidationsPassed checks if all validations passed
func (*RunResult) ComputeRunScore ¶
ComputeRunScore calculates the average score across all validations (unweighted, for backward compat)
func (*RunResult) ComputeWeightedRunScore ¶
ComputeWeightedRunScore calculates the weighted composite score (0.0–1.0) using each grader's Weight field. If all weights are zero, falls back to simple average.
func (*RunResult) UnmarshalJSON ¶ added in v0.39.0
func (*RunResult) UnmarshalJSONExact ¶ added in v0.39.0
UnmarshalJSONExact preserves dynamic numeric tokens for explicit evidence readers. Ordinary JSON decoding retains its legacy float64 representation.
type SessionDigest ¶
type SessionDigest struct {
ToolCallCount int `json:"tool_call_count"`
ToolsUsed []string `json:"tools_used"`
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
Errors []string `json:"errors"`
Usage *UsageStats `json:"usage,omitempty"`
SessionID string `json:"session_id,omitempty"`
// ToolPolicyMode is the effective .agent.md `tools:` runtime policy
// applied to this session: "unrestricted", "deny_all", or "allow_list".
// Empty when no .agent.md tool policy was resolved for the run.
ToolPolicyMode string `json:"tool_policy_mode,omitempty"`
// ToolPolicyDenials records every tool-execution attempt denied by an
// active tool policy across all turns of this session (initial,
// follow-up, and responder-driven alike).
ToolPolicyDenials []ToolPolicyDenial `json:"tool_policy_denials,omitempty"`
}
type SkillImpactMetric ¶
type SkillImpactMetric struct {
PassRateWithSkills float64 `json:"pass_rate_with_skills"`
PassRateBaseline float64 `json:"pass_rate_baseline"`
Delta float64 `json:"delta"`
PercentChange float64 `json:"percent_change"`
Pairwise *PairwiseResult `json:"pairwise,omitempty"`
}
SkillImpactMetric represents A/B comparison for a single task
type SkillInvocation ¶ added in v0.22.0
SkillInvocation records a skill invoked during an agent session.
type SkillInvocationGraderParameters ¶
type SkillInvocationGraderParameters struct {
RequiredSkills []string `yaml:"required_skills,omitempty" json:"required_skills,omitempty"`
ForbiddenSkills []string `yaml:"forbidden_skills,omitempty" json:"forbidden_skills,omitempty"`
Mode SkillInvocationMatchingMode `yaml:"mode,omitempty" json:"mode,omitempty"`
AllowExtra *bool `yaml:"allow_extra,omitempty" json:"allow_extra,omitempty"`
}
type SkillInvocationMatchingMode ¶
type SkillInvocationMatchingMode string
SkillInvocationMatchingMode controls how actual skill invocations are compared to expected skills.
const ( SkillMatchingModeExact SkillInvocationMatchingMode = "exact_match" SkillMatchingModeInOrder SkillInvocationMatchingMode = "in_order" SkillMatchingModeAnyOrder SkillInvocationMatchingMode = "any_order" )
type SkillSummary ¶
type SkillSummary struct {
SkillName string `json:"skill_name"`
Models []string `json:"models"`
PassRate float64 `json:"pass_rate"`
AggregateScore float64 `json:"aggregate_score"`
OutputFiles []string `json:"output_files"`
}
SkillSummary contains aggregated metrics for a single skill evaluation.
type SpecIdentity ¶
type StatisticalSummary ¶
type StatisticalSummary struct {
BootstrapCI *statistics.ConfidenceInterval `json:"bootstrap_ci,omitempty"`
// Wilson 95% interval on SuccessRate, counting each task as one sample.
SuccessRateCI *statistics.ConfidenceInterval `json:"success_rate_ci,omitempty"`
// PassHatK[k-1] is the τ-bench pass^k: the chance that k fresh trials of a
// task all pass, averaged over tasks. k runs up to the fewest trials of any task.
PassHatK []float64 `json:"pass_hat_k,omitempty"`
NormalizedGain *float64 `json:"normalized_gain,omitempty"`
// Deprecated: no longer populated (see TestStats.IsSignificant). A pointer
// so older artifacts round-trip a stored false.
IsSignificant *bool `json:"is_significant,omitempty"`
}
StatisticalSummary holds aggregate statistical data for the digest when trials > 1.
type TaskExpectation ¶ added in v0.31.0
type TaskExpectation struct {
OutcomeSpecs []OutcomeSpec `yaml:"outcomes,omitempty" json:"outcome_specs,omitempty"`
ToolPatterns map[string]any `yaml:"tool_calls,omitempty" json:"tool_patterns,omitempty"`
BehaviorRules BehaviorRules `yaml:"behavior,omitempty" json:"behavior_rules,omitempty"`
MustInclude []string `yaml:"output_contains,omitempty" json:"must_include,omitempty"`
MustExclude []string `yaml:"output_not_contains,omitempty" json:"must_exclude,omitempty"`
MayInclude []string `yaml:"output_contains_any,omitempty" json:"may_include,omitempty"`
ExpectedTrigger *bool `yaml:"should_trigger,omitempty" json:"expected_trigger,omitempty"`
}
TaskExpectation defines expected outcomes.
Deprecated alias: TestExpectation is provided for backward compatibility.
type TaskStimulus ¶ added in v0.31.0
type TaskStimulus struct {
Message string `yaml:"prompt" json:"message"`
MessageFile string `yaml:"prompt_file,omitempty" json:"message_file,omitempty"`
Metadata map[string]any `yaml:"context,omitempty" json:"metadata,omitempty"`
Resources []ResourceRef `yaml:"files,omitempty" json:"resources,omitempty"`
Repos []GitResource `yaml:"repos,omitempty" json:"repos,omitempty"`
WorkDir string `yaml:"workdir,omitempty" json:"workdir,omitempty"`
Environment map[string]string `yaml:"environment,omitempty" json:"environment,omitempty"`
FollowUps []string `yaml:"follow_up_prompts,omitempty" json:"follow_ups,omitempty"`
Responder *ResponderConfig `yaml:"responder,omitempty" json:"responder,omitempty"`
}
TaskStimulus defines the input for a task.
Deprecated alias: TestStimulus is provided for backward compatibility.
type TaskTranscript ¶
type TaskTranscript struct {
TaskID string `json:"task_id"`
TaskName string `json:"task_name"`
Status Status `json:"status"`
StartedAt time.Time `json:"started_at"`
CompletedAt time.Time `json:"completed_at"`
DurationMs int64 `json:"duration_ms"`
Prompt string `json:"prompt"`
FinalOutput string `json:"final_output"`
Transcript []TranscriptEvent `json:"transcript"`
Validations map[string]GraderResults `json:"validations,omitempty"`
Session SessionDigest `json:"session"`
ErrorMsg string `json:"error_msg,omitempty"`
}
TaskTranscript is the per-task JSON file written to the transcript directory.
type TestCase ¶
type TestCase struct {
Active *bool `yaml:"enabled,omitempty" json:"active,omitempty"`
ContextRoot string `yaml:"context_dir,omitempty" json:"context_root,omitempty"`
DisplayName string `yaml:"name" json:"display_name"`
Expectation TaskExpectation `yaml:"expected,omitempty" json:"expectation,omitempty"`
InstructionFiles []string `yaml:"instruction_files,omitempty" json:"instruction_files,omitempty"`
SkillPaths []string `yaml:"skill_directories,omitempty" json:"skill_paths,omitempty"`
Stimulus TaskStimulus `yaml:"inputs" json:"stimulus"`
Summary string `yaml:"description,omitempty" json:"summary,omitempty"`
Tags []string `yaml:"tags,omitempty" json:"labels,omitempty"`
TestID string `yaml:"id" json:"test_id"`
// Golden marks a task as a "must always pass" regression gate. When set
// to true, `waza gate` treats any non-pass status as a hard failure
// (exit code 2) regardless of the aggregate pass-rate threshold.
Golden bool `yaml:"golden,omitempty" json:"golden,omitempty"`
TimeoutSec *int `yaml:"timeout_seconds,omitempty" json:"timeout_sec,omitempty"`
// FirstEventTimeoutSec overrides Config.FirstEventTimeoutSec for this task.
// nil inherits the eval-level value; 0 disables the check for this task.
FirstEventTimeoutSec *int `yaml:"first_event_timeout_seconds,omitempty" json:"first_event_timeout_sec,omitempty"`
CommandMocks *[]CommandMockConfig `yaml:"command_mocks,omitempty" json:"command_mocks,omitempty"`
Validators []ValidatorInline `yaml:"graders,omitempty" json:"validators,omitempty"`
// Checkpoints attach graders to intermediate turn boundaries in a
// multi-turn run. Each checkpoint specifies `after_turn: N` (1-based,
// where turn 1 is the initial prompt) and a list of graders that run
// against the cumulative conversation state at the end of that turn.
// Checkpoints are additive — task-level `graders:` still run against
// the final state after all turns complete.
Checkpoints []Checkpoint `yaml:"checkpoints,omitempty" json:"checkpoints,omitempty"`
Requirements []Requirement `yaml:"requirements,omitempty" json:"requirements,omitempty"`
// contains filtered or unexported fields
}
TestCase represents a single evaluation test
func LoadAcquiredTestCase ¶ added in v0.39.0
func LoadAcquiredTestCase(document *AcquiredOfflineDocument) (*TestCase, error)
func LoadTestCase ¶
LoadTestCase loads a test case from YAML
func LoadTestCaseOffline ¶ added in v0.39.0
LoadTestCaseOffline guards eager schema dependencies before native decoding.
func ParseCapturedTestCaseOffline ¶ added in v0.39.0
func ParseCapturedTestCaseOffline(data []byte, path string, readFile func(string) ([]byte, error)) (*TestCase, error)
ParseCapturedTestCaseOffline resolves prompt_file through a captured-byte reader. The reader receives the same task-directory-relative path as the loader.
func ParseTestCase ¶ added in v0.39.0
ParseTestCase preserves native task loading and path-relative prompt resolution.
func ParseTestCaseOffline ¶ added in v0.39.0
func ParseTestCaseOffline(data []byte, path string, validate func(string, GraderParameters) error) (*TestCase, error)
ParseTestCaseOffline examines immutable bytes with offline schema loading. validate checks static configuration when external dependencies block native decode.
func (*TestCase) SourceBytes ¶ added in v0.39.0
SourceBytes returns the original input, before prompt-file resolution.
func (*TestCase) ValidateForExecutor ¶ added in v0.38.8
ValidateForExecutor checks judge settings against the enclosing eval's executor.
type TestExpectation
deprecated
type TestExpectation = TaskExpectation
Deprecated: Use TaskExpectation instead.
type TestOutcome ¶
type TestOutcome struct {
Cached bool `json:"cached,omitempty"`
TestID string `json:"test_id"`
DisplayName string `json:"display_name"`
Group string `json:"group,omitempty"`
// Golden mirrors TestCase.Golden so `waza gate` can identify
// must-pass tasks directly from results.json without re-reading YAML.
Golden bool `json:"golden,omitempty"`
Status Status `json:"status"`
Runs []RunResult `json:"runs"`
Stats *TestStats `json:"stats,omitempty"`
SkillImpact *SkillImpactMetric `json:"skill_impact,omitempty"`
}
TestOutcome represents the result of one test case
type TestStats ¶
type TestStats struct {
PassRate float64 `json:"pass_rate"`
FlakinessPercent float64 `json:"flakiness_percent"`
PassedRuns int `json:"passed_runs"`
FailedRuns int `json:"failed_runs"`
ErrorRuns int `json:"error_runs"`
TotalRuns int `json:"total_runs"`
AvgScore float64 `json:"avg_score"`
AvgWeightedScore float64 `json:"avg_weighted_score"`
MinScore float64 `json:"min_score"`
MaxScore float64 `json:"max_score"`
StdDevScore float64 `json:"std_dev_score"`
ScoreVariance float64 `json:"score_variance"`
CI95Lo float64 `json:"ci95_lo"`
CI95Hi float64 `json:"ci95_hi"`
Flaky bool `json:"flaky"`
AvgDurationMs int64 `json:"avg_duration_ms"`
// Bootstrap confidence interval over weighted scores (populated when trials > 1)
BootstrapCI *statistics.ConfidenceInterval `json:"bootstrap_ci,omitempty"`
// Wilson 95% interval on PassRate over this task's trials (populated when trials > 1)
PassRateCI *statistics.ConfidenceInterval `json:"pass_rate_ci,omitempty"`
// Deprecated: no longer populated. It tested whether a CI on the task's own
// 0–1 score excluded zero, which compares an absolute score with zero instead
// of testing a difference, so it was not a significance test. Kept so older
// results files load without unknown-field warnings.
IsSignificant *bool `json:"is_significant,omitempty"`
// contains filtered or unexported fields
}
func (TestStats) HasAvgWeightedScore ¶ added in v0.39.0
HasAvgWeightedScore reports whether decoded task statistics recorded a score.
func (TestStats) MarshalJSON ¶ added in v0.39.0
type TestStimulus
deprecated
type TestStimulus = TaskStimulus
Deprecated: Use TaskStimulus instead.
type TextGraderParameters ¶
type TextGraderParameters struct {
// Contains lists substrings that must appear in the output (case-insensitive).
Contains []string `yaml:"contains,omitempty" json:"contains,omitempty"`
// NotContains lists substrings that must NOT appear in the output (case-insensitive).
NotContains []string `yaml:"not_contains,omitempty" json:"not_contains,omitempty"`
// ContainsCS lists substrings that must appear in the output (case-sensitive).
ContainsCS []string `yaml:"contains_cs,omitempty" json:"contains_cs,omitempty"`
// NotContainsCS lists substrings that must NOT appear in the output (case-sensitive).
NotContainsCS []string `yaml:"not_contains_cs,omitempty" json:"not_contains_cs,omitempty"`
// RegexMatch lists regex patterns that must match somewhere in the output.
RegexMatch []string `yaml:"regex_match,omitempty" json:"regex_match,omitempty"`
// RegexNotMatch lists regex patterns that must NOT match anywhere in the output.
RegexNotMatch []string `yaml:"regex_not_match,omitempty" json:"regex_not_match,omitempty"`
}
TextGraderParameters holds the arguments for creating a text grader.
type ToolCall ¶
type ToolCall struct {
// ID is the engine-assigned identifier for this call (e.g. the
// Copilot SDK's ToolCallID). Used to correlate tool invocations in
// observability backends.
ID string `json:"id,omitempty"`
Name string `json:"name"`
Arguments ToolCallArgs `json:"arguments,omitempty"`
Result *copilot.ToolExecutionCompleteResult `json:"result,omitempty"`
Success bool `json:"success"`
}
ToolCall represents a tool invocation
func FilterToolCalls ¶
func FilterToolCalls(sessionEvents []copilot.SessionEvent) []ToolCall
FilterToolCalls goes through the list of session events and correlates tool starts with Success.
type ToolCallArgs ¶
type ToolCallArgs struct {
// these are filled out for file-based tools (view/edit)
Path string `json:"path" mapstructure:"path"`
FileText string `json:"file_text" mapstructure:"file_text"`
// filled out for tools like bash or powershell
Command string `json:"command" mapstructure:"command"`
Description string `json:"description" mapstructure:"description"`
// filled out for skill invocations
Skill string `json:"skill" mapstructure:"skill"`
// Extra captures any tool-specific argument keys that aren't part of
// the fixed fields above (e.g. `query`/`limit` for search tools,
// MCP-specific payloads). Populated automatically by mapstructure's
// ",remain" support so argument matchers in tool_calls /
// tool_constraint graders can see the full argument bag.
//
// Excluded from JSON marshaling: callers consuming arguments as a
// generic map should use graders.normalizeToolCallArgs, which merges
// Extra into the known fields. Persisting the raw bag in results.json
// happens through RunResult.ToolEvents instead, which preserves the
// engine's original argument value verbatim.
Extra map[string]any `json:"-" mapstructure:",remain"`
}
type ToolCallsGraderParameters ¶ added in v0.27.0
type ToolCallsGraderParameters struct {
RequiredTools []string `yaml:"required_tools,omitempty" json:"required_tools,omitempty"`
ForbiddenTools []string `yaml:"forbidden_tools,omitempty" json:"forbidden_tools,omitempty"`
MinCalls *int `yaml:"min_calls,omitempty" json:"min_calls,omitempty"`
MaxCalls *int `yaml:"max_calls,omitempty" json:"max_calls,omitempty"`
// Expect is an ordered list of tool-call expectations. Each entry names
// the expected tool and (optionally) structured matchers for argument
// fields. An expectation passes when there is at least one actual tool
// call whose name matches and whose arguments satisfy every matcher.
//
// Unlike RequiredTools (which only checks names), Expect lets a grader
// assert input correctness — e.g. "list_dir was called with
// path matching ^src/".
Expect []ToolExpectation `yaml:"expect,omitempty" json:"expect,omitempty"`
}
ToolCallsGraderParameters validates which tools were called during a session.
type ToolConstraintGraderParameters ¶
type ToolConstraintGraderParameters struct {
ExpectTools []ToolSpecParameters `yaml:"expect_tools,omitempty" json:"expect_tools,omitempty"`
RejectTools []ToolSpecParameters `yaml:"reject_tools,omitempty" json:"reject_tools,omitempty"`
// AllowOnly declares a policy allow-list of tool specs. When non-nil,
// every observed tool call in the session digest must match at least one
// entry; any undeclared tool used by the agent counts as a policy
// violation. Declared tools do NOT need to be exercised — this is an
// upper bound, not a lower bound.
//
// AllowOnly is distinct from ExpectTools:
//
// - ExpectTools requires every listed tool to have been used at least
// once (a lower bound). Extra tools not listed are ignored.
// - AllowOnly forbids any tool that is not listed (an upper bound).
// Missing listed tools are not a violation.
//
// Semantics of the pointer:
//
// - nil: no allow-list check is applied.
// - non-nil empty slice (`&[]ToolSpecParameters{}`): deny-all — any
// observed tool call is a violation.
// - non-nil populated: only observed calls whose tool name matches an
// entry (exact / case-insensitive on the Tool field, with optional
// pattern qualifiers on other fields) are allowed.
//
// Tool-name matching is exact (case-insensitive) rather than regex, so
// entries injected from an .agent.md `tools:` frontmatter list are not
// silently reinterpreted as patterns.
AllowOnly *[]ToolSpecParameters `yaml:"allow_only,omitempty" json:"allow_only,omitempty"`
}
type ToolEvent ¶ added in v0.38.0
type ToolEvent struct {
// Turn is the 1-based ordinal of the assistant turn that produced this
// call. Multiple tool calls may share the same turn. 0 means unknown
// (engines that do not surface turn boundaries).
Turn int `json:"turn"`
// Sequence is the 1-based ordinal of this call within the run, in the
// order the engine emitted them. Stable across replays.
Sequence int `json:"sequence"`
// ToolCallID is the engine's unique identifier for this call. May be
// empty for engines that do not assign IDs.
ToolCallID string `json:"tool_call_id,omitempty"`
// ToolName is the canonical name of the tool that was invoked.
ToolName string `json:"tool_name"`
// Args is the call's argument payload normalised to a JSON-compatible
// value (object, array, scalar, or null). The exact shape depends on
// the tool; argmatcher matchers in tool_calls / tool_constraint graders
// run against this field.
Args any `json:"args,omitempty"`
// Result is the tool's response payload normalised to a JSON-compatible
// value, or nil when the engine did not surface a result.
Result any `json:"result,omitempty"`
// Success reports whether the engine considered the call to have
// completed without error.
Success bool `json:"success"`
// Error is the engine's failure message when Success is false. Empty
// for successful calls.
Error string `json:"error,omitempty"`
// DurationMs is the wall-clock time between the tool-start and
// tool-complete events when available. 0 when timing is unavailable.
DurationMs int64 `json:"duration_ms,omitempty"`
}
ToolEvent is the normalized, engine-agnostic record of a single tool call emitted during an agent session. It is the canonical per-task tool record surfaced in `results.json` under `runs[].tool_events` (schema version 1.1+).
Fields are intentionally aligned with the GenAI OpenTelemetry semantic conventions (see internal/telemetry) so the same record can be exported as a span attribute set without translation:
tool_call_id <-> gen_ai.tool.call.id tool_name <-> gen_ai.tool.name args <-> gen_ai.tool.arguments (JSON value) result <-> gen_ai.tool.result (JSON value) success <-> waza.tool.success
Wave 3 (#367) snapshot/replay consumes tool_events directly, so the wire format must remain stable: additions are MINOR (1.x), renames/removals are MAJOR (2.0).
type ToolExpectation ¶ added in v0.38.0
type ToolExpectation struct {
// Tool is the expected tool name (matched as a Go regexp against the
// recorded tool name). A plain string is a substring match anchored by
// the regexp engine, so use `^foo$` for exact match.
Tool string `yaml:"tool" json:"tool"`
// Args holds matcher specs for tool-call argument fields. All matchers
// must pass for the expectation to be considered satisfied.
Args map[string]argmatcher.Matcher `yaml:"args,omitempty" json:"args,omitempty"`
}
ToolExpectation defines one entry in ToolCallsGraderParameters.Expect.
type ToolPolicyDenial ¶ added in v0.38.8
type ToolPolicyDenial struct {
Tool string `json:"tool"`
Kind string `json:"kind"`
Reason string `json:"reason"`
}
ToolPolicyDenial records a single tool-execution attempt denied by an active .agent.md `tools:` runtime policy. Mirrors internal/execution.ToolPolicyDenial for serialization in results.json.
type ToolSpecParameters ¶
type ToolSpecParameters struct {
Tool string `yaml:"tool" json:"tool"`
CommandPattern string `yaml:"command_pattern,omitempty" json:"command_pattern,omitempty"`
SkillPattern string `yaml:"skill_pattern,omitempty" json:"skill_pattern,omitempty"`
PathPattern string `yaml:"path_pattern,omitempty" json:"path_pattern,omitempty"`
// Args constrains specific argument fields on the tool call using
// structured matchers (equals / regex / contains / range / json_schema).
// Keys are argument names as they appear on ToolCall.Arguments after JSON
// normalisation; values are matcher specs. All matchers must pass for the
// call to satisfy the spec.
Args map[string]argmatcher.Matcher `yaml:"args,omitempty" json:"args,omitempty"`
}
type TranscriptEvent ¶
type TranscriptEvent struct {
copilot.SessionEvent `json:"-"`
}
func (TranscriptEvent) MarshalJSON ¶
func (te TranscriptEvent) MarshalJSON() ([]byte, error)
func (*TranscriptEvent) UnmarshalJSON ¶
func (te *TranscriptEvent) UnmarshalJSON(data []byte) error
type TriggerHeuristicGraderParameters ¶
type TriggerHeuristicGraderParameters struct {
SkillPath string `yaml:"skill_path" json:"skill_path"`
Mode string `yaml:"mode" json:"mode"`
Threshold *float64 `yaml:"threshold,omitempty" json:"threshold,omitempty"`
}
TriggerHeuristicGraderParameters holds the arguments for creating a trigger heuristic grader.
type TriggerMetrics ¶
type TriggerMetrics struct {
TP int `json:"true_positives"`
FP int `json:"false_positives"`
TN int `json:"true_negatives"`
FN int `json:"false_negatives"`
Errors int `json:"errors,omitempty"`
Precision float64 `json:"precision"`
Recall float64 `json:"recall"`
F1 float64 `json:"f1"`
Accuracy float64 `json:"accuracy"`
}
TriggerMetrics holds classification metrics for trigger accuracy.
func ComputeTriggerMetrics ¶
func ComputeTriggerMetrics(results []TriggerResult) *TriggerMetrics
ComputeTriggerMetrics calculates precision, recall, F1, and accuracy from a set of trigger classification results. Results are weighted by confidence: "high" (or empty) counts as 1.0, "medium" as 0.5. Returns nil when results is empty.
type TriggerResult ¶
type TriggerResult struct {
Prompt string `json:"prompt"`
Confidence string `json:"confidence,omitempty"`
ShouldTrigger bool `json:"should_trigger"`
DidTrigger bool `json:"did_trigger"`
ErrorMsg string `json:"error_msg,omitempty"`
FinalOutput string `json:"final_output,omitempty"`
Transcript []TranscriptEvent `json:"transcript,omitempty"`
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
SessionID string `json:"session_id,omitempty"`
}
TriggerResult pairs an expected trigger label with the actual outcome.
type UsageStats ¶
type UsageStats struct {
Turns int `json:"turns"`
InputTokens int `json:"input_tokens"`
OutputTokens int `json:"output_tokens"`
CacheReadTokens int `json:"cache_read_tokens"`
CacheWriteTokens int `json:"cache_write_tokens"`
PremiumRequests float64 `json:"premium_requests"`
// AICredits is the final GitHub Copilot AI-credit total reported by the
// Copilot SDK for the session (nano-AI units converted with
// [AICreditsFromNanoAIU]). It is nil when the SDK or bundled runtime did not
// report a final credit total — for example artifacts produced by older
// runtimes, or custom providers — and consumers must render that as an
// explicit unavailable state rather than a computed estimate.
AICredits *float64 `json:"ai_credits,omitempty"`
Provider string `json:"provider,omitempty"`
ProviderHost string `json:"provider_host,omitempty"`
ModelMetrics map[string]ModelUsage `json:"model_metrics,omitempty"`
}
UsageStats holds token and premium request usage data from a Copilot SDK session.
Provider is empty for the default Copilot MaaS path. When it is "custom", PremiumRequests should be read as custom-provider request count rather than GitHub Copilot premium billing. ProviderHost may contain a sanitized host from the custom provider base URL; it intentionally omits scheme, path, query, and credentials.
func AggregateUsageStats ¶
func AggregateUsageStats(stats []*UsageStats) *UsageStats
AggregateUsageStats sums usage across multiple UsageStats (e.g. across runs). Provider metadata is preserved when all aggregated stats share the same route. If usage spans multiple provider routes, Provider is set to "mixed" so consumers avoid labeling the aggregate as purely Copilot premium or BYOK.
func (*UsageStats) IsZero ¶
func (u *UsageStats) IsZero() bool
IsZero returns true if no usage data has been recorded.
type ValidatorInline ¶
type ValidatorInline struct {
Identifier string `yaml:"name" json:"identifier"`
Kind GraderKind `yaml:"type,omitempty" json:"kind,omitempty"`
Checks []string `yaml:"assertions,omitempty" json:"checks,omitempty"`
Rubric string `yaml:"rubric,omitempty" json:"rubric,omitempty"`
Weight float64 `yaml:"weight,omitempty" json:"weight,omitempty"`
Parameters GraderParameters `yaml:"config,omitempty" json:"parameters,omitempty"`
}
ValidatorInline is a validator embedded in a test case
func (*ValidatorInline) EffectiveWeight ¶ added in v0.22.0
func (v *ValidatorInline) EffectiveWeight() float64
func (*ValidatorInline) UnmarshalYAML ¶
func (v *ValidatorInline) UnmarshalYAML(node *yaml.Node) error
func (*ValidatorInline) Validate ¶ added in v0.26.0
func (v *ValidatorInline) Validate() error
Validate checks that the validator config has required fields for its type.
Source Files
¶
- acquired_document.go
- captured_source.go
- command_mock.go
- events.go
- evidence.go
- fault_document.go
- fault_source.go
- grade.go
- grader_params.go
- judge_evidence.go
- lockfile.go
- mcp_mock_validation.go
- native_evidence.go
- offline_schema_guard.go
- offline_tool_parameters.go
- outcome.go
- recommendation.go
- requirement.go
- schema_version.go
- spec.go
- summary.go
- testcase.go
- tool_event.go
- tool_names.go
- transcript.go
- trigger_metrics.go