Skip to content
47% off: the complete course for $79 (reg. $149)Order now →
AI Builder
Module 4Full course10 min read

Tool Use for App Features

Let a model look things up and take actions inside your product — defining tools, running the call-and-return cycle, and keeping it bounded.

So far in this module, the model has worked only with what you put in front of it. That's enough for summarizing or extracting from a ticket, but not for answering "has this customer been double-charged before?" The answer is in your billing tables, and you can't paste every customer's full history into every prompt. Tool use (also called function calling) solves this: you describe functions the model may call, the model asks for one when it needs data, your code runs it, and the model uses the result to answer.

In this lesson you'll add one to a real product surface: an "Ask about this ticket" panel in Deskmate. You'll decide when tools are the right design, define a small set of them, run the call-and-return cycle in a route, and put hard bounds on rounds, time, and result size so the feature behaves predictably under real traffic.

When a feature actually needs tools

Tools add latency, cost, and moving parts, so start by asking whether you need them. The test is simple: can your code predict what data the model will need?

  • Yes, always the same data. Fetch it in code and put it in the prompt. A ticket summary always needs the ticket thread; there's no decision for the model to make. This is just context assembly.
  • Yes, but it depends on a classification. Classify first, then fetch. If billing questions need invoices and how-to questions need help articles, a cheap classification step can choose, and your code does the fetching. That's a prompt chain, and it's more predictable than tools.
  • No, it depends on the question. An open-ended "ask anything about this ticket" box can't know in advance whether the agent will ask about charges, past tickets, or a policy. This is where tools earn their place: the model decides what to look up, based on what it's been asked.

Tools are also the mechanism for actions (assign a ticket, issue a credit), which raise permission and confirmation questions that get their own lesson: Tools That Read and Write Your App's Data. This lesson sticks to read-only tools, which is where every tool feature should start.