The agent loop — CCA-F Exam Prep

PencilPrepPencilPrep
L2.17|The agent loop
1/12
Real story
A developer watching a terminal scrolling endlessly. The screen shows repeated API calls, each one returning another tool_use request. A cost counter in the corner climbing past $2,000. The developer's face shows pure panic. Dark office, blue monitor glow.

His agent ran for 6 hours. He woke up to a $4,200 bill.

A developer built a research agent. "Summarize everything about quantum computing." He started it before bed. The agent called a search tool, got results, then decided it needed more context. Called the search tool again. Got more results. Decided it needed even more.

1,847 API calls. 6 hours. $4,200 in Claude API charges. The agent never returned a summary because it never decided it had "enough" information.

The loop had no exit condition. So it never exited.