BeCuriouzLearn something new every day
The trick that lets a chatbot actually do things
💡 Tool use lets a language model decide what action to take while your code actually performs it — that division of labor is what turns a chatbot into an agent.
A language model on its own can only produce text. It can't check today's weather, run a calculation reliably, or look up your order status — it's frozen at its training data and can't reach the outside world. So how do modern AI assistants book flights or query live databases? The answer is tool use (also called function calling).
Here's the clever part: the model doesn't secretly gain new powers. Instead, developers describe a set of tools — like get_weather(city) — and when the model decides one is needed, it doesn't answer directly. It outputs a structured request saying "call get_weather with city=Tokyo." Your program actually runs that function, then hands the result back to the model, which weaves it into a natural reply. The model is the decision-maker; your code is the hands.
This loop — model requests, code executes, result returns — is the foundation of what people call AI agents. Chain several tool calls together and the model can search, calculate, and act step by step toward a goal. The intelligence is in choosing which tool and when, not in doing the work itself.
Understanding this removes a lot of mystery: an AI that "checks your calendar" isn't magically connected to it. A developer wired up a calendar tool, and the model simply learned to ask for it at the right moment.