agenteval

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ReportContractVersion = "zero.agenteval.report.v1"

Variables

This section is empty.

Functions

func MissingTraceEvents

func MissingTraceEvents(required []string, stdout string) []string

func ParseTraceEventKeys

func ParseTraceEventKeys(stdout string) []string

func TraceEventKeys

func TraceEventKeys(stdout string) []string

Types

type AgentRunInput

type AgentRunInput struct {
	TaskID        string
	Prompt        string
	WorkspacePath string
	Model         string
}

type AgentRunResult

type AgentRunResult struct {
	ExitCode int    `json:"exitCode"`
	Stdout   string `json:"stdout,omitempty"`
	Stderr   string `json:"stderr,omitempty"`
	Error    string `json:"error,omitempty"`
	// Truncated is set when captured stdout/stderr exceeded the runner's
	// OutputLimit and some output was dropped.
	Truncated bool `json:"truncated,omitempty"`
}

type AgentRunner

type AgentRunner interface {
	Run(context.Context, AgentRunInput) AgentRunResult
}

type AgentRunnerFunc

type AgentRunnerFunc func(context.Context, AgentRunInput) AgentRunResult

func (AgentRunnerFunc) Run

type BenchmarkInput

type BenchmarkInput struct {
	TaskID         string
	WorkRoot       string
	Models         []string
	KeepWorkspaces bool
	// Timeout bounds each task's materialization, agent run, and scoring. A
	// non-positive value leaves the task unbounded.
	Timeout time.Duration
}

type BenchmarkReport

type BenchmarkReport struct {
	Contract string                `json:"contract"`
	SuiteID  string                `json:"suiteId"`
	OK       bool                  `json:"ok"`
	Summary  BenchmarkSummary      `json:"summary"`
	Tasks    []BenchmarkTaskReport `json:"tasks"`
}

type BenchmarkSummary

type BenchmarkSummary struct {
	TotalTasks   int `json:"totalTasks"`
	PassedTasks  int `json:"passedTasks"`
	FailedTasks  int `json:"failedTasks"`
	BlockedTasks int `json:"blockedTasks"`
	ErrorTasks   int `json:"errorTasks"`
}

type BenchmarkTaskReport

type BenchmarkTaskReport struct {
	TaskID        string         `json:"taskId"`
	Model         string         `json:"model,omitempty"`
	WorkspacePath string         `json:"workspacePath"`
	FixturePath   string         `json:"fixturePath"`
	Agent         AgentRunResult `json:"agent"`
	Report        Report         `json:"report"`
}

type ChangedFilesFunc

type ChangedFilesFunc func(context.Context, string) ([]string, error)

type Command

type Command struct {
	ID      string   `json:"id"`
	Name    string   `json:"name"`
	Command []string `json:"command"`
}

type CommandAgentRunner

type CommandAgentRunner struct {
	Command []string
	// OutputLimit caps captured stdout/stderr per stream in bytes. Zero applies
	// defaultAgentOutputLimit; a negative value disables the cap.
	OutputLimit int
}

func (CommandAgentRunner) Run

type CommandResult

type CommandResult struct {
	ID       string
	ExitCode int
	Stdout   string
	Stderr   string
	Error    string
}

type CommandRunner

type CommandRunner func(context.Context, string, Command) CommandResult

type ContextCheckResult

type ContextCheckResult struct {
	MissingRequiredFiles  []string
	PresentForbiddenFiles []string
}

func (ContextCheckResult) OK

func (result ContextCheckResult) OK() bool

type ContextChecks

type ContextChecks struct {
	RequiredFiles  []string `json:"requiredFiles,omitempty"`
	ForbiddenFiles []string `json:"forbiddenFiles,omitempty"`
}

func (ContextChecks) CheckWorkspace

func (checks ContextChecks) CheckWorkspace(workspace string) (ContextCheckResult, error)

type Harness

type Harness struct {
	Materializer Materializer
	Agent        AgentRunner
	Runner       Runner
}

func (Harness) Run

func (harness Harness) Run(ctx context.Context, suitePath string, suite Suite, input BenchmarkInput) BenchmarkReport

type MaterializeInput

type MaterializeInput struct {
	WorkRoot string
}

type Materializer

type Materializer struct{}

func (Materializer) MaterializeTask

func (Materializer) MaterializeTask(ctx context.Context, suitePath string, task Task, input MaterializeInput) (Workspace, error)

type Report

type Report struct {
	Contract     string   `json:"contract"`
	SuiteID      string   `json:"suiteId"`
	TaskID       string   `json:"taskId"`
	Status       Status   `json:"status"`
	OK           bool     `json:"ok"`
	Summary      Summary  `json:"summary"`
	ChangedFiles []string `json:"changedFiles"`
	Results      []Result `json:"results"`
	Error        string   `json:"error,omitempty"`
}

func Score

func Score(suite Suite, input ScoreInput) Report

type Result

type Result struct {
	ID              string     `json:"id"`
	Name            string     `json:"name"`
	Kind            ResultKind `json:"kind"`
	Status          Status     `json:"status"`
	Command         []string   `json:"command,omitempty"`
	ExitCode        *int       `json:"exitCode,omitempty"`
	Stdout          string     `json:"stdout,omitempty"`
	Stderr          string     `json:"stderr,omitempty"`
	Message         string     `json:"message,omitempty"`
	ExpectedFiles   []string   `json:"expectedFiles,omitempty"`
	ActualFiles     []string   `json:"actualFiles,omitempty"`
	MissingFiles    []string   `json:"missingFiles,omitempty"`
	UnexpectedFiles []string   `json:"unexpectedFiles,omitempty"`
	ExpectedEvents  []string   `json:"expectedEvents,omitempty"`
	ActualEvents    []string   `json:"actualEvents,omitempty"`
	MissingEvents   []string   `json:"missingEvents,omitempty"`
}

type ResultKind

type ResultKind string
const (
	ResultCommand      ResultKind = "command"
	ResultChangedFiles ResultKind = "changed_files"
	ResultContext      ResultKind = "context"
	ResultTrace        ResultKind = "trace"
)

type RunInput

type RunInput struct {
	TaskID        string
	WorkspacePath string
	TraceStdout   string
	// CommandTimeout bounds each verification command. Non-positive applies
	// defaultCommandTimeout.
	CommandTimeout time.Duration
}

type Runner

type Runner struct {
	RunCommand   CommandRunner
	ChangedFiles ChangedFilesFunc
	// contains filtered or unexported fields
}

func (Runner) Run

func (runner Runner) Run(ctx context.Context, suite Suite, input RunInput) Report

type ScoreInput

type ScoreInput struct {
	TaskID             string
	CommandResults     []CommandResult
	ChangedFiles       []string
	ContextCheckResult *ContextCheckResult
	ContextCheckError  string
	TraceStdout        string
	Blocked            bool
	BlockReason        string
}

type Status

type Status string
const (
	StatusPass    Status = "pass"
	StatusFail    Status = "fail"
	StatusBlocked Status = "blocked"
	StatusError   Status = "error"
)

type Suite

type Suite struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Tasks       []Task `json:"tasks"`
}

func LoadSuite

func LoadSuite(path string) (Suite, error)

func (Suite) Validate

func (suite Suite) Validate() error

type Summary

type Summary struct {
	Total   int `json:"total"`
	Passed  int `json:"passed"`
	Failed  int `json:"failed"`
	Blocked int `json:"blocked"`
	Errors  int `json:"errors"`
}

type Task

type Task struct {
	ID                    string        `json:"id"`
	Name                  string        `json:"name"`
	Description           string        `json:"description,omitempty"`
	Tags                  []string      `json:"tags,omitempty"`
	Difficulty            string        `json:"difficulty,omitempty"`
	Prompt                string        `json:"prompt"`
	WorkspaceFixture      string        `json:"workspaceFixture"`
	VerificationCommands  []Command     `json:"verificationCommands"`
	ExpectedChangedFiles  []string      `json:"expectedChangedFiles"`
	ForbiddenChangedFiles []string      `json:"forbiddenChangedFiles,omitempty"`
	RequiredTraceEvents   []string      `json:"requiredTraceEvents,omitempty"`
	ContextChecks         ContextChecks `json:"contextChecks,omitempty"`
}

type ValidationError

type ValidationError struct {
	Problems []string
}

func (ValidationError) Error

func (err ValidationError) Error() string

type Workspace

type Workspace struct {
	Path        string
	TaskID      string
	FixturePath string
}

Jump to

Keyboard shortcuts

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