AG-015Agent · Final resultlayaeval.AgentHallucinationRisk
Agent Hallucination
Did the agent claim results that never happened?
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
| Parameter | Value | Description |
|---|---|---|
| Class | AgentHallucinationRisk | Python evaluator class in layaeval |
| Required Fields | "tool_outputs", "context", "response" | Arguments expected in the call signature |
| Default Threshold | <= 0.30 | Passes when risk score is at or below this value |
| Category | Agent Evaluation | Final result (Is the last message true, complete and correct?) |
Python Example
agent-hallucination.py
1from layaeval import AgentHallucinationRisk23metric = AgentHallucinationRisk(threshold=0.30) # passes when risk is at or below 0.3045res = 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)1011print(res.passed, res.value, res.confidence)
Related Agent Checks
Other checks in Final result
AG-014Read →
Agent Groundedness
Is the final answer backed by what the tools returned?
AG-016Read →
Agent Response Relevance
Does the final message answer the user's request?
AG-017Read →
Answer Completeness
Did the final reply cover every part of the task?
AG-018Read →
Agent Correctness
Is the final result the correct one?