Module 3 · Lesson 1 · 12 min read

What are tools and why does an agent need them?

What Are Tools?

Introduction

A language model is skilled at generating text, but it does not see the outside world or change it by itself. Tools are the way an agent gets current information and carries out real actions. In this lesson we define a tool, classify common tools and see how they fit into the agent loop.

Learning objectives

  • Define a tool in the context of intelligent agents
  • Explain three limits of the language model that tools address
  • Classify tools into read tools, write tools and compute tools
  • Describe where the tool sits inside the agent loop

Why is the language model alone not enough?

A large language model learns from texts collected up to a certain date, and its knowledge stops at that date. If you ask it about the status of a purchase order created this morning, it will not find the answer in its internal parameters, however smart it is. This is the first limit: frozen knowledge.

The second limit is arithmetic precision. The model predicts the next tokens; it does not run an addition or multiplication algorithm. It may get a short operation right and a long operation with many digits wrong, and there is no guarantee the result is correct.

The third limit is the inability to act. The model only writes text; it does not send an email, save a file or edit a record in a database. Every effect in the real world needs another program to carry it out.

Definition of a tool

A tool is a specific software function that the system offers to the agent with a name, a description and an input schema; the model decides when to ask for it to be run and with which arguments, while the host application runs it and returns the result to the model. Notice the split of responsibility: the model proposes, and the code executes. The model never runs the tool itself.

Research such as Toolformer showed that models can learn when to call simple APIs such as a calculator and a search engine, and today the idea of tools is a core part of almost every agent framework.

1234567The userUserThe applicationApp / RuntimeThe modelModel + Tool SchemasCall request{"name","arguments"}Tool executionValidate → ExecuteTool resultFinal answer
Tool calling: the model executes nothing itself; it proposes a structured call, and the application validates it, executes it and returns the result.

Common types of tools

Tools can be classified by what they do to the world:

KindExamplesEffect
Read toolsSearching a knowledge base, reading a file, querying a databaseChange nothing
Compute toolsA calculator, a text parser, unit conversionChange nothing but guarantee precision
Write toolsSending an email, creating a task, editing a recordChange the state of the world

This classification is not a formality. Read tools can be rerun safely, while write tools need more care: limited permissions, sometimes confirmation from the user, and protection against duplication. We return to this in the tool security lesson.

A practical example: a student affairs assistant

Imagine an agent that helps a university student. The student writes: "How many credit hours do I have left to graduate, and can I register for the artificial intelligence course this semester?" The agent needs:

  1. A db_search tool to read the student's academic record.
  2. A calculator tool to subtract the completed hours from the required hours precisely.
  3. A knowledge_search tool to read the course registration requirements from the university guide.

Without these tools the model would guess an answer that sounds convincing but is not based on the student's actual data, and that is hallucination itself.

The tool in code: the simplest form

The following example is plain Python with no external libraries. We define two tools and register them in a dictionary, then simulate the model's decision as a dictionary carrying the tool's name and its arguments:

python
# A simple tool registry: name -> (description, function)
def calculator(a: float, b: float, op: str) -> float:
    ops = {"add": a + b, "sub": a - b, "mul": a * b}
    return ops[op]

def knowledge_search(query: str) -> str:
    kb = {"artificial intelligence course requirements": "Requires passing Programming 2"}
    return kb.get(query, "No result")

TOOLS = {
    "calculator": ("Performs a precise calculation", calculator),
    "knowledge_search": ("Searches the university guide", knowledge_search),
}

# This is what the model might propose (written by hand here for the simulation)
proposed = {"name": "calculator", "args": {"a": 132, "b": 97, "op": "sub"}}

description, fn = TOOLS[proposed["name"]]
result = fn(**proposed["args"])
print("Tool result:", result)  # 35

Notice that the application is the one that looks up the function and runs it, then returns the result to the model to write the final answer for the student.

Where the tool sits in the agent loop

In the agent loop the agent goes through stages: it receives the input, thinks, then either answers directly or requests a tool. If it requests a tool, the tool is run and its result returns as a new observation that enters the context, and the agent thinks again. The cycle repeats until it reaches a final answer or a maximum number of steps. So a tool's quality is measured not only by its result but by how clear what it returns to the model is: a short, structured result is better than a long page of text that uses up the context window.

Summary

Tools address three limits of the language model: frozen knowledge, weak arithmetic precision and the inability to act. A tool is a function with a name, a description and an input schema; the model proposes calling it and the application runs it. In practice tools divide into read, compute and write tools, and each type carries a different degree of risk. The tool's result returns as an observation to the agent loop so it can continue its reasoning.

Terms

TermEnglishDefinition
ToolToolA described software function the agent asks to run to read information or perform an action
Knowledge cutoffKnowledge CutoffThe last date covered by the model's training data
HallucinationHallucinationGenerating information that sounds convincing but is incorrect or not based on a source
ObservationObservationThe tool's result that returns to the agent's context
Side effectSide EffectA change in the state of the world caused by a write tool

Review questions

  1. What are the three limits of the language model that tools address? Give an example of each.
  2. Why do we say the model proposes the tool call but does not run it?
  3. What is the difference in risk between a read tool and a write tool?
  4. Why is it better for a tool to return a short, structured result?

References