autonomous-ai / engine-ollama
Reuse what Ollama already has on this computer: adopt a running Ollama server into the person's fleet, or serve an Ollama-downloaded model without Ollama. Load before touching Ollama, its models or its settings.
Ollama
Official docs, read 2026-09-29 (source files in github.com/ollama/ollama/tree/main/docs):
FAQ · Context length ·
OpenAI compatibility ·
Thinking · CLI ·
macOS · Linux · Import ·
API reference
Tested: Ollama 0.34.4 (brew install ollama), MacBook Pro M1 Pro 32 GB, macOS 26.6, 2026-09-29.
Tags: [doc] official page above, [run] seen on the tested machine, [?] unverified.
When to use it
A model in Ollama's store (
fleet models→ START WITHollama): Ollama runs it. It downloaded the
file and ships its own engine for new architectures, which Grid's engine can refuse [?].- Answering: adopt it as it is; it is the person's app, so never restart or reconfigure it.
(start it): start one yourself (below). An Ollama that is off is the normal case, not a reason
to switch engines [run].
Ollama not installed: its blobs are GGUF files, so
fleet modelsnames Grid's llama.cpp — link the
blob into~/.grid/modelsandjoin --serve[run].A GGUF from another app enters Ollama only by
ollama create(aModelfilewithFROM <file>), and
that copies the whole file into Ollama's store (+624 MB for a 640 MB GGUF) [run]. So never do it
unasked; when the person wants Ollama and it has nothing suitable, offer it with the size it adds on
disk, beside the no-copy choice (the file with its own app). Neverollama pullwithout the
go-ahead: it downloads.
MLX inside Ollama (Apple silicon)
Since 0.19 Ollama has its own MLX engine on Apple silicon, announced as a preview on 2026-03-30
(blog) [doc]. It runs on MLX only the architectures registered in its
source — read the list live, never from memory:https://raw.githubusercontent.com/ollama/ollama/main/mlxrunner/model/architectures/architectures.go
(one import per architecture folder under mlxrunner/model/) [doc]. Compare with model_type fromfleet model-facts. Everything else keeps running on Ollama's GGML engine. The announced models are
Ollama-library tags in their own quantization, and the post asks for more than 32 GB of unified memory [doc];
importing other MLX models is not yet documented [?].
Where its models live / how to list them
Default dir: macOS
~/.ollama/models, Linux service/usr/share/ollama/.ollama/models, WindowsC:\Users\%username%\.ollama\models;OLLAMA_MODELSmoves it [doc].Layout:
manifests/registry.ollama.ai/library/<model>/<tag>(a JSON file) andblobs/sha256-<hex>;
the manifest layerapplication/vnd.ollama.image.modelnames the weights blob, a GGUF [run]. Model id is<model>:<tag>; other namespaces are<user>/<model>:<tag>[?].fleet modelsalready reads the manifests: entries withsource: ollama, the blob path, andalsoAtwhen another app links the same file [run].From a running server:
GET /api/tags(downloaded),GET /api/ps(loaded, withcontext_lengthandsize_vram) [doc],GET /v1/models(owned_byis the Ollama user,libraryby default) [doc][run].POST /api/show {"model":ID}listscapabilities(completion, tools, thinking, vision) [doc].
Installed? Running?
Installed:
command -v ollamaor/Applications/Ollama.app.ollama --versionwith no server prints
"Warning: could not connect to a running Ollama instance" and the client version [run].The macOS app starts the server at login (a login item) [doc];
brew install ollamastarts nothing [run];
the Linux installer creates a systemd serviceollama[doc].- Running:
fleet models→engines[]withkind: ollama. Default bind is 127.0.0.1:11434 [doc].
Start an already-downloaded model (Ollama not running, or running with too small a window)
Port P from outside machine.listeningPorts, and never 11434: that is the Ollama app's own, and it must
still start when the person opens it [run]. The port is set only through OLLAMA_HOST (no --port) [doc]:
"$GRIDFLEET" serve ollama-P --env OLLAMAHOST=127.0.0.1:P --env OLLAMACONTEXTLENGTH=65536 -- ollama serve
(fleet serve keeps it alive after your shell returns; log run/ollama-P.log, PID run/ollama-P.pid.)
- Foreground process; the log says
Listening on 127.0.0.1:P (version …)when ready [run]. - Every other
ollamacommand must carry the sameOLLAMA_HOST, or it talks to 11434 [run]. - Nothing downloads unless you pull; the model loads on its first request [run].
Context: the default depends on GPU memory — 4K below 24 GiB, 32K at 24–48 GiB, 256K at 48 GiB or
more [doc] (the FAQ still says 4096 [doc]). Agents need at least 64000 [doc], and every model here is
used by an agent: always setOLLAMA_CONTEXT_LENGTHto 65536 or more. The OpenAI API cannot set
context per request [doc].
Ready means
Run "$GRID_FLEET" verify --at http://127.0.0.1:P/v1 --model <model>:<tag> --kind ollama — it performs
these checks with deadlines and prints each one. What it checks:
- The PID is alive. 2.
GET /answers "Ollama is running" [run]. 3.GET /api/version→ 200 [run]. One bounded request through
/v1/chat/completionswith the model id,max_tokens16 and"reasoning_effort":"none"for a thinking model → non-emptycontent[doc][run].GET /api/psshows the model withcontext_length≥ 65536 [doc].FAIL contextmeans this Ollama
runs every model with that window [run]:leavethe grid, then leave their Ollama as it is and start a
second one withOLLAMA_CONTEXT_LENGTH(above) [run].
Join Harness Compute
"$GRID_FLEET" run -- join GRID --at http://127.0.0.1:P/v1 -m <model>:<tag> --advertise-as ALIAS
/v1 is required: without it /models and /chat/completions answer 404, and Grid's capability probe
records JSON output as unsupported without any error [run]. Grid's own detector finds Ollama only on
11434 [run].
Tool calls, JSON output, thinking
/v1/chat/completionssupportstools,response_formatandreasoning_effort[doc].reasoning_effort: "none"asks for no thinking; the native API uses"think": false[doc].- A model's thinking values and default:
/api/show→thinking.values,thinking.default[doc]. - Tool support is per model: check
capabilitiescontainstoolsbefore offering it for coding [doc].
Memory and speed knobs (server environment, apply to all models)
| Variable | Default | Effect |
|---|---|---|
OLLAMA_CONTEXT_LENGTH | by GPU memory (above) | context for every model [doc] |
OLLAMA_NUM_PARALLEL | 1 | requests at once per model; memory scales with parallel × context [doc] |
OLLAMA_KV_CACHE_TYPE | f16 | q8_0 ≈ half the KV memory, q4_0 ≈ a quarter; needs flash attention [doc] |
OLLAMA_FLASH_ATTENTION | automatic | 1 forces on, 0 off [doc] |
OLLAMA_KEEP_ALIVE | 5m | how long an idle model stays loaded [doc] |
OLLAMA_MAX_LOADED_MODELS | 3 × GPUs (3 on CPU) | models loaded at once [doc] |
brew services start ollama sets OLLAMA_FLASH_ATTENTION=1 and OLLAMA_KV_CACHE_TYPE=q8_0 [run: brew caveat].ollama ps → PROCESSOR must read 100% GPU; a CPU/GPU split is slow [doc].
Stop
- A server you started:
"$GRID_FLEET" stop ollama-P. - Unload one model but keep the server:
OLLAMA_HOST=… ollama stop <model>[doc]. - The person's app or service: ask first. macOS app: quit from the menu bar; Linux:
sudo systemctl stop ollama[doc].
Known failures → what to do
| Sign | Do |
|---|---|
404 on /models or /chat/completions | the URL lacks /v1 [run] |
content empty, thinking full | add reasoning_effort: "none" [doc] |
/api/ps context below 65536 | the person's Ollama runs its default (4K or 32K); start a second Ollama with OLLAMA_CONTEXT_LENGTH instead of changing their app |
| 503 "server is overloaded" | queue full (OLLAMA_MAX_QUEUE, default 512) [doc]; wait, do not retry in a loop |
PROCESSOR shows CPU share | model plus context does not fit the GPU; smaller context or model [doc] |
| model not found | not downloaded; offer the download as a slow step, never pull silently |