Code Plain
Glossary

Agent Loop

The cycle in which an agent perceives, acts, observes the result and decides again.

People coming from API programming picture a call: a request goes in, an answer comes out. An agent does not work that way. It goes around: it reads something, takes an action, looks at what happened, and decides the next step using that new information.

Almost everything that goes wrong in an agent goes wrong on the second turn, not the first. The first one usually looks fine. Repetition is where cost, pointless retries and not knowing when to stop show up.

So the questions that matter are about the turn, not the call: what ends it, what it carries from one to the next, and what each one costs.

Read the article: I counted dcode's loop and found the stopping condition