What is the agent loop?
LLM & AILevel: FoundationAgent Fundamentals
What is the agent loop?
Hints
- Identify the stage: pretraining, adaptation, generation or evaluation.
- Name the inputs, constraints and a case where the approach fails.
Answer
The agent loop is the core execution model:
- Perceive — receive user input or tool observations
- Reason — LLM decides what to do next (Thought)
- Act — execute the chosen action (tool call, code execution, message)
- Observe — receive the action's result
- Repeat — continue until task is complete or a stopping condition is met
Stopping conditions: task completion detected, max steps reached, user interruption, budget exceeded, unrecoverable error.
Source and licence: JustInCache & contributors — Awesome AI Interviews · Apache-2.0