What is the agent loop?
BeginnerConceptAgent patterns & frameworks
Answer
The agent loop repeats: the model reasons about the current state, chooses a tool call or final answer, your code executes the tool, the result is added to context, and the loop continues. You must cap it with a maximum number of steps, a time limit and a cost budget.