1.1Intermediate45 minutes
1.1 — Build a Multi-Tool Agent Loop
What you will learn
- How a Messages API agent loop starts, calls tools, and stops.
- Why stop_reason, not the shape of the text, decides the next turn.
- How tool_use continues the loop and end_turn ends it.
- How to append each tool result so the next turn can use it.
- When an iteration cap is only a safety ceiling.