agentic_ai_basics

interrupts_breakpoints

Interrupts / Breakpoints — predefined conditions that pause execution and surface control to a human or supervisor, checked every loop iteration.

interrupts_breakpoints.py

A research and file-management agent with three independent breakpoint conditions: a token-cost budget, a flagged action (delete_file), and a stuck-loop detector. Type exit to quit.

Concepts covered

Run

From the repo root:

pip install -r requirements.txt
export ANTHROPIC_API_KEY=your-key-here
python3 Execution_Loops/interrupts_breakpoints/interrupts_breakpoints.py

Try:

You: Delete the file old_report.txt

  >>> BREAKPOINT HIT: ACTION breakpoint: 'delete_file' is flagged as requiring a pause before it runs, regardless of arguments.
      [c]ontinue this one call / [a]bort the task? c
  [tool] delete_file({'path': 'old_report.txt'})
  [result] (simulated) Deleted old_report.txt

Configuration

See also