Agents & Tools Interview Prep

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 modelTool that fixes itExample
Knowledge frozen at training timeSearch, retrieval, live APIsToday's flight fares, current account balance
Unreliable exact workCalculator, code sandbox, SQLSumming 5,000 transactions
Cannot change the worldWrite APIsCreate a ticket, send an email, book a seat

What a tool call looks like

In the Anthropic API, a tool is declared like this:

JSON
{  "name": "get_balance",  "description": "Get the current balance of one of the user's accounts. Use when the user asks how much money they have.",  "input_schema": {    "type": "object",    "properties": {"account_id": {"type": "string", "description": "e.g. SB-0042"}},    "required": ["account_id"]  }}

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.