Modern websites, ranked in AI searchCited by ChatGPT, Perplexity & Google AI Overviews32% of our own traffic comes from AI searchModern websites, ranked in AI searchCited by ChatGPT, Perplexity & Google AI Overviews32% of our own traffic comes from AI searchModern websites, ranked in AI searchCited by ChatGPT, Perplexity & Google AI Overviews32% of our own traffic comes from AI searchModern websites, ranked in AI searchCited by ChatGPT, Perplexity & Google AI Overviews32% of our own traffic comes from AI search
Agentic AI

Tool Use in AI Agents: Function Calling and Beyond

How AI agents use function calling to work with APIs and databases and other external services. The tool use pattern explained with code examples from Antonio Gulli.

Space & Story Team·March 30, 2026·10 min read
tool usefunction callingAI agent toolsAPI integrationagentic design patterns

Based on Agentic Design Patterns by Antonio Gulli (Springer). All book royalties go to Save the Children.

Space & Story Team·March 30, 2026·10 min read

Key Takeaway

Tool use is the pattern that breaks an AI agent out of its text-only bubble. Through function calling, an agent can query a database or call an API, then run code and act on the world. It is the bridge between an LLM's reasoning and the systems around it, and the clearest line between a chatbot and an agent that gets work done.

Why This Matters for Enterprise AI

An LLM that can only generate text is like an employee who can only write memos: useful, but boxed in. The moment that employee can also open your CRM, check inventory, trigger a shipment, or query your analytics dashboard, their value jumps.

Tool use is what gives an agent operational reach. Without it, you have a clever text predictor. With it, you have a system that can act on your behalf, reading live data and running transactions while it moves work across your stack.

For brands competing on AI-readiness, tool use is table stakes. The open question is not whether your agents will use tools; it is how well you design the integration.

Tool Use Explained

The Tool Use pattern lets an agent reach into external systems: APIs, databases, services, or a code execution sandbox. The LLM at the agent's core decides when and how to call an available tool, based on the task in front of it.

How It Works

The sequence is short and predictable:

  1. Tool definition: each external function is described to the LLM, including its purpose, its name, the parameters it takes, and what it returns.
  2. LLM decision: the model weighs the user's request against the available tools and decides whether a tool call is needed.
  3. Function call generation: the LLM emits a structured output, usually JSON, naming the tool to call and the arguments to pass.
  4. Tool execution: the framework catches that output, runs the actual function, and captures the result.
  5. Result processing: the tool's output goes back to the LLM, which uses it to write the final answer or pick its next move.

That sequence is what turns an LLM from a knowledge base into an active participant in your systems.

Function Calling vs. Tool Calling

"Function calling" describes invoking specific, predefined code functions. Gulli pushes for the wider term "tool calling," because a tool can be a plain function, but it can just as easily be an API endpoint, a database query, or a request handed to another specialized agent.

The wider framing matters for enterprise architectures, where agents have to coordinate across very different systems rather than only calling Python functions.

Code Example (Abbreviated)

Using Google ADK, defining a tool and an agent that uses it:

# Abbreviated — see Chapter 5 of Agentic Design Patterns for full implementation
from google.adk.agents import Agent
from google.adk.tools import FunctionTool

def check_weather(location: str) -> str: """Returns current weather for a given location.""" return f"Weather in {location}: 72°F, partly cloudy."

weather_tool = FunctionTool(check_weather)

agent = Agent( name="WeatherAgent", model="gemini-2.0-flash", instruction="Help users with weather queries using the weather tool.", tools=[weather_tool] )

For the full implementation with multiple tools, error handling, and production patterns, see Chapter 5 of Agentic Design Patterns.

Practical Applications

  1. Information retrieval: a weather agent, a stock-price checker, a live news aggregator. The LLM notices when its training data falls short and reaches for a tool to get current information.
  1. Database and API interaction: a support agent that looks up order status, checks an account balance, or triggers a refund. Each system behind it is exposed as a tool with defined parameters.
  1. Code execution and computation: LLMs are bad at arithmetic, so handing the calculation to an actual calculator or a code interpreter makes the weakness disappear.
  1. Multi-tool orchestration: a travel-planning agent that checks flights with one tool, hotel availability with another, local events with a third, and restaurant picks with a fourth, choosing for itself which combination to fire.

Key Takeaways

  • Tool use is the pattern that turns an LLM from a text generator into an agent that can act in the world.
  • Function calling is the mechanism underneath: the LLM emits a structured tool invocation, and the framework runs it.
  • Think "tool calling," not just "function calling": a tool can be an API, a database, another agent, or any external capability.
  • The major frameworks (LangChain, Google ADK, CrewAI) all ship native support for defining and running tools.
  • Tool use sits under nearly every other agentic pattern; routing, planning, multi-agent systems, and RAG all lean on it.

Is your site invisible to AI search?

Get a free AEO infrastructure audit and find out what your competitors are doing that you're not.

Get Your Free Audit
Quick answers

Frequently asked.