agenteval

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package agenteval provides a benchmark harness for evaluating agent capability. Tasks are defined as Markdown files with frontmatter, a prompt section, and a shell grader section. Each task runs the agent against a real workspace and grades the result by executing shell commands whose exit code determines pass/fail.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EvalSummary

type EvalSummary struct {
	Total            int
	Passed           int
	TotalTokens      int
	PromptTokens     int
	CompletionTokens int
	TotalToolCalls   int
	TotalDuration    time.Duration
}

EvalSummary holds aggregate stats across all tasks in a run.

func (*EvalSummary) Add

func (s *EvalSummary) Add(r TaskResult)

Add folds one TaskResult into the summary.

func (*EvalSummary) Print

func (s *EvalSummary) Print()

Print writes the aggregate stats block to stdout.

type Runner

type Runner struct {
	// ModelName overrides the default model from settings.yaml when non-empty.
	ModelName string
}

Runner executes benchmark tasks against the agent.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, task Task) TaskResult

Run executes one task and returns the result. It copies the fixture directory to a fresh temp workspace, runs the agent, then executes the grader script to determine pass/fail.

type Task

type Task struct {
	// ID is the unique identifier (from frontmatter or derived from filename).
	ID string
	// Title is a short human-readable name shown in output.
	Title string
	// TimeoutSecs is the per-task wall-clock timeout covering agent run + grading.
	TimeoutSecs int
	// FixtureDir is the directory to copy into a temp workspace before the agent runs.
	// Empty means the agent starts in an empty workspace.
	FixtureDir string
	// Prompt is the task description sent to the agent as the user message.
	Prompt string
	// Grader is a shell script executed in the workspace after the agent run.
	// Exit code 0 means pass; non-zero means fail.
	Grader string
}

Task is one benchmark task parsed from a Markdown definition file.

func LoadCatalog

func LoadCatalog(dir string) ([]Task, error)

LoadCatalog loads all task definitions from dir. Each subdirectory that contains a task.md file is treated as one task. The task directory itself is used as the fixture workspace — the runner copies all files in the directory (including task.md) into a fresh temp workspace. Directories without a task.md are silently skipped.

func ParseTask

func ParseTask(data []byte, fixtureBase string) (Task, error)

ParseTask parses a task Markdown file. fixtureBase is the path to use for FixtureDir when the frontmatter does not specify one explicitly (convention: same path as the .md file without extension).

type TaskResult

type TaskResult struct {
	TaskID    string        `json:"task_id"`
	Title     string        `json:"title"`
	Pass      bool          `json:"pass"`
	Duration  time.Duration `json:"duration_ns"`
	Model     string        `json:"model"`
	Timestamp time.Time     `json:"timestamp"`
	// Token counts for the agent run (all LLM calls summed).
	PromptTokens     int    `json:"prompt_tokens"`
	CompletionTokens int    `json:"completion_tokens"`
	TotalTokens      int    `json:"total_tokens"`
	ToolCalls        int    `json:"tool_calls"`
	Reply            string `json:"reply,omitempty"`
	GraderOutput     string `json:"grader_output,omitempty"`
	AgentError       string `json:"agent_error,omitempty"`
	GraderError      string `json:"grader_error,omitempty"`
}

TaskResult records the outcome of one task run.

func (TaskResult) MarshalJSONLine

func (r TaskResult) MarshalJSONLine() ([]byte, error)

MarshalJSONLine serialises the result as a single-line JSON record.

func (TaskResult) Summary

func (r TaskResult) Summary() string

Summary returns a human-readable line for terminal output including token stats.

Jump to

Keyboard shortcuts

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