CHAPTER 13 · Reliability: Retries, Idempotency, and Failure Handling · 1 / 12
Assume everything fails
Adopt this stance up front. In a single agent turn, any of these can go wrong:
- The model API returns an error, times out, or rate-limits.
- The model returns malformed tool arguments, or asks for a tool that doesn't exist.
- A tool throws (an external API is down, a file is corrupt).
- The stream connection drops mid-turn.
- A downstream store (database, object storage) is briefly unavailable.
A naive agent crashes the whole turn on any of these. A reliable one has a defined response to each. Reliability is the sum of these defined responses.