Gemma 4 as an Agent: How to Teach a Model to Call Tools Independently
Gemma 4 — Google's open-source model — can now work as an agent. A new tutorial shows how to teach the model to independently call tools: search for information online and perform computations. The model itself decides which tool to use. Useful for ML engineers and data scientists who want to create intelligent agents without relying on closed APIs.
AI-processed from KDnuggets; edited by Hamidun News
Gemma 4 — Google's open-source model — can now work as an autonomous agent, independently choosing when information search is needed and when computations are required. KDnuggets published a practical tutorial that shows how to add two new tools to the model and let it decide when to use them.
How Tool Calling Works
Tool calling is a mechanism that allows models to go beyond text generation. Instead of simply writing an answer, the model can invoke a function, receive a result, and use it for further reasoning. For Gemma 4, this means:
- The model analyzes the user's task
- Decides whether it needs a tool to solve it
- Selects the correct tool from available options
- Passes the necessary parameters
- Receives the result and continues working
Search and Computations in One Model
In the tutorial example, Gemma 4 receives two tools: one for searching information (functioning like a browser in the example), and another for mathematical computations. The model learns to distinguish when each is needed — for example, for a question about current exchange rates, it uses search, while for arithmetic it calls a calculator. This is different from rigid route programming.
The model doesn't simply follow rules like "if the word 'price' appears in the query, search online." Instead, it develops genuine understanding of when each tool is useful.
Why This Matters for Open Source
Until now, reliable tool calling was a privilege of closed models like GPT-4 or Claude. Open-source projects either went without it or used complex workarounds. Gemma 4 changes the picture: now developers can run a fully-functional agent on their own servers, without API dependency, without paying per query.
This lowers the barrier to entry for companies and individual developers who want to integrate agents into their systems. The tutorial shows that configuring tools requires just a few lines of code — the model quickly learns to call them correctly.
What This Means
The era of simple chatbots is fading. Agents — models with tools — are becoming the standard. The fact that this now works in open-source models like Gemma means that intelligent systems can be created not only by large AI companies.
- Oct 25, 2026Anthropic admits Claude took more unauthorized actions, including on US government websites
- Oct 25, 2026Anthropic gives METR employee-level access to evaluate its systems' safety
- Oct 25, 2026Anthropic cuts internet access for all internal model tests after incidents
- Oct 25, 2026Anthropic Ships Ten Claude Announcements in Three Months, From Schools to SpaceX
Key Questions Answered
How Tool Calling Works?
Tool calling is a mechanism that allows models to go beyond text generation. Instead of simply writing an answer, the model can invoke a function, receive a result, and use it for further reasoning. For Gemma 4, this means: The model analyzes the user's task Decides whether it needs a tool to solve it Selects the correct tool from available options Passes the necessary parameters Receives the result and continues working
What are the key details on Search and Computations in One Model?
In the tutorial example, Gemma 4 receives two tools: one for searching information (functioning like a browser in the example), and another for mathematical computations. The model learns to distinguish when each is needed — for example, for a question about current exchange rates, it uses search, while for arithmetic it calls a calculator. This is different from rigid route programming. The model doesn't simply follow rules like "if the word 'price' appears in the query, search online." Instead, it develops genuine understanding of when each tool is useful.
Why This Matters for Open Source?
Until now, reliable tool calling was a privilege of closed models like GPT-4 or Claude. Open-source projects either went without it or used complex workarounds. Gemma 4 changes the picture: now developers can run a fully-functional agent on their own servers, without API dependency, without paying per query. This lowers the barrier to entry for companies and individual developers who want to integrate agents into their systems. The tutorial shows that configuring tools requires just a few lines of code — the model quickly learns to call them correctly.
Delegate Deep Research, Coding & Workflows to an AI Agent
Deploy autonomous multi-step execution with NomadNet Agent (agent.nomadnet.ai) — automated web research, data synthesis, code generation, and complex task orchestration.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.