AI Agents
What is Agent loop?
The four-step cycle every AI agent repeats — perceive, reason, act, observe — until a goal is met or a stop condition fires.
How it works
The LLM is the reasoning engine; the surrounding code runs the tools, feeds results back, and decides when to stop. Strip away frameworks and this loop is the entire engine. Understanding it is what makes agents stop being magic.
Example
In practiceA research agent perceives a question, reasons that it needs to search, acts by calling a web-search tool, observes the results, then repeats until it can answer.
Do all AI agents use the same loop?
Yes — every agent, from chatbots to coding assistants, runs some version of perceive-reason-act-observe. The differences are in the tools, memory, and stop conditions around it.
Go deeper: Deploy Your First AI Agent
The complete, step-by-step guide — every command, config, and the reasoning behind it.
Get the guide