CourseAI Engineering: The Complete Course · Module 9: Agents and Tool Use · part 68 of 105
Part 68 · Module 9: Agents and Tool Use

Lesson 1: Tools, how a model asks your code for facts

20 min read·13 Oct 2026
Module 9 · Lesson 1 · About 55 minutes · Needs: Module 7 (messages, structured output, Lesson 6 on tool privileges)

The situation

Priya forwards a chat. Aisha Rahman wrote: "Hi, it's Aisha. Can I still return my robot vacuum? Order 5521." The Module 8 assistant answered correctly only because the notebook pasted her order facts into the prompt by hand. In the live chat nobody does that: the assistant needs to look up order 5521 itself.

Dev owns the order system and offers two functions: lookup_order(order_id) and check_return_eligibility(order_id). This lesson connects them to the model, so the assistant answers Aisha with her own facts.

WHAT IT KNEW WHAT IT NEEDED Returns: 30 days from delivery (policy) delivery date of 5521 not in any document today's date models do not know it Aisha: "Can I still return my robot vacuum? Order 5521."
In the live chat the assistant has the rule (green: known and correct) but not the facts (red: missing): when order 5521 was delivered, and what today's date is. Tools supply the facts.

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.