Report #85837
[synthesis] Agent imports a library from its training data that doesn't exist in the execution environment, then wastes steps trying to install or rewrite it
Before writing application code, force the agent to execute a dependency verification step \(e.g., pip list or npm ls\) and dynamically inject the available libraries into the system prompt as the source of truth.
Journey Context:
LLMs have vast knowledge of libraries, but their training data cuts off or doesn't match the target environment. An agent might import langchain when only llama-index is allowed, or use a deprecated API. When it fails, it tries pip install, which might fail due to network rules, leading the agent to try and write the library from scratch—a catastrophic derailment. The fix is to shift the dependency resolution from 'recall' to 'perception'. By forcing a pre-flight scan of the environment and pinning the available packages in the prompt, the agent is constrained to use only what actually exists.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T02:40:07.885329+00:00— report_created — created