COURSE / REAL PRACTICE
AI tool calling foundations
Build a deterministic Python tool-calling simulation with typed arguments, explicit permissions, structured results and a bounded feedback loop.
Read the explanation and diagrams, then work through the practice. Your browser profile supplies your saved progress.
What you’ll work toward
Build and test a mock-model notes assistant with an allowlisted registry, argument and object permissions, bounded tool results, cancellation and explicit call/step limits. No LLM account or host command execution is required.
Read an explanation, inspect the diagrams and work through the available checks, debugging exercises and builds. Feedback and prerequisite links guide the next step.
Before you start
This course builds on these skills:
- JSONL, schemas & command-line boundaries
- Exceptions, resources & honest failures
- Testing seams & injected dependencies
Individual lessons can add prerequisites. Your lesson progress shows your actual readiness.
A look inside the first lesson
A response can request a tool or finish
import copy
raw = {'kind': 'call', 'id': 'c1', 'name': 'read_note', 'arguments': {'ids': ['a']}}
accepted = copy.deepcopy(raw)
accepted['arguments']['ids'].append('b')
print(raw['arguments']['ids'])Your lesson sequence
Follow the same units and lessons in either view. Prerequisite links and your practice progress stay with each lesson.
Messages, arguments and dispatch
- LESSON 01.01
A response can request a tool or finish
Parse a small explicit response protocol, distinguish a call request from a final answer, and retain call identity without executing anything.
Open lesson - LESSON 01.02
Tool arguments need explicit types and fields
Validate exact required argument fields, reject extras, and distinguish Boolean values from integer arguments in Python.
Open lesson - LESSON 01.03
Dispatch only registered and permitted tools
Resolve calls through trusted registry metadata, enforce a separate allowlist, and validate arguments before any handler runs.
Open lesson
Results, feedback and permissions
- LESSON 02.01
Return bounded values and useful failure codes
Normalize tool outcomes into JSON data, preserve request IDs, redact exception details, and enforce a UTF-8 byte budget on returned values.
Open lesson - LESSON 02.02
A feedback loop with calls, steps and cancellation
Feed tool results back to a mock model, stop on a final answer, and enforce distinct call and model-step budgets with cancellation before effects.
Open lesson - LESSON 02.03
Argument validity is not document permission
Apply semantic limits and exact object allowlists before reading a note, treating IDs and prompt text as data rather than paths or authority.
Open lesson