CourseAgentic AI Engineer: The Complete Course · Module 9: Retrieval for Agents · part 52 of 97
Part 52 · Module 9: Retrieval for Agents

Lab: Search tools for the returns desk

43 min read·13 Oct 2026
Module 9 · Lab · About 75 minutes · Needs: the Module 3 lab's tools.py, and lessons 1 and 2 (hybrid search, SearchBudget and the category filter; grep, structured queries, the run log and the citation check)

What you are building

ONE TOOL CALL, AFTER THIS LAB model picks tool + args search.call the door search.py tools 5 definitions tools.call Module 3, unchanged INSIDE SEARCH.PY hybrid search + category, budget grep, read, orders source ids run log this customer only ledger + citation check every fact traced
The finished piece: the model (amber) calls through search.py's door (blue), Module 3's tools.py stays as it was (grey), and every result feeds a citation check (green).

The lessons built search in a notebook. This lab moves it into returns_desk/search.py, the file Module 9 adds to the repository. It holds Lesson 1's hybrid engine and search budget, and Lesson 2's file search, order query, run log and citation check, all as tools.

Module 3's tools.py already has a search_help_centre(query, page, max_chars), and Module 3's door, call, refuses any argument its definition does not list. Lesson 1's search added category. The lab reconciles the two in the new file: search.py defines a wider search_help_centre with the same arguments and result shape plus an optional category, and a door that checks its own definitions and passes every other call to Module 3's call. tools.py is imported, never rewritten. Then tests, and Aisha's repeat request, R-1006, worked end to end. Everything at BrightCart is simulated.

The rest of this course is yours to keep

This course is bought on its own, once, and stays readable afterwards, including the parts added to it later.