Lesson 4 of 13

How Agents Think and Act

The Reasoning Loop

3 min read

At the heart of every AI agent is a simple but powerful pattern: observe, think, act, repeat. Understanding this loop helps you predict how agents behave—and why they sometimes struggle.

The Basic Loop

Every time an agent works on a task, it cycles through these steps:

  1. Observe — What's the current situation? What information is available?
  2. Think — What should I do next? What's my plan?
  3. Act — Execute a tool call, write output, or take action
  4. Evaluate — Did that work? Am I done? What changed?

Then it loops back to observe the new state and continues.

Why This Matters

This loop explains several agent behaviors you'll notice:

Why agents can handle complex tasks: Each loop iteration builds on the last. An agent researching a topic might:

  • Loop 1: Search for overview information
  • Loop 2: Identify key themes from results
  • Loop 3: Deep-dive into most relevant theme
  • Loop 4: Synthesize findings into a summary

Why agents sometimes get stuck: If an agent's "think" step doesn't produce a good plan, or its "evaluate" step doesn't recognize failure, it can repeat unhelpful actions.

Why agents need good instructions: Clear goals make the "evaluate" step easier. "Research AI agents" is vague. "Find three business use cases for AI agents with ROI data" gives the agent clear success criteria.

Real-World Example: Travel Booking

Watch how the loop works for booking a trip:

Loop Observe Think Act Evaluate
1 "Book trip to Tokyo" Need dates, preferences Check calendar Found free dates
2 Have dates, need flights Search for options Query flight API Found 5 options
3 Have flights, need hotel User prefers 4-star Search hotels Found 3 matches
4 Have options Present best package Show to user Task complete

Each loop builds context for the next decision.

The Power of Iteration

The magic isn't in any single loop—it's in the accumulation. Each cycle adds information, refines understanding, and moves closer to the goal.

This is fundamentally different from a chatbot, which responds once and waits. Agents keep cycling until the job is done.

:::

Quiz

Module 2 Quiz: How Agents Think and Act

Take Quiz