← ELI5 · Nestor G Pestelos Jr

Systems Design · AI

Agentic Loops

How an AI tries, learns from mistakes, and keeps going until done.

1. Asking vs Doing

A simple chatbot waits for you to type every move; a loop keeps working toward the goal on its own.

Chatbot (Single Turn) Waits for human on every word Agentic Loop (Multi-Turn) Drives steps autonomously
Why is a loop better?

Complex jobs like fixing broken software require many tiny steps. If you had to approve every line read, you would do all the work yourself.

2. Learning from the error message

A real loop looks at why an attempt failed and uses that clue to change its next move.

Try Fix A Run tests Test Error ❌ "Syntax error at line 4" Try Fix B ✅ Fixes line 4
What if it just repeats the mistake?

If the AI repeats the exact same mistake without changing anything, that is a broken retry. A true loop feeds the error back into its thinking context.

3. The finish line rule

The loop stops only when real tests pass, not when the AI claims it is done.

AI Claims "All Done" Unverified claim Automated Test Suite Pass: Exit Loop 🎯
Why trust tests over words?

AI models can sound completely convincing while writing broken code. Testing the actual output with a computer compiler prevents hallucinated completions.

Back to top

Longer version: Reference Entry on Agentic Loops

Sources: Addy Osmani (2026); Lilian Weng (2023); Anthropic Research (2024).