A human developer reads a 500, opens the docs, and fixes the call. An LLM has no docs tab. It sees only the tool result you hand back, and it decides the next step from that text alone. When an error says Bad Request with no explanation, the agent learns exactly one thing: something was wrong. It cannot tell whether to retry, rephrase the arguments, or give up, so the common outcomes are a halt or an infinite loop that repeats the same broken input while burning tokens, as Pacholski describes.
This is the central shift for agent-facing tools. Error handling for a machine consumer must be prescriptive, not merely descriptive. Every error should carry what failed, why it failed (which constraint was violated), and what a valid next attempt looks like. That is a different design goal from classic API errors, which assume a human will interpret context the machine does not have.
There is also a structural reason to put this logic in code rather than trust the prompt. The reliability of a production agent lives mostly in the harness around the model, meaning validation, permission checks, and retry handling belong in orchestration code, not in a prompt the model can ignore, as MLflow's practitioner guide puts it. Recovery is a harness responsibility. The model proposes another attempt; the code decides whether that attempt is safe to dispatch.



