AI engineering glossary · Agents tools MCP

What is agent loop?

Agent loop (also called Agent execution loop): The repeating cycle at the core of an agent: send the conversation to the model, read its reply, run any tool it asked for, append the result, and call the model again. The cycle ends when the model gives a final answer or a limit such as a step cap is reached.

Level: beginnerTopic: Agents tools MCP

Agent loop: an example

while not done: reply = model(messages); if reply.tool_call: messages.append(run(reply.tool_call)); else: done = True.

Related terms

More Agents tools MCP terms

Where you learn it

Agent loop is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.