Skip to content

The Agent Loop

Agents are basically a loop. They plan ((specification) is a detailed description or plan of what you’re building - the requirements, behavior, and constraints.), they act, they observe, and then they repeat.

You give it a task. “Build a landing page.” First, it plans. It thinks, okay, these files need to be created, these dependencies need to be installed, this structure needs to be set up. Then it acts. It starts creating files, writing code, running commands. Then it observes. It looks at what happened. Did it work? Is there an error? Does the page actually load? And based on what it observes, it either moves on to the next thing or it goes back and fixes what broke.

And this loop keeps going until the task is done or it gets stuck. When it gets stuck, that’s when it asks you for help. “This was tried but it didn’t work, what should be done?” And you give it more context or a different direction, and it continues the loop.