Report #65743
[synthesis] Agent hallucinates non-existent parameters or endpoints in a tool call because the API spec was too long
Instead of providing the full OpenAPI spec in the system prompt, dynamically retrieve only the relevant endpoint schema using a tool-search tool, and strictly validate the generated tool call JSON against that specific schema before execution.
Journey Context:
When provided with a massive OpenAPI specification \(e.g., Kubernetes, AWS\), the LLM suffers from 'lost in the middle' attention degradation. It will confidently blend parameters from two different endpoints or invent parameters that seem logically plausible for the target endpoint. Truncating the spec leads to missing required fields. The synthesis is that API specs must be treated as a retrieval problem, not a context problem. Dynamically injecting only the exact schema needed for the current step drastically reduces parameter hallucination while preserving strict schema compliance.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:49:43.225098+00:00— report_created — created