The Tech ArchiveThe Tech ArchiveThe Tech Archive
Small BusinessMarketingDevelopers
ArticlesTopicsSeriesAbout

Get the practical AI brief

Verified, no-hype AI tips you can actually use - in your inbox. Free.

No spam. We verify what we send. Unsubscribe anytime.

The Tech ArchiveThe Tech Archive

The Tech Archive

AI news, analysis & explainers

AboutSmall BusinessMarketingDevelopersArticlesTopicsSeriesMethodologyAI DisclosureCorrections

© 2026 All rights reserved.

Back to home
0 readers reading
  1. Home
  2. Articles
  3. Artificial Intelligence
  4. How to Run a Free Local AI Agent in 2026: Gemma 4 + Hermes Agent + Ollama

Contents

How to Run a Free Local AI Agent in 2026: Gemma 4 + Hermes Agent + Ollama
Artificial Intelligence

How to Run a Free Local AI Agent in 2026: Gemma 4 + Hermes Agent + Ollama

Run a fully local AI agent for free in 2026 — Gemma 4's stealth update fixed tool calling, and Hermes Agent + Ollama makes setup take 15 minutes.

Sham

Sham

AI Engineer & Founder, The Tech Archive

17 min read
0 views
July 21, 2026

You can run a fully autonomous AI agent on your own machine right now, for free, that edits files, runs commands, browses the web, and never sends a single byte to a cloud API. The breakthrough that made this practical wasn't a new model launch — it was a quiet weight update to Google's Gemma 4 on July 15, 2026 that fixed the tool-calling bugs making local agents unreliable. Combined with Hermes Agent (an open-source agent framework by Nous Research) and Ollama (a local model runtime), the full stack costs zero dollars per token and runs entirely on your hardware.

  • Gemma 4's July 15 update fixed tool-calling bugs and added Flash Attention 4 (25–70% faster prompts)
  • Full stack: Gemma 4 (model) + Ollama (runtime) + Hermes Agent (agent framework) — all open source
  • Minimum hardware: 8 GB RAM for the E4B model; 16+ GB recommended for the 26B MoE
  • Total API cost: $0/month — your computer does the inference
  • Setup time: ~15 minutes on a clean machine

What changed on July 15, 2026 — and why it matters for local agents

Google shipped a stealth update to Gemma 4 on July 15, 2026, announced via the official Google Gemma account on X (source) and independently corroborated by The Decoder (source). No version bump, no launch event — just new weights on Hugging Face. But the changes inside those weights are what made local agents go from "experimental" to "reliable."

The update delivered four improvements:

Improvement What it does Impact
Flash Attention 4 Speeds up prompt processing on Nvidia Hopper GPUs (H100 and later) 25–70% faster prompt processing, up to 31% faster time-to-first-token
Tool-calling bug fixes Fixes failures and malformed outputs during agentic workflows Up to +10.1% accuracy on Tau2 Telecom benchmark for 31B
Truncated response fix Reduces cases where the model cuts answers short Fewer incomplete agent outputs
Vision token budget max_soft_tokens raised from 280 to 1,120 Supports images up to 2.51 megapixels for sharper OCR

The tool-calling fix is the one that matters most. Tool calling is what separates a chatbot from an agent — without it, a model can only talk. With it, a model can open files, search the web, write to a calendar, and execute commands. Before this update, Gemma 4 would sometimes call the wrong tool, send broken data, or stall out completely. Google's published benchmarks for the 31B variant show across-the-board improvements (source):

  • BFCL: 74.2% (+0.4)
  • TB2: 25.8% (+4.5)
  • Tau2 Retail: 77.6% (+3.1)
  • Tau2 Airline: 84.0% (+2.0)
  • Tau2 Telecom: 62.7% (+10.1)

A 10.1% jump in the telecommunications tool-use scenario is the difference between an agent you can trust to run on its own and one you have to babysit. TechTimes confirmed that if you downloaded Gemma 4 before July 16, 2026, the weights in your local repository are materially different — you must re-pull to get the improvements (source).

What is the full free local AI agent stack?

The stack has three layers, each open source and free:

Gemma 4 is the brain. It's Google DeepMind's open-weight model family, released April 2, 2026 under the Apache 2.0 license — a major shift from the restrictive custom license used by previous Gemma generations (source). The family includes five sizes: E2B, E4B, 12B, 26B A4B (Mixture-of-Experts), and 31B (dense). All accept text and image input; E2B, E4B, and 12B also accept audio. The 26B and 31B support a 256K context window; the smaller models support 128K.

Ollama is the runtime. It downloads and serves quantized models on your machine, exposing an OpenAI-compatible API at http://127.0.0.1:11434/v1 that any agent framework can connect to (source). No GPU required — it runs on CPU, though a GPU makes it dramatically faster.

Hermes Agent is the hands. Built by Nous Research and MIT-licensed, it's a self-improving AI agent framework that runs in your terminal, a desktop app, and on messaging platforms (Telegram, Discord, Slack, WhatsApp, Signal) (source). It has persistent memory across sessions, creates reusable skills from experience, and ships with 70+ built-in skills. Hermes works with any LLM provider — including a local Ollama instance — so you can swap models without changing your workflow.

Which Gemma 4 model should you run locally?

The right model depends on your hardware. Here's the decision table, with memory requirements from Google's official model card (source):

Model Ollama tag Disk size Min RAM (Q4) Context Tool calling Best for
E2B gemma4:e2b ~7.2 GB 3 GB 128K Yes Phones, Raspberry Pi, low-end laptops
E4B (default) gemma4 ~9.6 GB 5 GB 128K Yes Quick local testing, 16 GB Macs
12B gemma4:12b ~13 GB 7 GB 256K Yes Laptops with 16 GB RAM, good balance
26B MoE gemma4:26b ~18 GB 15 GB 256K Yes Consumer GPU (24 GB VRAM) — best quality/speed tradeoff
31B Dense gemma4:31b ~20 GB 17 GB 256K Yes Best quality — strong reasoning and tool use

For most people setting up a local agent for the first time, the 26B MoE is the sweet spot. It only activates 3.8B parameters per token (out of 25.2B total), so it runs at near-4B speeds while delivering near-30B quality (source). It ranks #6 on the Arena AI open-model text leaderboard with an Elo of 1441 — surrounded by models 10–30x its size (source).

If you have a laptop with 16 GB RAM and no dedicated GPU, start with gemma4:12b or gemma4:e4b. You can always pull a larger model later with a single command. If you're deciding whether to invest in a GPU for this, our GPU buying guide for local AI breaks down the economics.

How to set up the full stack (step by step)

This setup takes about 15 minutes on a clean machine. It works on Linux, macOS, and Windows (via WSL2).

Step 1: Install Ollama

On Linux or macOS, run the official installer:

curl -fsSL https://ollama.com/install.sh | sh

On Windows, download the installer from ollama.com/download and run it. Ollama installs as a background service automatically.

Verify the installation:

ollama --version

You should see a version number. If you get a "command not found" error, make sure Ollama's executable is in your system path (source).

Step 2: Pull the Gemma 4 model

Download the model weights to your machine. For the best quality/speed balance on a machine with 24 GB VRAM:

ollama pull gemma4:26b

For a laptop with 16 GB RAM:

ollama pull gemma4:12b

For a quick test on any machine:

ollama pull gemma4

This downloads the default E4B variant (~9.6 GB). The download is one-time — Ollama caches the model on disk. Verify it pulled successfully:

ollama list

You should see gemma4:26b (or your chosen tag) in the list.

Critical: re-pull if you downloaded before July 16, 2026. The stealth update shipped new weights under the same tag name. Run ollama pull gemma4:26b again to get the tool-calling fixes — Ollama downloads only what changed, similar to how Docker handles image layers (source).

Step 3: Install Hermes Agent

On Linux, macOS, or WSL2:

curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash

This installs uv, Python 3.11, clones the repository, and sets up everything automatically. No sudo needed (source).

Alternatively, Ollama can handle the entire setup for you with a single command:

ollama launch hermes

Ollama installs Hermes, helps you pick a model, configures the Ollama provider (pointing Hermes at http://127.0.0.1:11434/v1), and optionally connects a messaging platform (source).

Step 4: Connect Hermes to your local model

If you used ollama launch hermes, you're done — skip to Step 5. If you installed Hermes manually, run the setup wizard:

hermes setup

Choose Quick setup, then:

  1. Select More providers...
  2. Select Custom endpoint (enter URL manually)
  3. Set the API base URL to: http://127.0.0.1:11434/v1
  4. Leave the API key blank (not required for local Ollama)
  5. Hermes auto-detects your downloaded models — confirm the Gemma 4 tag you pulled

Important context window setting: Hermes requires at least 64,000 tokens of context or it rejects the model at startup. Start your Ollama model with at least 64K context (source):

ollama run gemma4:26b -c 65536

Or set it permanently via a custom Modelfile:

FROM gemma4:26b
PARAMETER num_ctx 65536

Save as Modelfile, then run ollama create gemma4-64k -f Modelfile and use gemma4-64k as your model name in Hermes.

Step 5: Start your agent

hermes

You now have a full working agent running on your own hardware. No cloud, no account required for the model, nobody else sees what you're working on. Test it by asking it to do something that requires tools — "create a file called notes.txt and write three ideas for a blog post in it" — and watch it call the file-write tool.

Step 6 (optional): Connect a messaging platform

Hermes can run on Telegram, Discord, Slack, WhatsApp, Signal, and Email — all from a single gateway process. This means you can talk to your local agent from your phone while it runs on your computer at home:

hermes gateway setup
hermes gateway

Follow the interactive wizard to connect your preferred platform (source).

Local vs cloud: why running local actually matters

The appeal of local AI isn't just cost — it's control, privacy, and reliability. Here's the honest comparison:

Factor Cloud API (e.g., GPT, Claude) Local (Gemma 4 + Ollama)
Cost per token $0.15–$15 per million tokens $0 (your electricity only)
Privacy Prompts and files travel over the internet Nothing leaves your machine
Rate limits Can be rate-limited mid-task No limits — your hardware is the only ceiling
Internet dependency Stops working if connection drops Keeps running offline
Model intelligence Higher (frontier models like GPT-5.6, Claude Fable 5) Lower, but improving fast — Gemma 4 31B ranks #3 on Arena AI open leaderboard
Setup effort Zero — just an API key ~15 minutes one-time setup
Speed Fast (optimized inference) Depends on hardware; GPU recommended

The cost difference compounds in agent loops. An agent that thinks, acts, checks its own work, and loops again will make dozens of API calls per task. On a paid model, that usage climbs fast. On Gemma 4 running locally, it costs nothing extra because your own computer is doing the work. For more on why API pricing is falling and local is becoming viable, see our analysis of the 2026 AI model pricing war.

The hybrid approach: best of both worlds

You don't have to choose all-local or all-cloud. The smartest setup for most people is a hybrid pipeline: use a stronger cloud model for planning and complex reasoning, then hand the output to Gemma 4 running locally for execution and repetitive work.

Here's a practical example. Say you want to write a detailed product description:

  1. Send your outline to a frontier cloud model (Claude, GPT) — it writes the structure and key arguments
  2. Hand that outline to Gemma 4 running locally — it writes the full draft, iterates on it, and formats the output
  3. Total cost: one small cloud API call for planning + zero cost for the bulk writing

This pattern works for any task with a "think hard once, then execute many times" shape: research, content production, code scaffolding, data processing. The expensive reasoning happens once in the cloud; the repetitive execution happens free on your machine. If you want to explore other free AI tool setups, our guide to running Claude Code for free covers a similar hybrid pattern.

What can you actually do with a local agent?

The combination of Gemma 4's fixed tool calling and Hermes Agent's framework opens up real, practical workflows — not toys:

  • Automated content production: Research a topic, outline an article, draft it, and save it to a file — all locally, all free. Hermes's skill system means once you've built a content workflow, you can reuse it with a single command.
  • Code assistance: Navigate a codebase, suggest changes, run tests, and explain how different parts work. Gemma 4 handles the reasoning while Hermes manages file operations and command execution.
  • Scheduled automation: Hermes supports cron-style scheduling. Your local agent can monitor a calendar, prepare summaries before meetings, draft routine responses, and track action items — all in the background on your machine.
  • Research assistant: An always-on agent that monitors topics you care about, collects information from the web, and summarizes findings when you check in.
  • File and system management: Organize files, clean up directories, run maintenance scripts, and manage your workspace — the kind of repetitive system admin work that eats time.

The tooling around local models keeps improving independently of Gemma 4 itself. Other frameworks have shipped updates that make tool calls more reliable, cut down on duplicate loops (where an agent repeats the same action), and add self-healing tool calling where broken calls get automatically corrected instead of failing outright. All of that stacks on top of what Gemma 4 already fixed. For a deeper look at building agents that last, our agent architecture survival guide covers the structural decisions that matter.

How fast is local inference — and can you go fully local?

Speed depends entirely on your hardware. On CPU only, a 9B model gives roughly 10 tokens/second on a modern 8-core processor. A 31B model on CPU is slower — about 2–5 tokens/second, meaning each response takes 30–120 seconds (source). A GPU changes this dramatically.

For CPU-only setups, Hermes recommends widening the API timeout since local inference is slower:

# ~/.hermes/.env
HERMES_API_TIMEOUT=1800   # 30 minutes — generous for slow local models

Can Gemma 4 replace a frontier cloud model completely? Not yet. The 31B dense model achieves an Arena AI Elo of 1452 — impressive for its size, but still below frontier models like GPT-5.6 or Claude Fable 5 in raw reasoning capability. For tasks that require deep multi-step reasoning or the absolute best code generation, a cloud model still wins. But for the 80% of agent work that is repetitive execution — file operations, web browsing, formatting, drafting, scheduling — Gemma 4 is now good enough, and the price is impossible to beat. If you're exploring other free AI options, our Kimi K3 free setup guide covers another zero-cost path.

What this means for you

If you've been paying per token for AI agent work that a free local model could handle, the math just changed. The July 2026 Gemma 4 update closed the reliability gap that made local agents frustrating to use. The setup takes 15 minutes. The ongoing cost is zero. And the hybrid pattern means you can keep using frontier cloud models for the hard thinking while offloading everything else to your own machine.

The people getting ahead right now are the ones setting this up today, not waiting for it to get easier. Every week you put this off is a week you're still paying token costs on tasks a free local model could already be handling.

FAQ

Q: Is running a local AI agent really free? A: Yes. Gemma 4 is Apache 2.0 licensed, Ollama is free, and Hermes Agent is MIT licensed. The only cost is your computer's electricity. There are no API keys, no subscriptions, and no per-token charges. Your machine does all the inference work locally.

Q: Do I need a GPU to run a local AI agent? A: No, but it helps significantly. Ollama runs on CPU-only machines — a 9B model gives roughly 10 tokens/second on a modern 8-core CPU. A GPU with 8+ GB VRAM dramatically improves speed. For the 26B MoE or 31B dense models, a GPU with 24 GB VRAM is recommended. The E2B and E4B variants run on laptops and even Raspberry Pi without a GPU.

Q: What is tool calling and why does the Gemma 4 fix matter? A: Tool calling (also called function calling) is what lets an AI model trigger external actions — opening files, searching the web, running commands. Without reliable tool calling, a model is just a chatbot. The July 2026 Gemma 4 update fixed bugs that caused tool-calling failures, with accuracy improvements up to 10.1% on certain benchmarks. This is what made local agents go from experimental to reliable.

Q: Can I use a different model instead of Gemma 4? A: Yes. Hermes Agent works with any Ollama-served model, as well as cloud providers like OpenRouter, OpenAI, and Anthropic. Other popular local models include Qwen 3.5 and Carnice 35B A3B (specifically tuned for tool calling). The key requirement is that the model supports tool calling for the full agent experience.

Q: Will my data stay private with a local setup? A: Yes. With a local Ollama + Hermes setup, no prompts, files, or conversation data leave your machine. This is a major advantage over cloud APIs where your data travels over the internet to a third-party server on every request. The only exception is if you connect Hermes to a messaging platform (Telegram, Discord, etc.) — those messages travel through the platform's servers, but the model inference still happens locally.

Q: How is this different from just using ChatGPT or Claude? A: ChatGPT and Claude are cloud-hosted chat assistants. A local AI agent setup gives you three things they can't: zero per-token cost (important for high-volume agent loops), complete data privacy (nothing leaves your machine), and full autonomy (no rate limits, no internet dependency). The tradeoff is lower raw intelligence — Gemma 4 is strong but not at frontier-model levels. The hybrid approach gets you the best of both.

Sources
  • Google Gemma official X announcement (July 15, 2026): x.com/googlegemma/status/2077449152062247219
  • The Decoder — "Gemma 4 gets a stealth update that fixes tool calling bugs and truncated responses under the same name" (July 16, 2026): the-decoder.com
  • TechTimes — "Gemma 4 Gets Stealth Update: H100 Speed Gains and Tool-Calling Fixes, No Version Bump" (July 16, 2026): techtimes.com
  • Google DeepMind — Gemma 4 model page: deepmind.google/models/gemma/gemma-4
  • Google AI for Developers — Gemma 4 model card: ai.google.dev/gemma/docs/core/model_card_4
  • Hugging Face — Gemma 4 collection: huggingface.co/collections/google/gemma-4
  • Hugging Face — google/gemma-4-31B model card: huggingface.co/google/gemma-4-31B
  • Nous Research — Hermes Agent GitHub repository: github.com/NousResearch/hermes-agent
  • Hermes Agent documentation — "Run Hermes Locally with Ollama — Zero API Cost": hermes-agent.nousresearch.com/docs/guides/local-ollama-setup
  • Ollama documentation — "Hermes Agent" integration: docs.ollama.com/integrations/hermes
  • Google AI for Developers — "Run Gemma with Ollama": ai.google.dev/gemma/docs/integrations/ollama
Updates & Corrections
  • 2026-07-21 — Article published. All facts verified against primary sources as of July 21, 2026. Gemma 4 July 15 stealth update details sourced from Google's official announcement and The Decoder's independent reporting. Model specifications from Google's official model card. Hermes Agent setup from official documentation. Pricing/limits flagged as volatile — re-check monthly.

Get the practical AI brief

Verified, no-hype AI tips you can actually use - in your inbox. Free.

No spam. We verify what we send. Unsubscribe anytime.

Tags

#["AI agents"#"open source"#"Gemma 4"#"local AI"#"Ollama"#["Hermes Agent"

Discussion

0 comments
Sham

Sham

AI Engineer & Founder, The Tech Archive

AI engineer (Azure AI-102/AI-900). Writes practical, tested, hype-free guides on using AI for real work and small business at The Tech Archive.

Related Articles

View all
AI and the Future of Work: How to Thrive in the Decade That Decides Everything
Artificial Intelligence

AI and the Future of Work: How to Thrive in the Decade That Decides Everything

18 min
How to Build Privacy-Preserving AI Agents in 2026: The 5-Layer Architecture That Keeps User Data Yours
Artificial Intelligence

How to Build Privacy-Preserving AI Agents in 2026: The 5-Layer Architecture That Keeps User Data Yours

17 min
AI Security Risks in 2026: The 3 Barriers Every Business Must Clear to Use AI Fearlessly
Artificial Intelligence

AI Security Risks in 2026: The 3 Barriers Every Business Must Clear to Use AI Fearlessly

16 min
Kimi K3 Agent OS: How to Automate Your Entire Business With One AI System in 2026
Artificial Intelligence

Kimi K3 Agent OS: How to Automate Your Entire Business With One AI System in 2026

18 min
AI Agent Architecture: How to Build Agents That Survive the 6-Month Churn
Artificial Intelligence

AI Agent Architecture: How to Build Agents That Survive the 6-Month Churn

15 min
Should You Buy a GPU for Local AI in 2026? The Densing Law Says Yes
Artificial Intelligence

Should You Buy a GPU for Local AI in 2026? The Densing Law Says Yes

15 min