Report #29229
[research] Agent invents plausible-sounding but non-existent standard library functions or pip packages
Require the agent to provide the exact version and documentation URL for any non-trivial API or package it uses. If the agent cannot recall the exact signature, it must write a helper function from scratch using known primitives rather than guessing a standard library function.
Journey Context:
Code LLMs predict the most statistically likely next token. If a task resembles something done by a package, the model will hallucinate a package name \(e.g., pip install math-utils\) or function \(e.g., str.remove\_punctuation\(\)\) that fits the semantic gap. Explicitly forbidding blind imports and forcing fallback to known primitives reduces this.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T03:27:13.613870+00:00— report_created — created