When tool calls fail: timeouts, retries and honest errors
When we reviewed a month of failed agent runs, we expected to find reasoning mistakes. We found some, but most failures started earlier: a tool that never returned, one that returned an empty list when the real answer was "I could not connect", or one that did half of its work before throwing an error.
Every tool gets a timeout
An agent waiting forever on one call is worse than an agent that fails quickly. Each tool now has its own time limit, chosen from what the call normally takes, and the agent is told when a call timed out instead of receiving nothing.
Errors the model can act on
A raw stack trace is not useful to a model. We return short, structured errors that say what happened and what the agent can do next:
{
"error": "rate_limited",
"message": "The search service is busy.",
"retry_after_seconds": 20
}
With that, the agent either waits and retries or moves on to a different step. Before, it often decided the data did not exist.
Never return a misleading success
The worst bug we had was a lookup tool that returned an empty result when its database connection failed. The agent reported, confidently, that a customer had no orders. Empty and failed must look different. Now they do.
Retries belong in the tool, mostly
- Transient network errors are retried inside the tool, with backoff, before the agent ever sees them.
- Calls with side effects, such as sending a message or writing a record, carry an idempotency key so a retry cannot do the work twice.
- The agent only decides about retries that need judgement, like trying a different query.
Make tools boring and honest, and the agent has a much easier job.