Skip to main content

Crate adk_eval

Crate adk_eval 

Source
Expand description

§adk-eval

Agent evaluation framework for ADK-Rust.

This crate runs agents against eval sets and scores their tool calls and responses, so agent behaviour can be checked in tests and CI.

§Features

  • Test definitions: JSON eval sets (.test.json) with multi-turn conversations
  • Trajectory evaluation: tool call sequences with ordered or unordered, exact or subset argument matching
  • Response quality: text similarity (exact, contains, Levenshtein, Jaccard, ROUGE)
  • LLM-judged criteria: semantic match, rubrics, safety, and hallucination checks, which fail closed when they cannot be judged
  • Rubric-graded outcomes: OutcomeGrader grades a deliverable per criterion in a context of its own, and RubricCheckAgent ends a LoopAgent once the rubric passes
  • Analysis: structured judge, cost and latency tracking, trace analysis, regression baselines, human annotation, test generation, and conversation metrics
  • Ledger statistics: per-dimension median/MAD baselines and drift detection over a content-free activity ledger (ledger), the statistics behind cargo adk eval --ledger
  • Repeated runs: Evaluator::evaluate_test_file_runs runs an eval set several times and reports each case’s pass rate, score mean and variance, and flakiness (multi_run)
  • Metered judging: Evaluator::set_run_config puts every eval run and judge call under one budget, spend ledger and kill switch; a refusal stops the evaluation
  • Vision: eval cases show the agent image fixtures pinned by digest (ImageFixture), and vision scores regions, masks, OCR text, document fields, detections and click targets in source pixels against each turn’s expectations
  • Online evaluation: online::OnlineEvaluator judges a seeded sample of finished production runs on a background worker, under its own budget and the kill switch, and records the verdicts in an online::OnlineEvalStore and as gen_ai.evaluation.result telemetry
FeatureEnables
embeddingEmbeddingScorer
ci-helpersJunitReporter
statisticsAbComparator
vertex-evalVertex AI Gen AI Evaluation Service bridge
personasSimulated users for multi-turn evaluation
experimentsExperimentAnalyzer: sequential analysis of web experiments with guardrails

§Quick start

use std::sync::Arc;

use adk_core::Agent;
use adk_eval::{EvaluationConfig, EvaluationCriteria, Evaluator};

async fn evaluate(agent: Arc<dyn Agent>) -> adk_eval::Result<()> {
    let criteria = EvaluationCriteria {
        tool_trajectory_score: Some(1.0), // exact tool match
        response_similarity: Some(0.8),   // 80% text similarity
        ..Default::default()
    };
    let evaluator = Evaluator::new(EvaluationConfig::with_criteria(criteria));

    let report = evaluator.evaluate_file(agent, "tests/my_agent.test.json").await?;
    assert!(report.all_passed(), "{}", report.format_summary());
    Ok(())
}

Re-exports§

pub use criteria::EvaluationCriteria;
pub use criteria::ResponseMatchConfig;
pub use criteria::Rubric;
pub use criteria::RubricConfig;
pub use criteria::ToolTrajectoryConfig;
pub use error::EvalError;
pub use error::Result;
pub use evaluator::EvaluationConfig;
pub use evaluator::Evaluator;
pub use evaluator::JUDGE_AGENT_NAME;
pub use llm_judge::LlmJudge;
pub use llm_judge::LlmJudgeConfig;
pub use llm_judge::RubricEvaluationResult;
pub use llm_judge::RubricScore;
pub use llm_judge::SemanticMatchResult;
pub use multi_run::CaseRunSummary;
pub use multi_run::MultiRunConfig;
pub use multi_run::MultiRunReport;
pub use multi_run::PASS_RATE_METRIC;
pub use multi_run::ScoreStats;
pub use report::EvaluationReport;
pub use report::EvaluationResult;
pub use report::Failure;
pub use report::TestCaseResult;
pub use schema::EvalCase;
pub use schema::EvalSet;
pub use schema::ImageFixture;
pub use schema::IntermediateData;
pub use schema::SessionInput;
pub use schema::TestFile;
pub use schema::ToolUse;
pub use schema::Turn;
pub use scoring::ResponseScorer;
pub use scoring::ToolTrajectoryScorer;
pub use vision::VisionAnswer;
pub use vision::VisionCriteria;
pub use vision::VisionExpected;
pub use vision::VisionScores;
pub use outcome::CriterionGrade;
pub use outcome::DEFAULT_OUTCOME_ITERATIONS;
pub use outcome::MAX_OUTCOME_ITERATIONS;
pub use outcome::OutcomeGrade;
pub use outcome::OutcomeGrader;
pub use outcome::RUBRIC_CHECK_OUTPUT_KEY;
pub use outcome::RubricCheckAgent;
pub use outcome::RubricOutcome;
pub use optimizer::AgentCandidates;
pub use optimizer::InstructionCandidates;
pub use optimizer::OptimizationResult;
pub use optimizer::OptimizerConfig;
pub use optimizer::PromptOptimizer;
pub use annotation::AnnotationRecord;
pub use annotation::AnnotationStore;
pub use annotation::HumanVerdict;
pub use baseline::Baseline;
pub use baseline::BaselineStore;
pub use baseline::Regression;
pub use conversation_scorer::ConversationMetrics;
pub use conversation_scorer::ConversationScorer;
pub use conversation_scorer::ConversationScorerConfig;
pub use cost_tracker::CostMetrics;
pub use cost_tracker::CostTracker;
pub use ledger::DailyValue;
pub use ledger::DayClass;
pub use ledger::DeviationConfig;
pub use ledger::DeviationReport;
pub use ledger::DriftState;
pub use ledger::LedgerAssessment;
pub use ledger::LedgerRow;
pub use pricing::ModelPricing;
pub use structured_judge::JudgeRubric;
pub use structured_judge::ScalePoint;
pub use structured_judge::StructuredJudge;
pub use structured_judge::StructuredJudgeConfig;
pub use structured_judge::StructuredVerdict;
pub use structured_judge::Verdict;
pub use test_generator::EvalCaseMetadata;
pub use test_generator::GeneratorConfig;
pub use test_generator::TestGenerator;
pub use trace_analyzer::ToolCallRecord;
pub use trace_analyzer::TraceAnalysis;
pub use trace_analyzer::TraceAnalyzer;
pub use trace_analyzer::TraceDiagnostic;
pub use trace_analyzer::TracePattern;
pub use embedding_scorer::EmbeddingScorer;
pub use junit_reporter::JunitReporter;
pub use ab_comparator::AbComparator;
pub use experiments::ExperimentAnalyzer;
pub use vertex::AutoraterConfig;
pub use vertex::PointwiseMetricResult;
pub use vertex::PointwiseMetricSpec;
pub use vertex::TrajectoryMetric;
pub use vertex::VertexEvalClient;
pub use vertex::VertexEvalConfig;
pub use vertex::VertexEvalJudge;

Modules§

ab_comparator
A/B agent comparison with statistical significance testing.
annotation
Human annotation workflow via JSONL export/import.
baseline
Baseline storage for regression detection.
conversation_scorer
Multi-turn conversation metrics.
cost_tracker
Cost and latency tracking for evaluation runs.
criteria
Evaluation criteria definitions
embedding_scorer
Embedding-based semantic similarity scorer.
error
Error types for the evaluation framework
evaluator
Core evaluator implementation
experiments
Analysis of web experiments: sequential tests with a fixed error budget, effect estimates with intervals, guardrail monitoring, and an optional Bayesian analysis (spec 3.5 §7.12, A-I15, §13 Q8).
junit_reporter
JUnit XML report generation for CI system integration.
ledger
Ledger statistics: per-dimension baselines and drift detection over a content-free activity ledger (spec 3.2 §7.10, §10 E1).
llm_judge
LLM-based evaluation scoring
multi_run
Repeated runs of an eval set: per-case pass rate, score statistics and flakiness.
online
Online evaluation: judge a sampled fraction of production runs after they finish.
optimizer
Prompt optimization engine.
outcome
Rubric-graded outcomes: a grader that checks one deliverable against independently gradeable criteria, and an agent that ends a LoopAgent once the rubric passes.
personas
User personas for agent evaluation.
prelude
Prelude for convenient imports
pricing
Per-model pricing configuration for cost estimation.
report
Evaluation result reporting
schema
Test file schema definitions
scoring
Scoring implementations for evaluation criteria
structured_judge
Structured LLM judge producing typed verdicts.
test_generator
LLM-driven test case generation.
trace_analyzer
Execution trace analysis for detecting inefficiencies.
vertex
Gen AI Evaluation Service bridge (Vertex AI evaluateInstances).
vision
Vision scoring (spec 3.7 §7.16): regions, masks, OCR text, document fields, detections and click targets, compared in the source image’s pixels.