Course Content
Agents & Tools Interview Prep
6 sections · 40 lessons
What is tool use in LLMs, and why is it essential for building agents?
What you need to know
The three limits tools remove
| Limit of a bare model | Tool that fixes it | Example |
|---|---|---|
| Knowledge frozen at training time | Search, retrieval, live APIs | Today's flight fares, current account balance |
| Unreliable exact work | Calculator, code sandbox, SQL | Summing 5,000 transactions |
| Cannot change the world | Write APIs | Create a ticket, send an email, book a seat |
What a tool call looks like
In the Anthropic API, a tool is declared like this:
1{2 "name": "get_balance",3 "description": "Get the current balance of one of the user's accounts. Use when the user asks how much money they have.",4 "input_schema": {5 "type": "object",6 "properties": {"account_id": {"type": "string", "description": "e.g. SB-0042"}},7 "required": ["account_id"]8 }9}The model replies with a content block such as {"type": "tool_use", "id": "toolu_01…", "name": "get_balance", "input": {"account_id": "SB-0042"}}, and the response has stop_reason: "tool_use". OpenAI's Responses API uses {"type": "function", "name", "description", "parameters"} for the definition and returns a function_call item whose arguments is a JSON string you must parse.
Why it makes agents safe enough to ship
A tool call is a clean boundary. Before running it, your code can:
- Validate the arguments against the schema and business rules.
- Authorise it for this user ("can this customer see this account?").
- Gate it behind human approval if it has side effects.
- Log it for audit and debugging.
Free text gives you none of that. "I'll transfer ₹5,000 now" in prose is impossible to police; a create_transfer call with typed arguments is easy.
How the model learned it
Current models are trained on tool-calling data, so they choose tools from the description and fill arguments from the schema. That is why the description is so important: it is the only information the model has when deciding.
A real-life example
A bank's assistant has three tools: get_balance, list_transactions and create_transfer. A customer asks, "How much did I spend on Swiggy last month, and can I afford to send ₹20,000 to my sister?"
The model calls list_transactions(account_id="SB-0042", merchant="Swiggy", from="2026-08-01", to="2026-08-31") and get_balance(account_id="SB-0042") in the same turn. The results come back — ₹6,480 across 14 orders, and a balance of ₹48,200 — and the model answers with exact numbers. It then proposes create_transfer(amount=20000, payee="Priya"). The harness sees this tool is marked "needs confirmation", shows the customer a card ("Send ₹20,000 to Priya S., UPI priya@okbank?"), and runs it only after the customer taps Confirm.
Without tools, the model could only guess a balance — which in banking is worse than useless.
Follow-up questions to expect
- "Is tool use the same as structured output?" — Related but different. Structured output constrains the final answer to a schema; tool use asks your code to do something and continues the conversation with the result.
- "What if the model calls a tool that doesn't exist?" — Your dispatcher should return an error result naming the valid tools, not crash.
- "Can the model call several tools at once?" — Yes, most APIs allow parallel calls in one turn; run them concurrently and return all results together.