Skip to main content
AgentAsJudgeEval grades an input/output pair against custom criteria with an LLM judge. Score recorded outputs directly with run(), or attach the eval as a post_hook to grade live runs.
from agno.eval import AgentAsJudgeEval, AgentAsJudgeResult

Parameters

ParameterTypeDefaultDescription
criteriastr""Criteria the judge grades the output against.
scoring_strategyLiteral["numeric", "binary"]"binary"How the judge grades. "binary" returns a pass/fail verdict. "numeric" returns a 1-10 score that passes when it meets threshold.
thresholdint7Minimum passing score from 1 to 10. Only used when scoring_strategy is "numeric".
on_failOptional[Callable[[AgentAsJudgeEvaluation], None]]NoneCallback invoked with the evaluation when it fails. Async callbacks require arun().
additional_guidelinesOptional[Union[str, List[str]]]NoneGuidelines appended to the default judge’s instructions.
nameOptional[str]NoneEvaluation name.
modelOptional[Model]NoneModel for the default judge agent. Falls back to OpenAI gpt-5-mini when unset.
evaluator_agentOptional[Agent]NoneCustom judge agent. Its output_schema is replaced with the response schema matching scoring_strategy.
print_summaryboolFalsePrint the summary table with pass rate and score statistics after the run.
print_resultsboolFalsePrint the per-evaluation results after the run.
show_spinnerboolTrueRender the progress spinner. Set to False when the eval runs inside code that must not write to the console.
file_path_to_save_resultsOptional[str]NoneFile path where the result is saved.
debug_modeboolFalseEnable debug logs. Defaults to True when the AGNO_DEBUG environment variable is "true".
dbOptional[Union[BaseDb, AsyncBaseDb]]NoneDatabase where the eval run is stored.
telemetryboolTrueLog minimal telemetry for the eval run.
run_in_backgroundboolFalseRun the eval in the background when attached as a post_hook, without blocking the agent’s response. Takes effect only when the run is served through AgentOS, which supplies the background task queue; direct run() and arun() calls on the agent execute the eval inline.

Methods

run() and arun()

Both accept the same keyword arguments and return Optional[AgentAsJudgeResult]. Provide either input and output for a single evaluation, or cases for batch evaluation. run() raises with an async database; use arun() instead.
ArgumentTypeDefaultDescription
inputOptional[str]NoneInput text for a single evaluation.
outputOptional[str]NoneOutput text for a single evaluation.
casesOptional[List[Dict[str, str]]]NoneBatch of dicts with input and output keys, evaluated in order.
print_summaryboolFalsePrint the summary table after the run.
print_resultsboolFalsePrint the per-evaluation results after the run.

Hook methods

AgentAsJudgeEval extends BaseEval, so an instance can be passed directly to an Agent’s or Team’s post_hooks. The post_check() and async_post_check() methods grade the run’s input and output and log the result to db with the agent or team ID attached. Pre-hooks are not supported and raise ValueError.

AgentAsJudgeResult

FieldTypeDescription
run_idstrUnique ID for this evaluation run.
resultsList[AgentAsJudgeEvaluation]One entry per evaluated input/output pair.
avg_scoreOptional[float]Average score. None in binary mode.
min_scoreOptional[float]Lowest score. None in binary mode.
max_scoreOptional[float]Highest score. None in binary mode.
std_dev_scoreOptional[float]Standard deviation of scores. None in binary mode.
pass_ratefloatPercentage of evaluations that passed, from 0 to 100.
AgentAsJudgeResult also exposes print_summary(console=None) and print_results(console=None).

AgentAsJudgeEvaluation

Each entry in AgentAsJudgeResult.results is an AgentAsJudgeEvaluation:
FieldTypeDescription
inputstrInput text that was evaluated.
outputstrOutput text that was evaluated.
criteriastrCriteria the output was graded against.
scoreOptional[int]Score from 1 to 10 in numeric mode. None in binary mode.
reasonstrThe judge’s reasoning for the verdict.
passedboolWhether the evaluation passed. In numeric mode, True when score >= threshold.