How AI Agents Use Tools (Function Calling, Explained Simply)
By Mario Alexandre · June 24, 2026 · 6 min read
A model on its own can only write words. It cannot search the web, run code, or click a button. Tools give it hands. This article explains what tools are, how an agent picks one, and how to keep tool use safe. It is written for beginners.
Why a Model Needs Tools
A language model reads text and writes text. That is all it does on its own. It cannot look up today's prices. It cannot send an email. It cannot click a button on a website.
Tools change that. A tool is an action the agent is allowed to call. When you give a model tools, it can act in the world. It can search, read, write, and run. That is the difference between a chatbot and an agent. If you want to understand the full loop an agent runs, read about the agentic workflow first.
What a Tool Actually Is
A tool has three parts: a name, a set of inputs, and a result. For example, a web search tool has a name ("search"), one input (the query to search for), and one result (the pages it found). That is it.
Every tool the agent can use is described to it in plain text. The agent reads those descriptions and knows what each tool does. It does not know how the tool works inside. It only knows what to give the tool and what to expect back.
How the Agent Picks a Tool
This is called function calling. The agent reads the goal, picks the right tool, fills in the inputs, and sends the call. The tool runs and returns a result. The agent reads the result and decides the next step.
The agent picks based on the tool description. If the goal needs current information, it picks the search tool. If it needs to run a calculation, it picks the code runner. If the description is clear, the agent picks well. If the description is vague, it picks poorly. Writing clear tool descriptions is one of the most important parts of building an agent.
A Worked Example
Here is one simple loop. The agent needs to find the current price of a product.
- Goal. The agent reads: "Find the current price of product X."
- Pick a tool. It sees it has a search tool. It picks search.
- Fill the inputs. It sets the query to "product X current price".
- Call the tool. The search tool runs and returns a list of results.
- Read the result. The agent reads the results and finds the price.
- Write the answer. It writes the price back to you.
That is one tool call, one result, one answer. A real agent may do this many times in a row, using each result to plan the next call. You can learn more about how agents use memory to keep track across many steps.
Common Tools Agents Use
Here are the tools you will see most often:
- Web search. Look up current information on any topic.
- Code runner. Write and run small programs to calculate or transform data.
- Database query. Read or write rows in a database.
- Browser automation. Click, type, and navigate on a real website.
- Send email. Draft and send an email to a person or a list.
You can give an agent any of these tools, or none, or all of them. The set of tools you provide defines what the agent can do.
Keeping Tool Use Safe
An agent with tools can act at scale. That means mistakes can also happen at scale. A few simple rules keep things safe.
Give the agent only the tools it needs for the job. If it does not need to send email, do not give it the email tool. Before any action that cannot be undone, add a check step. Have a person or another piece of code confirm the action before it runs. Keep a log of every tool call so you can trace what happened. Safety is not extra work. It is part of building an agent you can trust.
Where to Go Next
Now you know how function calling works. The agent reads a goal, picks a tool, calls it, reads the result, and repeats. The next step is to see the full loop. Read the guide to the agentic workflow and the article on how agents use memory.
If you want an agent built for your business, see the AI builds I offer. One option is a custom web automation agent that runs real tasks on a website so you do not have to do them by hand.