A hands-on guide to building a local, privacy-first tool-calling agent using Google's Gemma 4 model family (specifically the 2B edge variant) and Ollama. The tutorial covers the concept of tool/function calling in LLMs, setting up Ollama with gemma4:e2b, and implementing four real-world tools in Python (weather, news, time,
Table of contents
Introducing the Gemma 4 FamilyTool Calling in Language ModelsThe Setup: Ollama and Gemma 4:E2BThe Code: Setting Up the AgentBuilding the Tools: get_current_weatherTool Calling Under the HoodMore Tools: Expanding the Tool Calling CapabilitiesTesting the ToolsConclusionSort: