Glossary

Agent loop

The iterative cycle an AI agent runs: think (decide next action) → act (call a tool) → observe (read the result) → think again. Continues until the task is complete or escalated.

An agent loop is the core execution pattern of an AI agent: a repeating cycle of thinking, acting, and observing that continues until the agent reaches a stopping condition.

The loop:

  1. Think. Given the current state + goal, the LLM decides the next action.
  2. Act. The agent calls a tool — an API, a database query, a code execution, etc.
  3. Observe. The tool returns a result that becomes new context.
  4. Repeat. Loop until the goal is reached, the agent decides to escalate, or a step / time / cost budget is exceeded.
Why the loop matters: it's what separates an "AI feature" (one LLM call, one response) from a real agent (multiple coordinated steps to accomplish a goal).

Production agent loops include guardrails:

  • Step limits. Maximum N tool calls per task (prevents infinite loops).
  • Cost limits. Maximum spend per task.
  • Confidence checks. If the agent isn't confident, escalate rather than continue.
  • Tool sandboxing. Some tools (e.g., sending external email) require human approval mid-loop.
  • State persistence. For long-running agents, state is saved so the loop can resume across sessions.
The MCP (Model Context Protocol) standard from Anthropic is the emerging way to standardize how agents discover + interact with tools across the loop.

Example

A sales agent processing a new lead might: think ("I need to enrich this contact") → act (call Apollo) → observe (get back enriched data) → think ("I should check if this account exists in CRM") → act (query HubSpot) → observe (existing account, with notes) → think ("This is a re-engagement, route to original AE") → act (post to Slack channel). That's four loop iterations chained to complete one workflow.

Apply this

Get a real automation audit on your business.

Pay $4,500, fill an intake, get a Claude Opus-written strategic roadmap inside a week.

Start the audit →