Skip to content
All challenges
AgentsAdvanced

Tool error cascade

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.

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
Tasks
  • 1Fix the tool wrapper
  • 2Fix the agent loop's error handling
  • 3Design graceful degradation