Agent 循环 · 会做事,也要会停Agent Loop · Act, Check, and Know When to Stop
observe → plan → act → check → stop or repeat
Agent
会反复观察状态、制定计划、执行动作并校验结果,直到完成、失败,或由预算与重复阈值把循环收住。An Agent repeatedly observes, plans, acts, and checks until it
succeeds, fails, or a budget or repetition guard closes the
loop.
01 · 先看一个会卡住的助理01 · Start with a stuck assistant
如果助理不断查到同一个空结果,它会自己停下来,还是一直烧掉预算?If an assistant keeps finding the same empty result, will it
stop—or keep burning the budget?
↻
02循环驾驶舱:一次只走一个阶段Loop Cockpit: Advance One Stage at a Time
步进模拟型Step simulation
当前圈数Current cycle
1
—
预算剩余Budget left
8
credits
连续重复Repeat streak
0×
阈值 2×limit 2×
01 · OBSERVE
观察Observe
—
02 · PLAN
计划Plan
—
03 · ACT
动作Act
—
04 · RESULT
结果与校验Result & check
—
03把一圈拆成 4 个零件Break One Cycle into Four Parts
顺序不可跳过Order matters
PART 01
观察状态Observe state
读取环境此刻真正发生了什么,而不是沿用上一轮猜测。Read what the environment actually says now instead of carrying
forward an old guess.
PART 02
选择计划Choose a plan
根据新观察选下一步;计划可以被结果推翻,不是提前写死的承诺。Pick the next step from the new observation. A plan is revisable,
not a promise.
PART 03
执行动作Take action
调用工具会消耗预算,也可能带来副作用,因此每次动作都要记账。Tool calls spend budget and may have side effects, so every
action must be accounted for.
PART 04
校验结果Check the result
动作发出不等于目标完成。结果决定继续、成功、失败还是强制停止。Sending an action is not task completion. The result decides
whether to continue, succeed, fail, or stop.
04最小规则:只有三道门都放行才继续Minimal Rule: Continue Only While All Three Gates Pass
AND gate
got+1 = ¬donet ∧ costt < B
∧ repeatt < R
B = 8 credits,R =
2×。上方任一门变成假,下一圈就不会开始。B = 8 credits and R = 2×. If any gate becomes false, the next
cycle never starts.
结果未完成Result unresolved目标门仍放行Goal gate stays open
检查预算与重复Check budget and repeats每圈结果后计算Evaluated after each result
继续或停止Continue or stop停止原因写入日志Reason is written to the log
05边界实验:注入一次重复陷阱Boundary Test: Inject a Repetition Trap
主动制造失败Create a failure
让 Agent 连续重查同一空结果Make the Agent repeat the same empty query
点击后会重置模拟,连续执行同一个工具动作。第二次重复时,重复门会在预算耗尽前自动停止循环。This resets the simulation and repeats one tool call. On the
second repeat, the repetition guard stops the loop before the
budget runs out.
尚未执行。当前重复阈值固定为 2×。Not run yet. The repeat limit is fixed at 2×.
✗ 工具调用成功,任务就成功了。A successful tool call means the task
succeeded.
→ ✓ 必须用真实结果再次校验目标。The actual result must be checked against the
goal.
✗ 只要还有下一步,循环就应继续。If another action exists, the loop should
continue.
→ ✓ 预算与重复门可以否决下一步。Budget and repetition guards can veto the next
action.
✗ 多重试几次总会得到不同结果。More retries will eventually produce a different
result.
→ ✓ 无新观察的重复动作只会累积成本与风险。Repeating without new evidence only adds cost and
risk.
06 · 一句话带走06 · One line to keep
Agent
循环把观察、计划、动作与校验反复串起来,但只有完成门、预算门和重复门共同放行,下一圈才能开始。An Agent loop repeats observe, plan, act, and check—but another
cycle starts only when completion, budget, and repetition gates
all allow it.