Skip to main content
All Python modules · Import and compatibility guidance

Metric return values

Native scorer contract

The evaluator calls the function with four positional values: Scorers may be sync or async; use async I/O for network calls. They receive ADK evaluation inputs, not a Harnest runtime or storage client. Actual and golden invocation counts can differ. Check the index before accessing expected[index], and handle expected=None for simulations.

Native result contract

A scored EvaluationResult requires one ordered PerInvocationResult per actual invocation. Entirely NOT_EVALUATED results are exempt. Keep aggregate and per-turn scores consistent: the CLI gate compares the mean of scored turns with the threshold. For final-turn scoring, mark earlier rows NOT_EVALUATED and use the last turn’s score as the overall score. Entirely unscored metrics cannot pass. See the walkthrough for mean-of-turns scoring.

EvalRunResult envelope

The current contract is identified by:
Branch consumers on apiVersion. The result schema is versioned independently from the installed ADK’s nested case models.
The abbreviated empty invocation and session objects above stand in for complete ADK-shaped data in a real result.

Top-level fields

Case diagnostics

Each evalCaseResults item preserves:
  • Overall result, score, criterion, and details for every metric.
  • Per-invocation metric results.
  • Complete actual invocations and optional expected invocations.
  • User content, final responses, intermediate events, tool evidence, and applicable rubrics carried by those invocations.
  • Evaluator session ID, user ID, and session details, including state and recorded events.
  • Rubric scores and rationales in each metric’s details.rubricScores when the evaluator supplies them.
Statuses are lowercase names. not_evaluated means no score; the CLI averages scored turns only.

Infrastructure errors

If evaluation has started and a provider, adapter, or evaluator raises an infrastructure error, Harnest emits or writes the partial result before reporting the original command failure. Its top-level error excerpt looks like this:
Harnest omits the original exception message, traceback, and internals from this field because provider errors can contain credentials or request content. Failures before the eval lane starts, such as compilation, unit tests, or invalid configuration, may produce no result file. EvaluationExecutionError means execution or scoring failed without metric results. Follow its safe diagnostic message and inspect the local traceback. Fix runtime problems before reassessing quality.

Judge configuration

Exports

EVAL_TRAJECTORIES

EvalRunnerContext

One runner’s options, agent HTTP client, project inputs, and private report directory.
Fields (— means no declared default):

EvalRunnerResult

A quality verdict and optional report files relative to the runner’s directory.
Fields (— means no declared default):

EvaluationError

An evaluation request cannot be executed with the installed runtime.

MetricContext

A case’s native ADK evidence, available to sync and async Harnest scorers.
Fields (— means no declared default):

MetricContext.threshold

Read the authored criterion instead of ADK’s deprecated threshold field.

MetricScore

One finite score and optional human-readable evidence; None means unscored.
Fields (— means no declared default):

adk_eval_agent_module

Expose isolated native plugins with managed identity and error reporting.

eval_config

Load criteria with shared model defaults and the selected trajectory.

eval_dependencies

Validate the shared evaluation engine before loading either framework adapter.

metric

Adapt a context-based scorer to ADK’s four-argument custom metric contract. Return a MetricScore for the whole conversation, a sequence with one score per actual invocation, or a native ADK EvaluationResult. Native ADK scorers can also remain undecorated and register through the same customMetrics map.

require_eval_trajectory

Reject unknown tool-trajectory policies at every evaluation entrypoint.

supported_metric_names

Reflect the installed ADK metric registry instead of freezing an allowlist.