The Claude tool-use loop
Lesson 1 of 36 in Claude Certified Architect Prep. It plays free, with no account.
The lesson, in words
You ask Claude to send an email. Claude can describe that action in text, but sending it takes a tool.
An agent is a loop. You send a prompt, Claude decides what to do, and it can call your tools.
Your prompt joins the system prompt and the tool definitions in the context window.
For a client tool, Claude returns stop_reason "tool_use" and a tool_use block with an id, the tool's name, and its input. Your code runs the tool.
Claude returned a tool_use block. What does your code do next?
- Show it to the user as the answer
- Run the tool and send back a tool_result
- Start a new conversation
Answer: Run the tool and send back a tool_result. Run it, then send a tool_result with the matching id. Claude reads it and decides the next step.
The result goes back. Claude reads it, then calls another tool or answers.
Every turn adds to the context, so keep tool results short and specific.
Next lesson: Coordinators and subagents
The full class, $249 at launch.
Paid once, when it opens. Lesson 1 is free now.
- Scored hands-on labs
- Mock exams
- Lessons on every domain
Only people at Claude Partner Network organizations can sit the exam. Independent prep. Not affiliated with or endorsed by Anthropic.