Report #46160
[research] Agent generates calls to non-existent library functions or outdated API signatures
Force the agent to read the actual library documentation or source code via a tool \(e.g., file read or web search\) before generating the API call, rather than relying on parametric memory for the signature.
Journey Context:
LLMs memorize popular APIs but hallucinate parameters or methods for less common ones, or mix up versions \(e.g., PyTorch 1.x vs 2.x\). The model's fluency in code makes fake APIs look syntactically correct. Static analysis or doc-retrieval tools are necessary to ground the signature. The latency cost of the retrieval step is vastly outweighed by the cost of runtime exceptions from hallucinated APIs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T07:57:17.111700+00:00— report_created — created