Varun Vemulapalli

Day 36 of 100 · Phase 5: How AI agents work

The agent loop

2 min readBy Varun Vemulapalli

Every AI agent, from a calendar helper to a coding assistant, runs on the same four-step loop.

Think. Act. Observe. Repeat. Once you see it, agents stop feeling like magic.

Video explainer · 1:45
Key takeaway

An agent is a loop of think, act, observe, repeat, and the stopping conditions you give it matter as much as the goal.

Day 36 visual: The agent loop
The visual from the original post.

The concept

Yesterday (Day 35) we said an agent picks its own steps. Here's how.

  • Think: the model looks at the goal and everything so far, and decides the next step.
  • Act: it calls a tool, like "check calendars" or "send invite". (Tools get their own post tomorrow.)
  • Observe: the tool's result is added to the model's context (Day 20), so it can see what happened.
  • Repeat: back to think, now with more information.

The loop ends on a stopping condition: the goal is met, the agent needs a human, or it hits a limit you set, such as a maximum number of steps.

Walkthrough: moving a 5-person team meeting

Goal: "Move Thursday's 2 p.m. project review to another slot this week. All 5 people must attend."

Loop 1

  • Think: I need everyone's free time.
  • Act: check 5 calendars for Thursday and Friday.
  • Observe: say, two open slots, Thursday 4 p.m. and Friday 10 a.m.

Loop 2

  • Think: Thursday 4 p.m. is soonest. Check a room.
  • Act: search rooms for 4 p.m.
  • Observe: no rooms free. Conflict.

Loop 3

  • Think: try Friday 10 a.m. instead.
  • Act: search rooms for 10 a.m.
  • Observe: Room B is free.

Loop 4

  • Think: everything lines up.
  • Act: propose Friday 10 a.m., Room B, to the organizer for a yes before sending.
  • Observe: approved. Invites go out. Goal met, loop stops.

Notice loop 2. The plan changed because of what the agent observed. A fixed workflow would have broken there.

Stopping conditions matter

Without them, an agent can loop forever, rebooking and re-checking, burning tokens (Day 16) and money. Good agents have:

  • A clear "done" test (all 5 accepted).
  • A step or cost budget (say, max 10 loops).
  • A hand-off rule ("no shared slot this week? ask the organizer").

Where you see it at work

  • Banking: a dispute agent checks the transaction, then the merchant record, then decides what to ask next.
  • Healthcare: a scheduling assistant finds a slot that fits the patient, the doctor and the room.
  • Product owners: write stopping conditions as acceptance criteria. "When is it done?" is a requirement.

In one sentence

An agent is a loop of think, act, observe, repeat, and the stopping conditions you give it matter as much as the goal.

Your turn: what's one repetitive back-and-forth task at your work that is really a think-act-observe loop? 👇

Join the discussion on LinkedIn