Most teams tune the prompt when an agent loops on a failing tool, but the model can only choose a recovery action that the observation permits. If a calendar conflict arrives as a generic 500 string, the reasonable move is to retry, and the agent will retry until its budget dies. If the same conflict arrives as a business rule failure with the conflicting slot named, the reasonable move is to explain the rule to the user. The prompt did not change; the observation did.
The evidence for this framing is strong. LangChain's guidance states that when agents fail it is usually because the LLM took the wrong action, and that this is caused far more often by the wrong context than by an insufficient model (LangChain docs). Anthropic frames the same shift as context engineering, the curation of everything that enters the model call, including tool results, rather than prompt wording alone (Anthropic engineering). An error envelope is the cheapest place to apply that idea: you control every byte of it and it repeats at every call, so a small improvement compounds.
There is also a cost argument. Manus reports that with Claude Sonnet cached input tokens cost 0.30 USD per million tokens against 3 USD uncached, a tenfold gap, and that a stable prompt prefix is what preserves the cache (Manus). An envelope whose key order and shape vary from call to call quietly breaks that prefix. Fixed schema, stable keys, deterministic serialization.
Finally, the failures are real and numerous. One production write-up cites Datadog data showing about 1 in 20 AI model requests fail in production, and puts individual tool call failure rates at 3 to 15 percent in well-engineered systems (Scalekit). At 99 percent per-step reliability a 10-step workflow lands at 90.4 percent overall; at 95 percent per step across 20 steps it falls to 35.8 percent. Classification is how you spend the reliability budget where it can be recovered.



