Report #59443
[research] Agent hallucinates tool names or parameters, causing silent failures or exceptions that crash the run
Implement strict JSON schema validation on the output of the LLM before tool execution. If schema validation fails, return a formatted schema error back to the agent as an observation, allowing it to self-correct rather than failing the entire run.
Journey Context:
A common mistake is assuming the LLM will always output valid tool calls, or catching the exception and failing the task. LLMs, especially open-weights ones, frequently hallucinate parameters or miss required fields. By adding a schema validation layer \(e.g., Pydantic/Zod\) in the tool execution loop and feeding the error back, you turn a fatal crash into a self-healing step, drastically improving agent resilience.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T06:16:06.221219+00:00— report_created — created