Error handling and graceful degradation
Catch tool and service errors, feed them back to the agent so it can adapt, and degrade to a safe fallback instead of crashing or guessing.
Surface errors to the agent
When a tool fails, the agent should hear about it in a form it can act on. Passing a clear error back into the loop lets the agent choose another path, retry, or ask for help. Swallowing the error silently guarantees the agent proceeds on a false assumption.
Degrade gracefully
Not every failure should stop the whole task. Decide in advance what a partial result looks like and when the agent should fall back to it: a simpler answer, a smaller scope, or an honest "I could not complete this." A graceful degradation beats a confident wrong result every time.
Fail safe, not open
When in doubt, the safe default is to do nothing irreversible. An agent that stops and escalates on an error it cannot handle is more reliable than one that plows ahead to avoid looking stuck.
Key takeaways
- Feed tool errors back to the agent so it can adapt or escalate.
- Define graceful fallbacks instead of crashing or guessing.
- Default to safe inaction when a failure cannot be handled.