Skip to content

Exercise 05 — Debug Looping Agent

Timebox: 30 minutes

Goal

Use buggy_agent.py to practice debugging an agent that keeps repeating the same failing tool call.

Work in

  • buggy_agent.py

Tasks

  1. Add an explicit iteration cap.
  2. Stop repeating the same failing tool call forever.
  3. Surface a clean failure when the tool keeps failing.
  4. Log enough trace information to explain what happened.

Done when

  • The script terminates cleanly
  • The failure is visible and understandable
  • The agent does not keep retrying the same broken step forever