Building AI Agents
Tools, Function-Calling, and Why Sandboxing Matters · 1/2

Function-calling turns text generation into real action

On its own, a language model can only generate text, it can't browse the web, run code, or query a database. Function-calling, sometimes called tool use, bridges that gap: developers describe available tools to the model, like 'search_web(query)' or 'run_code(script)', along with what each one does and what parameters it expects, and the model can then output a structured request to call one of those tools instead of a plain text answer. The application receives that request, actually executes the function, and feeds the result back into the model's context so it can decide what to do next.

This is the mechanism that turns a language model into something that can actually check the current weather, query a company's live database, send an email, or edit a file. Anthropic's Claude, OpenAI's GPT models, and Google's Gemini all support this pattern natively, and it's the foundational building block underneath essentially every practical AI agent in production today.