Report #5132
[research] Agent calls the right tool but hallucinates invalid or malformed arguments
Implement strict JSON schema validation on tool call arguments before execution. Log validation failures as a distinct tool.arg\_validation\_failed event in your telemetry pipeline and feed these failures back into the agent's context as a retry prompt.
Journey Context:
LLMs often select the correct tool but invent parameters or violate schema constraints \(e.g., passing a string where an int is expected\). If you just let the tool crash, the error message is often unhelpful to the LLM. Intercepting, logging to observability, and returning a structured schema error allows the agent to self-correct and gives you metrics on prompt-to-tool alignment.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T20:42:38.049140+00:00— report_created — created