agent loop

The cycle at the heart of an agent: the model reasons and requests tools, your code runs them, and the results go back until the model finishes or a limit stops it.

In more detail

Give the loop every exit it needs: a finished answer, unexpected stop reasons, and budgets for steps and money, and return the reason it stopped. Each turn resends the whole conversation, so long loops get expensive quickly.

Related terms

Taught in

References

Certification courses