Your agent depends on a weather API. When the API returns 500s, the agent retries 8 times, then crashes with an unhandled exception instead of answering with available information.
How to investigate a failure that reaches the user
Step 1 of 5
Reproduce it
Make the dependency fail on demand, with a stub or a forced bad response, so you can watch the failure instead of waiting for it.
Step 2 of 5
Read the stack
Start at the error the user saw and read down to where it first appeared. Note every layer the error passed through.
Step 3 of 5
Check each layer
For each layer, ask three things. What does it do when the call below fails? Does it retry? Does it pass the error up or absorb it?
Step 4 of 5
Time the retries
Count the attempts made and measure how long each one waits. Note what the user experiences during all of that.
Step 5 of 5
Define success
Write down what a good outcome looks like when this dependency is down. Then test that case on purpose.
Follow the error from the user's screen to the first place it could have been handled.
Symptoms
Agent fails on weather API 500s
Tool retries 8x then throws
Agent crashes instead of graceful degradation
User gets a 500 page
Evidence
Tool wrapper
def get_weather(city):
return requests.get(f'{API}/{city}').json() # no retry, no error handling
Agent loop
tool_result = tool.fn(**args) # propagates exception
# no try/except around tool execution
Error log
ConnectionError at tool execution
500 Internal Server Error returned to user