# Agent loop

Concept · [Building with AI](https://ecosystem.samcarlton.com/ai)

Also called: agentic loop, agent loops, tool loop, ReAct loop

The repeating cycle that makes an [AI agent](https://ecosystem.samcarlton.com/ai-agent) work: the model decides on a step, calls a tool, reads the result and decides the next step, until the task is done or it stops.

**For example:** Asked to fix a failing test, a [coding agent](https://ecosystem.samcarlton.com/coding-agent) reads the error, edits a file, reruns the test, sees a new error and loops again until it passes.

## Connects to (5)

- [AI agent](https://ecosystem.samcarlton.com/ai-agent): An AI tool that does more than answer a question.
- [Tool use](https://ecosystem.samcarlton.com/tool-use): A way for a model to ask the software around it to run a defined action, such as a search or a database lookup, and send back the result.
- [Subagent](https://ecosystem.samcarlton.com/subagent): A second agent that the main agent starts to handle one piece of a job in its own separate session.
- [Human in the loop](https://ecosystem.samcarlton.com/human-in-the-loop): Designing an AI process so a person reviews, approves or corrects the AI's work at key steps instead of letting it act alone.
- [Agent swarm](https://ecosystem.samcarlton.com/agent-swarm): Many AI agents working on parts of a larger task at the same time, coordinated by software or by a lead agent.

Map view: https://ecosystem.samcarlton.com/agent-loop
