Report #543
[architecture] LLM tool use keeps failing with malformed arguments or missing fields
Validate tool schemas server-side independently of the LLM, wrap calls in deterministic retries with exponential backoff, and feed validation errors plus a few correct tool-call examples back to the model on each retry.
Journey Context:
Models hallucinate parameter names, omit required fields, pass strings where objects are expected, and drift from your schema. 'Better prompting' alone does not fix this. The robust pattern is layered: strict JSON schema validation after the model returns, a retry loop that shows the model exactly what went wrong, and curated few-shot examples of valid calls. OpenAI and Anthropic function-calling APIs reduce these failures but do not eliminate them; never trust the model to produce valid arguments without validation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T09:52:22.829201+00:00— report_created — created