🤖 The Modern AI Developer · Meet AI & Agents

How Do AI Agents Think? The Think-Act-Observe Loop Explained

The think–act–observe loop

一句话先懂 · TL;DR

See how an AI agent reasons step by step: the think-act-observe loop, a realistic worked example, and why looping beats answering everything in one shot.

The Little Loop in Its Head

An Agent doesn't get everything done in one breath—it goes one small step at a time, and at each step asks itself three things:

想(Think):现在该干嘛?
做(Act):调用某个工具(搜索 / 查数据库 / 算一下)
看(Observe):拿到结果,离目标更近了吗?
→ 没完成就回到“想”,再来一轮

A More Realistic Example

Goal: "Tell me how many orders our app got yesterday." An Agent might go around a few loops like this:

想:要拿昨天数据,得查数据库
做:调用 query_db("select count(*) ... where day='昨天'")
看:返回 1287
想:够了,可以回答
交付:昨天下单 1287 笔

Why Loop Around Instead of Saying It All at Once?

Because it doesn't know the result in advance. Before querying the database, it doesn't know whether it's 1287 or 0; before searching, it doesn't know what it'll find. It has to do a step and see the result before it can decide the next one—just like you check your balance before you know whether you can still place the order.

💡This idea of interleaving reasoning and acting was first systematically introduced by the ReAct paper (Yao et al. 2022, arXiv:2210.03629); the field also often calls this loop ReAct (Reason + Act). The name doesn't matter; what matters is the loop.

自测 · 学完检查一下

想真正动手做题、记进度、攒连胜?到互动课里练。

An Agent's core loop is "think → act → ___ → think again."

答案:observe

Think → act → observe; if the goal isn't reached, go around again.

In the "check yesterday's order count" example, which loop step does "calling query_db(...)" belong to?

答案:Act

Calling a tool to execute is the "Act" step.

And which loop step does "returns 1287" belong to?

答案:Observe

Taking in the result the tool gives and judging how close you are to the goal is "Observe."

Judge: an Agent always finishes the job in one go and doesn't need several loops.

答案:False

Quite the opposite—it often goes around several times: do a step, observe the result, then decide the next. This lets it handle tasks that take multiple steps and depend on intermediate results.

Why does an Agent loop instead of outputting the whole answer at once?

答案:Because it has to see the tool's returned result before deciding the next step

The result is unknown, so it must "do a step, look at a step"—the loop exists for exactly this.

This "think → act → observe" loop has a common name in the field: ___ (fill in the English).

答案:ReAct

ReAct = Reason (think) + Act (do), where Observe (look) is an implicit part of the loop. It's fine if you can't recall the term—just remember "the loop."

想边练边学,而不只是读?

到互动课里答题、记进度、攒连胜——游客即可试学,无需注册。

进入互动课程 →

Learn something new — don't miss updates

New courses, features and learning tips. Occasional emails, unsubscribe anytime.