Command Palette

Search for a command to run...

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.

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