Tool Use with the Claude API: Tools, Loops and Web Search
Learn tool use with the Claude API, also called function calling: Claude asks, your code runs the function, and Claude answers with real data.
- Claude API
- 7 days
- beginner
- 7 lessons
- about 3 hours
Free and self-paced. Every lesson is open to everyone.
Start with lesson 1What you will do
For people who finished Claude API for Beginners or can already send a Messages API call from Python. In seven days you define tools with JSON schemas, send tool results back, handle parallel calls and tool_choice, return errors with is_error, try the web search server tool and build a small agent loop with a turn limit. The API is pay as you go with credits in the Claude Console.
How this course works
The course is free and you go at your own pace. Each lesson is short: a bit of reading and a few small tasks you do in the tool itself, so you learn by using it. Every lesson is open to everyone, no account needed. A free account saves your progress, so you can pick up where you left off on any device. What the account stores and how to get it removed is on the privacy page.
Syllabus
- Day 1, 25 minutes What is tool use in the Claude API and who runs the tool? Set up a tool use project and send a request that makes Claude ask for your stock check tool instead of guessing.
- Day 2, 25 minutes How to define a tool for the Claude API with a JSON schema Write three tool definitions with clear descriptions and JSON schemas, and check which tool Claude picks for four customer questions.
- Day 3, 25 minutes How to run a tool and send the result back to Claude Run the tool Claude asks for in your own code and send the result back in a tool_result block, so Claude answers with real shop data.
- Day 4, 25 minutes How do parallel tool calls and tool_choice work in the Claude API? Handle several tool calls in one response, send all results back in one message, and steer tool use with the tool_choice setting.
- Day 5, 30 minutes How to handle tool errors in the Claude API with is_error Return failed tool calls to Claude with is_error, cap the retries, catch API errors and switch on strict tool use for your tools.
- Day 6, 25 minutes How to use web search with the Claude API as a server tool Turn on the web search server tool, read the searches, results and citations in the response, and see what the searches cost.
- Day 7, 30 minutes How to build a Claude API agent loop with a turn limit Build a small customer helper that loops until Claude stops asking for tools, with a turn limit, a system prompt and error handling.