Skip to content

Eval Harness

kairox-eval is a headless benchmark runner for Kairox agent sessions. It runs JSONL scenarios through the same LocalRuntime/AppFacade path used by the TUI and GUI, records per-scenario JSONL results, and writes aggregate metrics for version-to-version comparisons.

Run

bash
cargo run -p agent-eval --bin kairox-eval -- run \
  --scenarios examples/eval/smoke.jsonl \
  --output target/eval/results.jsonl \
  --summary target/eval/summary.json \
  --workspace .

By default the harness:

  • loads normal Kairox model configuration for the selected workspace;
  • uses on_request approval with workspace_write sandbox by default;
  • enables built-in tools rooted at --workspace;
  • disables MCP servers and hooks for reproducibility.

Use --enable-mcp or --enable-hooks only when the benchmark explicitly depends on them.

Scenario format

Each non-empty, non-comment JSONL row is one scenario:

json
{
  "id": "fake-smoke",
  "prompt": "Say hello from the configured fake model.",
  "profile": "fake",
  "approval_policy": "on_request",
  "sandbox_policy": { "kind": "workspace_write" },
  "tags": ["smoke"],
  "expected": {
    "assistant_contains": ["Kairox"],
    "event_types": ["UserMessageAdded", "AssistantMessageCompleted"],
    "min_tool_invocations": 0,
    "max_tool_failures": 0
  }
}
FieldRequiredDescription
idyesUnique scenario identifier
promptyesUser message sent to the agent
profilenoModel profile override (falls back to --profile, then config default)
approval_policynonever / on_request / always
sandbox_policyno{ "kind": "read_only" } / { "kind": "workspace_write" } / { "kind": "full_access" }
tagsnoString tags for --tags filtering
expectednoAssertion block (see below)

Expectations

FieldTypeDescription
assistant_containsstring[]Substrings the assistant response must contain
event_typesstring[]Domain event types that must appear in the trace
min_tool_invocationsnumberMinimum tool calls expected
max_tool_failuresnumberMaximum tool failures allowed before marking the scenario as failed

Result metrics

Each result row includes:

  • pass/fail state and expectation failures;
  • selected profile;
  • final assistant response;
  • elapsed time;
  • event type sequence;
  • tool invocation and failure counts;
  • last context input token estimate and context window when emitted by runtime;
  • optional full trace when --include-trace is set.

The summary reports total cases, pass count, success rate, elapsed time, tool counts, and summed context input token estimates.

CLI flags

FlagDefaultDescription
--scenariosrequiredPath to JSONL scenario file
--outputrequiredPath for per-scenario JSONL results
--summaryrequiredPath for aggregate JSON summary
--workspace.Workspace root for tool sandboxing
--profileconfig defaultDefault model profile
--tagsallComma-separated tag filter
--fail-fastfalseStop on first failure
--include-tracefalseInclude full event trace in results
--enable-mcpfalseEnable MCP servers during scenarios
--enable-hooksfalseEnable hooks during scenarios

Architecture

The eval harness is built on the same LocalRuntime used by the TUI and GUI. It exercises the full runtime path — model calls, tool execution, policy enforcement, context budgeting — without any UI layer. This ensures that eval results reflect production behavior.

Key types in agent-eval:

  • EvalHarness — orchestrates scenario execution, manages runtime setup and teardown.
  • EvalScenario — parsed JSONL row with prompt, profile, policy, tags, and expectations.
  • EvalReport — aggregates individual scenario results into a summary.

Released under the Apache-2.0 License.