Apogor Notes

When tool calls fail: timeouts, retries and honest errors

· 5 min read

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

Make tools boring and honest, and the agent has a much easier job.