ClassMetric

The Claude tool-use loop

Lesson 1 of 36 in Claude Certified Architect Prep. It plays free, with no account.

Claude Certified Architect PrepThe tool-use loop An agent is a loopAn agent is a loop. You send a prompt, Claude decides what to do, and it can call your tools.PromptYour prompt joins the system prompt and the tool definitions in the context window.tool_useFor a client tool, Claude returns stop_reason "tool_use" and a tool_use block with an id, the tool's name, and its input.

The lesson, in words

Beyond text

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

An agent is a loop. You send a prompt, Claude decides what to do, and it can call your tools.

Prompt

Your prompt joins the system prompt and the tool definitions in the context window.

tool_use

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.

Check

Claude returned a tool_use block. What does your code do next?

  1. Show it to the user as the answer
  2. Run the tool and send back a tool_result
  3. 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.

tool_result

The result goes back. Claude reads it, then calls another tool or answers.

Answer

Every turn adds to the context, so keep tool results short and specific.

Next

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.

Save your progressA free account. Your lessons follow you to the app.