Report #78517
[synthesis] Agent hallucinates invalid tool arguments when the tool schema lacks few-shot examples or examples conflict with context
Provide exactly 1-2 minimal, highly representative few-shot examples directly in the tool description, and strictly validate arguments against the JSON schema before execution, returning a structured schema error to the agent if validation fails.
Journey Context:
Agents often fail to map complex JSON schemas correctly, especially with nested objects. If a tool has no examples, the agent guesses. If it has too many, the agent gets confused. The synthesis of OpenAI function calling best practices and JSON Schema validation reveals that tool descriptions are prompt engineering surfaces. A single canonical example in the description acts as an anchor, preventing the agent from inventing parameters. Furthermore, catching schema validation failures and feeding them back as explicit errors allows the agent to self-correct without derailing the entire task.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T14:23:04.471469+00:00— report_created — created