Skip to content
Agent Month

Hallucination

Last verified: June 2026· definition

Hallucination happens because language models generate likely continuations, not verified facts. The output can be fluent and authoritative while being incorrect — inventing an API, a citation, or a number.

Mitigations include grounding the model with retrieved, citable context (RAG), constraining output with schemas, adding verification steps, and measuring with evals so hallucination rates are visible.

In agentic coding specifically, hallucinated APIs and dependencies are a real risk, which is why tests, type checks, and review hooks matter for AI-generated code.