AG-015Agent · Final resultlayaeval.AgentHallucinationRisk

Agent Hallucination

Did the agent claim results that never happened?

TOOL RESULTAGENT SAYSFound: LumièrePrice: $180Status: bookedFound LumièrePrice is $180Room is bookedOnly real results
Simulation state:
When it passes

Only real results.

Threshold satisfied: evaluation score <= 0.30.

When it fails

Claimed something it never saw.

Violation detected: execution flagged for human review or fallback routing.

SDK Specification

ParameterValueDescription
ClassAgentHallucinationRiskPython evaluator class in layaeval
Required Fields"tool_outputs", "context", "response"Arguments expected in the call signature
Default Threshold<= 0.30Passes when risk score is at or below this value
CategoryAgent EvaluationFinal result (Is the last message true, complete and correct?)

Python Example

pip install layaeval
agent-hallucination.py
1from layaeval import AgentHallucinationRisk
2
3metric = AgentHallucinationRisk(threshold=0.30) # passes when risk is at or below 0.30
4
5res = metric(
6 tool_outputs="[{id: 12, name: 'Hotel Lumière', price: 180}]",
7 context="Paris is the capital of France.",
8 response="Paris is the capital of France.",
9)
10
11print(res.passed, res.value, res.confidence)

Related Agent Checks

Other checks in Final result

View all 42 checks →