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:
- Think. Given the current state + goal, the LLM decides the next action.
- Act. The agent calls a tool — an API, a database query, a code execution, etc.
- Observe. The tool returns a result that becomes new context.
- Repeat. Loop until the goal is reached, the agent decides to escalate, or a step / time / cost budget is exceeded.
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.
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 →