A year ago, most people used Ollama for one thing: download an open model, type ollama run, and chat with it offline. Useful, private, a little limited.

That's not what Ollama is anymore. Over 2026 it picked up the pieces agents need: an Anthropic-compatible API, a one-command launcher for coding agents, subagents and web search for Claude Code, and cloud-hosted models for when your laptop runs out of muscle. Put together, you can now run a real agentic workflow, where a model reads files, calls tools, and works in a loop, on hardware you control.

This guide explains what changed, how the pieces fit, the workflows worth trying, and the security habits that matter when an AI can act on your machine.

ℹ️Quick take: Ollama is now a credible engine for local agents, and for privacy-sensitive work it's genuinely excellent. But local models are still a step behind frontier models on long, multi-step tasks. The winning setup for most people is hybrid: local for private and repetitive work, a frontier model like Claude for the hard reasoning.

Ollama in 30 seconds

Ollama is a free, open-source tool that downloads and runs open-weight language models on your own computer. It handles the hard parts (model formats, GPU acceleration, memory) and exposes a simple command line plus a local API at localhost:11434. Anything that can talk to that API can use the models, no internet required.

That local API is the key to everything below. Agents don't care where a model runs; they care that it speaks a protocol they understand.

What changed in 2026

Ollama's own blog tells the story in a few releases:

WhenWhat shippedWhy it matters
Jan 2026Anthropic Messages API compatibilityTools built for Claude's API, including Claude Code, can point at a local Ollama server instead.
Jan 2026ollama launchOne command sets up coding agents (Claude Code, OpenCode, Codex and others) with local or cloud models.
Feb 2026Subagents and web search in Claude CodeWeb search is built into the compatibility layer, with no separate MCP server or search API key needed.
2026Web search API and cloud modelsAgents can look things up, and models too big for your machine can run on Ollama's cloud with the same commands.

The headline is the first row. Because Ollama speaks the same API language as Claude, the agent tooling built around Claude, its tool-use format and its agent loop, now works with open models too.

How an agent actually works (and why the model matters)

"Agentic" gets thrown around a lot. Here's what it means mechanically:

  1. You give a goal, like "find why the login tests fail and fix it."
  2. The model decides on an action and asks to call a tool: read a file, run a command, search the web.
  3. The agent runs the tool and hands the result back to the model.
  4. Repeat until the model decides the goal is done.

Two model abilities make or break this loop:

💡The context trap: if a local agent starts forgetting what it just read or loops on the same step, check your context window first. Ollama lets you raise the default (for example, with the OLLAMA_CONTEXT_LENGTH environment variable), but bigger contexts need more memory, so balance it against your hardware.

Four workflows worth trying

1. Coding agents on local models

The flagship use: run Claude Code (or OpenCode, or Codex) against a local model. ollama launch walks you through picking a tool and a model, so there's no need to hand-edit configuration. If you prefer to wire it up yourself, Claude Code can be pointed at Ollama's Anthropic-compatible endpoint through its base-URL setting.

ollama pull <a-tool-capable-model>
ollama launch

What you get: an agent that can read your repo, run tests, and propose edits, with your code never leaving the machine. What to expect: on a strong local model it handles focused tasks well, like explaining a module, writing tests, or small refactors. For big multi-file changes, frontier models are still noticeably more reliable.

2. Build your own agent with tool calling

Ollama's API supports tool calling directly, so you can build small purpose-built agents in a few dozen lines. The official Python library even accepts plain Python functions as tools:

import ollama

def disk_usage(path: str) -> str:
    """Report how full the disk holding `path` is."""
    import shutil
    total, used, free = shutil.disk_usage(path)
    return f"{used / total:.0%} used, {free // 2**30} GiB free"

response = ollama.chat(
    model="your-tool-capable-model",
    messages=[{"role": "user", "content": "Is my home drive getting full?"}],
    tools=[disk_usage],
)
print(response.message.tool_calls)

The model reads the function's name, arguments, and docstring, decides whether to call it, and returns a structured request. Your code runs the function and sends the result back. That loop, repeated, is an agent. Start with read-only tools like this one before you give an agent anything that changes state.

3. Private analysis for security and regulated work

This is where local agents shine. Logs, incident notes, contracts, patient or customer data: anything you can't paste into a cloud chatbot. A local agent can:

Because nothing leaves the machine, the compliance conversation gets much shorter. (If you use Ollama's cloud models, that's no longer true: cloud means your prompts go to Ollama's servers. Know which one you're using.)

4. Hybrid: local for volume, frontier for judgment

The most practical setup we've seen splits the work:

You keep costs and data exposure down without accepting worse results where quality matters most. Because Ollama speaks Claude's API format, switching a tool between the two can be as small as changing which endpoint it points at.

Security: an agent on your machine is a big deal

Our audience includes a lot of security people, so let's be direct. Running a model locally is private. Running an agent locally means software that can read your files and run commands is making decisions from text it reads. Treat it accordingly:

Is it worth it?

If you care about privacy, cost at volume, or working offline, yes, absolutely. Ollama turned local agents from a weekend science project into something you can set up in minutes. If you need maximum reliability on complex, long-running tasks, keep a frontier model in the loop.

The real skill isn't picking a side. It's understanding the agent loop, tools, context, and permissions well enough to put each model where it's strongest.

Where to learn the fundamentals

The concepts behind local agents (tool use, context management, MCP, agent loops) are the same ones taught for Claude:

Coursera · Anthropic

Building with the Claude API

Tool use, MCP, and agent workflows: the patterns behind every agent, local or cloud. Straight from Anthropic.

Affiliate link — we may earn a commission if you enroll.

View on Coursera →

Further reading

More AI workflows live in AI & Workflows.

← All AI & Workflows