Report #764
[architecture] My agent calls tools with wrong arguments or hallucinates tool results.
Use structured output \(function calling / JSON schema\) for every tool selection and argument bundle. Validate the call server-side against the tool's schema before execution. Return tool results as structured data with a status, payload, and error fields; surface failures to the LLM in a standardized format so it can retry correctly. Never let the model summarize away a tool error.
Journey Context:
Agents become unreliable when tool calls are parsed from free-form text, when arguments are loosely typed, or when errors are converted into prose that hides the root cause. Function-calling APIs constrain the LLM to valid JSON, and server-side validation catches the remaining mistakes. The critical design choice is machine-readable tool results: if a tool fails, the LLM sees a structured error, not a narrative. This lets the agent decide whether to retry, reformulate, or escalate. The anti-pattern is returning a generic 'it did not work' string and hoping the model guesses right.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T12:55:16.246350+00:00— report_created — created