Lesson 1.1Lesson 1 of 30
Agentic loops
Design and implement agentic loops for autonomous task execution
Key points
- 1Every iteration is the same: send messages and tools, read
stop_reason, act on it. - 2
stop_reason=tool_use: run the requested tools, append eachtool_resultto the history and call the model again. - 3
stop_reason=end_turn: the model is done. This is the only primary exit. - 4Tool results in the history are what lets the model choose the next step itself, instead of following a hard-coded sequence.
What the exam guide checks here
Objective wording from the exam guide (English).
- 1.1.K1Agentic loop lifecycle: send request, inspect stop_reason (tool_use vs end_turn), execute requested tools, return results for the next iteration
- 1.1.K2Tool results are appended to conversation history so the model can reason about the next action
- 1.1.K3Model-driven decision-making vs pre-configured decision trees or fixed tool sequences
- 1.1.S1Loop continues while stop_reason is tool_use and terminates on end_turn
- 1.1.S2Add tool results to context between iterations
- 1.1.S3Avoid anti-patterns: parsing natural language to stop, iteration caps as the primary stop, assistant text as completion signal
Lock it in
Answer scenario questions on this topic. Every option comes with an explanation.
Practise 1.1 · 20 questions