[KongchangAI]
ConceptAgent Loops / 智能体循环

Agent Loop

Agent Loop is a core operational architectural pattern in autonomous agent systems, referring to the working mechanism by which an agent completes complex tasks through continuous cyclic execution of steps such as perception, reasoning, action, and observation. In each iteration, the agent invokes a large language model for reasoning, generates action instructions, calls tools or interacts with the environment, and feeds the results as new input into the next reasoning round until the goal is achieved or a termination condition is met. This pattern is a foundational design principle for agent frameworks such as ReAct and AutoGPT.

Core Facts

Timeline (last 90 days)

Oct 18

Common engineering means of terminating an agent include maximum step/maximum round limits, timeout budgets, consecutive-failure counters, and failure-signal detection based on rules or model judgment.

Unverified50%
Oct 16

When a limit is triggered, execution should stop and return the partial results already completed along with a concise explanation; a justified partial answer is far better than an Agent that loops infinitely until killed externally.

Unverified50%
Oct 16

When asked to 'execute at most ten steps', the model sometimes executes thirty steps; this is an inherent limitation of current models, and the reliable approach is to enforce the maximum number of steps, timeouts, and token or cost budgets at the code level of the run loop.

Unverified50%
Oct 15

Defining the state machine before writing any code allows you to consider boundary cases in a structured way, including which events can be triggered in which state of the loop, and which terminal states can cover these boundary cases.

Unverified50%
Oct 14

Cursor and Claude Code are both based on the same core Agent work loop: read code, make a plan, edit files, run verification, and check results.

Verified65%
Oct 13

In a cloud Agent architecture, the Agent Loop does not run inside the sandbox; the Agent and the sandbox are separate.

Unverified50%
Oct 11

Both the Claude Agent SDK and the OpenAI Agents SDK take over the Agent Loop, greatly simplifying the model invocation, tool dispatching, history maintenance, and loop control logic that previously had to be written by hand.

Unverified50%
Oct 10

Large language models are responsible for thinking and decision-making but never directly execute actions themselves; the code outside the model is what actually executes the actions.

Unverified50%
Oct 10

A turn limit and a budget should be set for the Agent loop to prevent it from getting stuck in an infinite loop and to avoid runaway costs.

Unverified50%
Oct 10

Every round of calls sends the complete conversation history again, so the longer the task, the larger the context, and the slower and more expensive the calls become.

Unverified50%

32 more timeline events

All Facts (20)

Verified

The underlying operational logic of an Agent Loop is an iterative cycle of 'perception–planning–action–observation.'

80%
Verified

The decision loop of an AI Agent consists of four steps: Sense, Plan, Action, and Observe, forming a closed-loop iteration.

80%
Verified

The agent flow is: send a message to the model to get a response; if the stop reason is not tool use, return the text; otherwise, iterate through the tool-call blocks, validate parameters, run the function, push the result back as a tool result, and loop.

75%
Verified

Modern AI coding agents typically adopt a plan-execute-reflect loop framework, decomposing complex tasks into sub-steps and self-correcting based on execution results.

70%
Verified

Cursor and Claude Code are both based on the same core Agent work loop: read code, make a plan, edit files, run verification, and check results.

65%
Verified

Each iteration cycle of an Agent consists of three phases—model inference, tool invocation, and result return—and latency accumulates at every step

65%
Verified

In workflow-type agents, the execution path is pre-designed by humans, whereas an Agent Loop lets the model autonomously plan what to do next.

65%
Unverified

在Agent Loop中如果只将工具结果塞回messages而漏掉assistant消息,模型会陷入无限循环,不断重复调用工具

90%
Unverified

Agent Prompt模板通常包含四个部分:System Message、Chat History、User Input和Agent Scratchpad

85%
Unverified

OpenAI Codex CLI本质上是一个在本地终端运行的Agent循环(ReAct Loop),每一轮迭代包含思考、行动、观察三个步骤

85%
Partially Verified

Claude Code's Agent Loop is responsible for sending user messages to the Claude model, parsing the tool-call instructions returned by the model, executing tool operations, and feeding the results back to the model for iterative execution.

65%
Unverified

The "Loop" in Loop Engineering and the "Loop" in Agent Loop are not the same concept: the former is a loop of multiple Skill calls and multi-Agent collaboration, while the latter is a loop of tool calls and reasoning.

60%
Unverified

In multi-step tasks, small errors at individual steps accumulate progressively into a snowball effect, where errors in early steps contaminate the input context of subsequent steps

60%
Unverified

A typical Agent execution loop includes perception, reasoning, action, and observation, forming the ReAct (Reasoning + Acting) pattern

60%
Unverified

The project uses an Agent loop (ReAct architecture) to allow the LLM to autonomously determine the next action based on the current page state, rather than executing pre-set scripts.

60%
Unverified

Common engineering means of terminating an agent include maximum step/maximum round limits, timeout budgets, consecutive-failure counters, and failure-signal detection based on rules or model judgment.

50%
Unverified

When asked to 'execute at most ten steps', the model sometimes executes thirty steps; this is an inherent limitation of current models, and the reliable approach is to enforce the maximum number of steps, timeouts, and token or cost budgets at the code level of the run loop.

50%
Unverified

When a limit is triggered, execution should stop and return the partial results already completed along with a concise explanation; a justified partial answer is far better than an Agent that loops infinitely until killed externally.

50%
Unverified

Defining the state machine before writing any code allows you to consider boundary cases in a structured way, including which events can be triggered in which state of the loop, and which terminal states can cover these boundary cases.

50%
Unverified

In a cloud Agent architecture, the Agent Loop does not run inside the sandbox; the Agent and the sandbox are separate.

50%

Source Articles