LESSON 43 / 215·2 min readIntermediate

Agent loop, reasoning/action/observation, and ReAct

Must knowConcept lesson
01 Understand02 Recall03 Prepare

Words made simple

A few useful meanings before you read the explanation.

Agent
An application that uses a model to choose its next action within defined limits. It can use tools and continue through several steps.
ReAct
An agent pattern that alternates reasoning about a task, taking an action, and using the result to choose the next step.
Token
A small piece of text processed by a model. It may be a whole word, part of a word, or punctuation.

Overview

  • An agent loop alternates decision, action, and observation.
  • ReAct is a pattern that combines deciding what information/action is needed with executing tools and observing results.
  • “Reasoning” here means useful task planning and decision-making, not a requirement to expose hidden model reasoning.

Why this matters

A single model response may not know which tool will produce the information needed next.

An everyday example

A mechanic inspects a symptom, performs a test, sees the result, and chooses another test.

A technical example

Lookup claim → observe missing document → search required-documents policy → propose a checklist → finish.

How it works

  1. Model chooses from allowed tools
  2. Executor returns structured result
  3. Loop checks progress and remaining budget
  4. Model decides again.

Architecture and flow

Decide → approved action → observation → decide, with explicit stop conditions.

The insurance assistant example

Identify why a claim is delayed using read-only status and document tools.

When to use it

Exploration across several safe information tools.

When to avoid it

Do not use unrestricted loops for payments, policy changes, or simple exact lookups.

Interview answer

“ReAct alternates model-selected actions with observations. I log decisions and tool outcomes, enforce permissions, and stop on completion or bounded failure.”

Benefits, trade-offs, and production considerations

  • Require max steps, total deadline, token budget, repeated-call detection, and result-size caps.
  • Store concise decision labels and evidence; do not make production depend on internal chain-of-thought access.
PAUSE & RECALL

Can you explain it without the notes?

Agent loop, reasoning/action/observation, and ReAct

Use your own words. Explain an example and one limitation before checking the explanation.

Check your explanation

An agent loop alternates decision, action, and observation. ReAct is a pattern that combines deciding what information/action is needed with executing tools and observing results. “Reasoning” here means useful task planning and decision-making, not a…

CONNECT IT TO YOUR INTERVIEW

Turn this concept into a clear answer.

Practice this concept
YOUR NEXT STEP

Keep connecting the ideas.

Next lesson: Tools, planning, state, memory, and autonomous actions

Adapted from 13_AI.MD · “Agent loop, reasoning/action/observation, and ReAct”. Examples are study fragments; framework behavior can depend on your version.