AI GlossaryAgent loop

What is an agent loop?

The repeated control cycle in which an agent observes state, reasons about the next action, invokes a tool or produces output, evaluates the result, and decides whether to continue.

What is an agent loop?

The repeated control cycle in which an agent observes state, reasons about the next action, invokes a tool or produces output, evaluates the result, and decides whether to continue.

Why is this important?

The loop provides adaptability but is also where runaway costs, repeated actions, tool misuse, and false completion can occur.

How it works

The runtime assembles context, calls the model, parses an action, executes it, adds the result to state, evaluates progress, and repeats until stop.

Technical example

A coding agent reads a failing test, edits a file, runs the test, inspects the error, revises the code, and stops when checks pass.

Implementation notes

Set maximum steps, token and time budgets, duplicate-action detection, idempotency, completion evidence, error classes, backoff, and human checkpoints.

Sources

Watch a video explanation

Related terms

Get started with Frontline today