Skip to content

API Reference parrot.eval.evaluators.state_based

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.eval.evaluators.state_based

View source

State-based evaluator and metric for the Generic Agent Evaluation Harness.

FEAT-217 — Module 7.

StateMatch Metric that does a subset diff of the final world state against the annotated goal_state. Only keys present in goal_state are asserted; extra state the agent touched is ignored. Score = matched_assertions / total_assertions.

StateBasedEvaluator Evaluator that runs StateMatch and optionally checks forbidden entities. passed iff all goal assertions hold AND no forbidden entity is present.

Alias AbstractEvaluator

Re-exported from parrot.eval.evaluators.base.AbstractEvaluator.

Alias EvalResult

Re-exported from parrot.eval.models.EvalResult.

Alias EvalTask

Re-exported from parrot.eval.models.EvalTask.

Alias Metric

Re-exported from parrot.eval.evaluators.base.Metric.

Alias MetricScore

Re-exported from parrot.eval.models.MetricScore.

Alias Sandbox

Re-exported from parrot.eval.sandbox.base.Sandbox.

Class StateBasedEvaluator

Evaluator for state-based (τ-bench style) agent tasks.

Uses a single StateMatch metric: diff the post-rollout world against the annotated goal_state + forbidden in task.expected.

Scoring is path-independent — only the final world state matters, not the sequence of tool calls that produced it. Re-scoring is fully offline when trajectory.final_state is populated.

Method StateBasedEvaluator.evaluate

Evaluate the trajectory using state-match scoring.

evaluate(task: EvalTask, trajectory: Trajectory, sandbox: Sandbox | None = None) -> EvalResult

Parameter Type Default Description
task EvalTask Eval task with expected.goal_state and optional expected.forbidden.
trajectory Trajectory The recorded agent trajectory.
sandbox Sandbox | None None Live sandbox (fallback if final_state is None).

Returns: EvalResult — EvalResult with the "state_match" score and passed reflecting all goal assertions + forbidden check.

Class StateMatch

Subset-match metric comparing final state to goal_state.

passed: True iff all goal assertions match AND no forbidden entity is present in the final state.

detail: {"mismatches": [...], "forbidden_present": [...]}

The evaluator prefers trajectory.final_state over a live sandbox.snapshot() so re-scoring works fully offline (spec D5).

Method StateMatch.score

Compute the state-match score.

score(task: EvalTask, trajectory: Trajectory, sandbox: Sandbox | None = None) -> MetricScore

Parameter Type Default Description
task EvalTask Eval task with expected dict containing optional goal_state and forbidden keys.
trajectory Trajectory The recorded agent trajectory; final_state used when available.
sandbox Sandbox | None None Live sandbox (fallback if final_state is None).

Returns: MetricScore — MetricScore for the "state_match" metric.

Alias Trajectory

Re-exported from parrot.eval.models.Trajectory.

Attribute logger

Alias register_evaluator

Re-exported from parrot.eval.registry.register_evaluator.

Alias register_metric

Re-exported from parrot.eval.registry.register_metric.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally