Skip to content

AI Glossary · Concepts

What is Agent Loop?

Agent Loop

An agent loop is the repeating cycle that makes an AI system an agent: the model looks at the current situation, decides on an action such as a tool call, sees the result, and repeats until it gives a final answer or hits a stopping limit.

Also known as: agent loops, agentic loop, agentic loops

· Chain of Thought

AI Agents

  • 2 explainers
  • 6 episodes
  • 2 guest clips
  • 3 sources

Asking a chatbot a question is one round trip: you send a message, the model sends text back. An agent loop keeps going. Ask an agent “Did our refund policy change this year?” and it might search the policy folder, read the search results, open two documents, compare them and only then answer. Each pass through the loop has the same shape: the model sees the conversation so far plus the latest result, picks the next step, and the software around it runs that step and feeds the result back.

The actions are usually tool calls: search, read a file, query a database, run code. ReAct is one well-known recipe for the loop, where the model writes a short reasoning step before each action. The agent harness is the code that runs the loop: it executes the tools, adds results to the context window and enforces the rules. Those rules include when to stop. OpenAI’s Agents SDK, for example, ends the loop when the model produces a final output and raises an error when a run exceeds its turn limit. Without a limit like that, a confused agent can keep calling tools and spending money.

A fixed agentic workflow runs steps in an order a developer chose. In an agent loop, the model chooses the next step each time. That flexibility is what makes an AI agent useful on open-ended tasks, and also what makes it harder to predict.

On Chain of Thought, Oracle’s Richmond Alake gives a beginner’s definition in episode 53 at 30:48: an LLM that takes in information, observes it, maybe makes some tool calls and then produces a final output. Galileo sponsored episode 53. In episode 61 at 12:13, Conor argues that native function calling has improved and agent loops are “at least good enough”, so the information given to agents matters more than the framework around them. That is his opinion, not a measured result. In episode 76 at 26:16, Sonar’s Andrea Malagodi says part of the agent loop is saying no: an agent should be able to decline or deprioritize work. Episode 76 credits Svix, Walrus Memory and Inngest as Season 4 presenting sponsors; see the Svix read.

Hear it from the guest

“And an agent loop would just include an LLM that can take in information, observe the information and maybe do some tool calls and then produce a final output.”
Watch on YouTube
“Part of the agent loop is saying no.”
Watch on YouTube

Quotes lightly edited to remove filler words.

Sources

Go deeper

From the conversation