Lesson 4: How an Agent “Decides” What to Do

A note on this series. This is written for beginners, on purpose. I’m keeping explanations at a practical, conceptual level rather than a technical one. Several ideas here are described in generic terms rather than their full technical depth. The goal of these seven lessons is to demystify AI agents enough that the hype becomes understandable and ideally to spark enough curiosity that you go looking for the deeper technical material afterward.
Lesson 3 gave us the four building blocks: model, tools, memory, instructions. This lesson is about how they actually run together because that mechanism is the real heart of “agentic AI.” It’s less magical than it sounds and understanding it will make every agent product you encounter easier to evaluate.
The loop: think, act, observe, repeat
A useful way to picture many agents is as a repeating cycle: decide, act, observe, and decide again. Some systems follow this pattern closely; others use upfront planning, fixed workflows, parallel steps, or combinations of these approaches.
- Decide. The model looks at the goal and everything it knows so far and decides what the next step should be.
- Act. If that step requires a tool, the agent calls it: a web search, a file read, an API request.
- Observe. The result of that action comes back and gets added to what the agent can see.
- Decide Again. The agent looks at the updated picture and decides the next step, continuing until the goal is met, it runs out of steps, or it hands control back to a person.
This pattern has a name in the research world, ReAct, short for “Reason plus Act.” It was introduced in a 2022 research paper and has become an influential way of thinking about agent loops. The core idea is simple: reasoning and acting can be interleaved, allowing the system to use new information to adjust what it does next. The core insight is simple: reasoning and acting work better together than separated. The model reasons a little, acts a little, checks the result, and adjusts, rather than planning everything up front and executing blindly.
Why this loop matters more than the model itself
Agents built on the exact same underlying model can behave completely differently depending on how their loop is structured. One agent stops and asks a human before doing something risky. Another double-checks its own work before moving on. A third has a hard cap on how many steps it can take before giving up. These are loop-design decisions, not model capability questions.
That’s also where a lot of the real engineering effort goes in production agent systems. Not a smarter model. A more disciplined loop. A 2026 write-up on production agentic stacks argues that a large share of the effort in safety-critical projects, roughly sixty percent by one practitioner’s estimate, goes into the surrounding infrastructure (observability, validation, retries) rather than into tuning the model itself (Nicoomanesh, Medium, 2026). That’s one practitioner’s estimate, not an industry-wide figure, but it points at something real. Loop discipline, not raw model power, is where production agents earn or lose trust.
Where loops go wrong
A few common failure patterns explain a lot of the skepticism you’ll hear about agents:
- Looping forever. An agent gets stuck retrying the same failed action because it never recognizes it’s not making progress. Good agent designs put a hard cap on steps or time.
- Losing the thread. On a long task, earlier context can get pushed out or diluted and the agent effectively “forgets” its original goal. This is a memory problem, not a reasoning problem.
- Acting on bad information. If a tool returns wrong or manipulated data, the agent’s next decision is only as good as that input. This becomes a genuine security concern once agents pull data from the open internet. Lesson 5 covers it directly, once tools are on the table.
A human-shaped analogy, used carefully
Think about how you’d handle “plan a dinner party.” You don’t write the entire plan in one shot. You pick a date, check who’s free, adjust based on the answer, then think about food, adjust again based on dietary restrictions you learn about along the way. You’re constantly revising based on new information. That back-and-forth, rather than a single upfront plan, is roughly what the think-act-observe loop is doing, just with software instead of texts and phone calls with your friends.
The analogy breaks down in an important way. You have judgment born from lived experience, and the agent has none of that. It’s pattern-matching its way through the loop, not genuinely understanding consequences the way you do. Keep that distinction in mind, because it’s exactly why agents still benefit from human checkpoints on anything that matters.
What to carry into Lesson 5
- The loop is think, act, observe, repeat, formalized in the research world as ReAct. - Loop design, limits, checkpoints, error handling, matters as much as which model powers the agent. - Loops fail in predictable ways: infinite retries, lost context, bad data poisoning the next decision.
Next lesson, I zoom into the “act” step specifically and look at how an agent actually reaches out and touches the real world through tools, including what goes wrong when that reach isn’t constrained.