How to Set Up Ollama for Agent Zero

AI Engineer vs ML Engineeragent zerohow the two roles differ: building systems around models versus building and shipping the models.

Agent Zero is an open-source autonomous agent framework that runs in a Docker container, plans tasks with a language model, and executes them with tools such as a terminal and code execution inside its sandbox. It talks to models through a provider setting, so the reasoning engine can be a hosted API or a local server. This page connects it to Ollama, which serves open-weight models over an HTTP API on port 11434, so the whole agent runs on your own hardware.

Architecture

Agent Zero with a local Ollama backend Browser Agent Zero web UI Agent Zero (Docker) planner, memory, tools, sandbox HTTP :11434 host.docker.internal or host LAN IP Ollama (host) chat model + utility model Inside the container, localhost means the container itself, so the base URL must point at the host.

The most common failure is the network hop in the middle. Agent Zero runs in a container, so http://localhost:11434 inside it does not reach Ollama on the host. Use host.docker.internal (available by default on Docker Desktop for macOS and Windows hosts, and on Linux when the container is started with --add-host=host.docker.internal:host-gateway) or the host's LAN address. On Linux, Ollama listens only on 127.0.0.1 by default; set OLLAMA_HOST=0.0.0.0 for the service so containers and other machines can reach it, and restrict access with a firewall. Two model slots are used: the chat model does the reasoning, and the utility model handles summarization and memory housekeeping, so a smaller, faster model often works well there.

# On the Ollama host
ollama pull gemma3:12b
curl http://localhost:11434/api/tags            # lists installed models

# From inside the Agent Zero container
docker exec -it <container> curl http://host.docker.internal:11434/api/tags

Overview

This guide explains how to correctly set up Ollama as the language model backend for Agent Zero (Agent 0). It assumes Agent Zero is already running (Docker or local) and focuses only on Ollama integration.

Prerequisites

Step 1: Install Ollama

macOS

Linux

Step 2: Verify Ollama Is Running

Step 3: Pull a Model

Pull at least one model that Agent Zero will use.

After pulling, verify the model exists and can respond using the Ollama CLI.

Step 4: Open Agent Zero Settings

Step 5: Configure Chat Model

Main Chat Model

Step 6: Configure Utility Model

Agent Zero requires a utility model for memory, summarization, and internal tasks.

Step 7: Save and Restart

Step 8: Test the Setup

What is 2 + 2?

Troubleshooting

Summary


#-----------------------------------------#
# gemma3:12b
# http://192.168.1.190:11434
#-----------------------------------------#
$ docker exec -it modest_jones bash
$ docker restart modest_jones
#-----------------------------------------#