The loop is the heart of an Agent. What do I see, what does it mean, what should I do, and is the result actually done — it runs through this again and again.
Let's think about it this way for a moment
Observe means reading the current state — the user's goal, the previous tool's result, and what's still left to do. Think means deciding what the next step should be. Act means calling a tool, or declaring the task done. Skip a limit on this loop, and an Agent can spin through 50 iterations, burning both money and time. A good Agent takes short steps and checks in often to stop and verify.
Let's connect this to everyday life
Goal — "pull 3 TODOs out of the lesson notes." Observe: notes.txt exists. Think: I need to read the file. Act: read_file. Observe: found 5 TODOs. Think: only 3 are needed. Act: pick the ones relevant to today. Stop: show the list of 3, then stop. Writing it out step by step like this is what makes it debuggable. Don't leave the loop only in your head.
Let's try it out together
step 1 observe: user wants 3 TODOs from notes.txt
step 2 think: I must read the file first
step 3 act: read_file(notes.txt)
step 4 observe: 5 TODO lines found
step 5 think: pick the 3 dated today
step 6 act: return the list and STOPYou'll be able to trace a single pass of an Agent loop in writing.5-minute try-it
For the goal "list out the .md file names in this folder," write out 4 loop passes yourself. Split each pass into Observe / Think / Act.
A quick word of caution
A loop with no end drives up both cost and errors. Cap your first Agent at no more than 5 steps.