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
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
Agent Zero running and accessible in a browser
Docker installed (if Agent Zero runs in Docker)
Network access between Agent Zero and Ollama
Step 1: Install Ollama
macOS
Download Ollama from the official website
Install the application normally
Ollama runs automatically as a background service
Linux
Install using the official install script
Ensure the Ollama service is running
Step 2: Verify Ollama Is Running
Confirm Ollama listens on port 11434
Ensure the API endpoint is reachable
The default API base URL is: http://192.168.1.190:11434
Step 3: Pull a Model
Pull at least one model that Agent Zero will use.
Example models:
gemma3:12b
llama3
mistral
After pulling, verify the model exists and can respond using the Ollama CLI.
Step 4: Open Agent Zero Settings
Open Agent Zero in your browser
Click Settings
Go to Agent Settings
Select Chat Model
Step 5: Configure Chat Model
Main Chat Model
Chat model provider: Ollama
Chat model name: gemma3:12b (or your chosen model)
Chat model API base URL:
Local Agent Zero: http://192.168.1.190:11434
Docker Agent Zero: http://host.docker.internal:11434 or host LAN IP
Context length: Set according to your model (example: 8192 or higher)
Step 6: Configure Utility Model
Agent Zero requires a utility model for memory, summarization, and internal tasks.
Utility model provider: Ollama
Utility model name: Same as chat model or smaller model
Utility model API base URL: Same as chat model
Step 7: Save and Restart
Click Save in Settings
Restart Agent Zero
If using Docker, restart the container
Step 8: Test the Setup
Start a new chat
Send a simple message such as:
What is 2 + 2?
If Ollama is configured correctly, Agent Zero will respond normally
Troubleshooting
No response or errors: Check API base URL
Docker issues: Ensure Ollama is reachable from the container
Repeated tool errors: Verify Agent 0 prompt files are not enforcing tool-only output
Slow responses: Ensure the model fits your system resources