Home › Key concepts › The agent loop

Key concept · Walk (intermediate) · the same on every platform

The agent loop

Model, tool, result, model again, until done or a limit is hit.

What it is

An agent is a model in a loop. Each turn it reads the context, decides to answer or to call a tool, the tool runs, and the result goes back in. The loop stops when the task is done or a budget runs out (steps, time, money).

Contextinstructions,history, dataModelanswer orask for a toolCheckis this callallowed?Tool runsyour codeAnswerchecked, then senttool?the result goes back into the context; repeat until done or a budget runs outdone
The agent loop. The check between the model's request and the tool is where safety lives.

Why it matters

Agents can do multi-step work, but every extra step costs time, money and a chance to go wrong. Budgets and checks are not optional.

An example

Look up the policy, then the claim, then draft a reply: three tool calls, then an answer.

The common mistake

No step limit, so a confused agent loops 200 times on one request.

Where you meet it on each platform

The idea stays the same; only the product name changes.

JobAWSAzureGoogle CloudDatabricksOpen source
Agent runtimewhere a long-running agent keeps its state and waits safelyBedrock AgentCoreFoundry Agent Service / Durable FunctionsVertex AI Agent EngineMosaic AI Agent FrameworkDBOS or Temporal + your loop
Tool callinglet the model ask your code to do things, and check before it runsBedrock tool useFoundry function callingGemini function callingUnity Catalog functions as toolsplain Python loop, no framework

Related ideas

Where it shows up

Part of the Walk level on these paths: AI Engineering (tools and agents).