Skip to main content
AccuracyEval runs an agent or team against an input, then scores the response against an expected output with an evaluator agent on a 1-10 scale.
from agno.eval import AccuracyEval, AccuracyResult

Parameters

ParameterTypeDefaultDescription
inputUnion[str, Callable]RequiredInput sent to the agent or team. A callable must return the input string.
expected_outputUnion[str, Callable]RequiredExpected answer the evaluator scores against. A callable must return the expected string.
agentOptional[Agent]NoneAgent to evaluate. Provide exactly one of agent or team.
teamOptional[Team]NoneTeam to evaluate. Provide exactly one of agent or team.
nameOptional[str]NoneEvaluation name.
eval_idstrAutogenerated UUIDEvaluation ID.
num_iterationsint1Number of times the input is run and scored.
modelOptional[Model]NoneModel for the default evaluator agent. Falls back to OpenAI o4-mini when unset.
evaluator_agentOptional[Agent]NoneCustom agent that scores the response. Replaces the default evaluator.
additional_guidelinesOptional[Union[str, List[str]]]NoneGuidelines appended to the default evaluator’s instructions.
additional_contextOptional[str]NoneContext appended to the default evaluator’s instructions.
print_summaryboolFalsePrint the summary table with score statistics after the run.
print_resultsboolFalsePrint the per-iteration results table 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.
resultOptional[AccuracyResult]NoneResult of the evaluation. Set after a run completes.

Methods

MethodReturn typeDescription
run(*, print_summary=True, print_results=True)Optional[AccuracyResult]Run the agent or team num_iterations times and score each response. Raises with an async database; use arun() instead.
arun(*, print_summary=True, print_results=True)Optional[AccuracyResult]Async version of run().
run_with_output(*, output, print_summary=True, print_results=True)Optional[AccuracyResult]Score the given output string instead of running the agent or team.
arun_with_output(*, output, print_summary=True, print_results=True)Optional[AccuracyResult]Async version of run_with_output().

AccuracyResult

FieldTypeDescription
resultsList[AccuracyEvaluation]One entry per scored iteration.
avg_scoreOptional[float]Average score across iterations. None when there are no results.
mean_scoreOptional[float]Mean score across iterations. Same value as avg_score.
min_scoreOptional[float]Lowest score across iterations.
max_scoreOptional[float]Highest score across iterations.
std_dev_scoreOptional[float]Standard deviation of scores. 0 with a single result.
AccuracyResult also exposes print_summary(console=None) and print_results(console=None) to render the statistics and per-iteration tables.

AccuracyEvaluation

Each entry in AccuracyResult.results is an AccuracyEvaluation:
FieldTypeDescription
inputstrInput sent to the agent or team.
outputstrResponse produced by the agent or team.
expected_outputstrExpected answer the response was scored against.
scoreintAccuracy score from 1 to 10.
reasonstrThe evaluator’s reasoning for the score.