Run a local Ollama model as a Coral agent with Pi
Can a local open-weights model run inside Coral as a real coding agent—reading files, editing code, running tests, and posting results back to the team's message board—without sending a single token to a cloud API?
We ran a controlled trial on a 16 GB GPU workstation (Windows 11 Pro for Workstations with an NVIDIA RTX A4000 16 GB, about 0.9 GB in use at idle) to find out. Because Coral supports pi (@mariozechner/pi-coding-agent) as a first-class agent CLI, and pi speaks OpenAI-compatible completions to a local Ollama server, you can point a Coral seat at an Ollama model running on 127.0.0.1:11434.
We tested two popular open coding models at a 32K context window against the same small coding + board-reporting task:
qwen2.5-coder:14b(9.0 GB on disk)qwen3-coder:30b(18 GB on disk, Mixture-of-Experts with 3B active parameters)
Here is the honest result—the exact setup, the speed and VRAM numbers, why the 14B model failed completely on tool use while the 30B MoE model finished the job at ~37 tokens/sec, and the rough edges we hit (and are improving) along the way.
The short version
If you want to try a local model in Coral on a 16 GB GPU today:
- Use
qwen3-coder:30b, notqwen2.5-coder:14b:qwen2.5-coder:14bcannot call tools through Ollama: When given tools (bash,edit, etc.), Ollama returnedfinish_reason: stopandtool_calls: null, dumping raw JSON ({"name": "edit", ...},{"name": "bash", ...}) into the chat text instead of invoking any tool. No file was edited, no test ran, and its proposed test assertion was wrong (char_count('a b c') == 5instead of3).qwen3-coder:30bcompleted the whole task: It returned structuredtool_calls, added the function and unit tests, ranpython -m unittest -v(5 tests OK), and posted the result to the Coral message board (@all char_count added; python -m unittest: 5 tests OK)—after two operator nudges over an ~8-minute session.
- Speed is genuinely usable once warm:
- Both models generated at ~35–37 tokens/sec warm (
35.0 tok/sfor 14B;36.9 tok/sfor 30B MoE) with a 0.05–0.06 s warm time-to-first-token. - Even though
qwen3-coder:30bat 32K context takes 22 GB in memory (spilling 33% to CPU / 67% on GPU, using 15.3 GB of the 16 GB GPU), its 3B-active MoE architecture still generates slightly faster than the dense 14B model. - Cold loads take ~28–59 seconds (and Ollama unloads idle models after 5 minutes by default), so the first reply after a pause waits on model load.
- Both models generated at ~35–37 tokens/sec warm (
- Local models still need human nudging—and we found integration rough edges to smooth out:
- Even
qwen3-coder:30bstopped early once after inspecting files, twice tried to call a non-existent tool namedcoral-board postinstead of runningcoral-board postthroughbash, and initially ranechoinstead of posting. - Our trial also surfaced a few integration rough edges around
pimodel discovery, session resuming, and usage display —all fixed in Coralv2.1.19and later (see What broke in the integration).
- Even
How we set up Ollama, pi and Coral
Everything in the trial ran unprivileged inside a single folder with no system-wide services or firewall changes.
Versions tested
| Component | Version |
|---|---|
| OS & GPU | Windows 11 Pro for Workstations, NVIDIA RTX A4000 16 GB (~0.9 GB used at idle) |
| Ollama | 0.40.18 (standalone Windows zip, verified against release sha256sum.txt) |
| Pi CLI | @mariozechner/pi-coding-agent 0.73.1 from npm |
| Node.js | 26.13.0 |
| Coral | An earlier Coral build |
| Models | qwen2.5-coder:14b (9.0 GB) and qwen3-coder:30b (18 GB) |
Step 1: Run Ollama on loopback with a 32K context window
Coding agents send several thousand tokens of system and tool instructions on the very first turn (in our trial, pi + Coral's board instructions + the task prompt totaled ~6.1k tokens on turn 1). Ollama's default short context window will truncate agent instructions unless you raise OLLAMA_CONTEXT_LENGTH:
$env:OLLAMA_HOST = "127.0.0.1:11434"
$env:OLLAMA_MODELS = ".\models"
$env:OLLAMA_CONTEXT_LENGTH = "32768"
ollama serve
In a second shell, pull the model:
ollama pull qwen3-coder:30b
When the model loads, ollama ps confirms CONTEXT 32768.
Step 2: Configure pi (models.json) to talk to Ollama
Install @mariozechner/pi-coding-agent and point PI_CODING_AGENT_DIR at your pi config folder (or use the default ~/.pi/agent). Create models.json:
{
"providers": {
"ollama": {
"baseUrl": "http://127.0.0.1:11434/v1",
"api": "openai-completions",
"apiKey": "ollama",
"compat": {
"supportsDeveloperRole": false,
"supportsReasoningEffort": false
},
"models": [
{ "id": "qwen2.5-coder:14b", "contextWindow": 32768, "maxTokens": 8192 },
{ "id": "qwen3-coder:30b", "contextWindow": 32768, "maxTokens": 8192 }
]
}
}
}
Two details that save debugging time:
- Use
127.0.0.1, notlocalhost: Ollama listens on IPv4 loopback (127.0.0.1:11434); on systems wherelocalhostresolves to IPv6::1first, connections can fail or stall. apiKey: "ollama"is a required placeholder: Ollama ignores the key, butpirequires a non-empty string in the provider configuration.
Verify that pi sees both models:
pi --list-models
Step 3: Point Coral at pi and launch the agent
In Coral's Settings > Providers, set cli_path_pi to your pi binary if it isn't already on Coral's PATH.
When you launch a pi session in Coral with model ollama/qwen3-coder:30b, Coral starts pi with its board extension wired up automatically:
pi --model ollama/qwen3-coder:30b --session-dir <data>/pi-sessions/<id> -e <coral extension>
We gave both models the exact same repository (textkit.py with an existing word_count function and test_textkit.py with 2 unit tests) and the same prompt:
"In
textkit.pyadd a functionchar_count(text)that returns the number of non-whitespace characters. Add a test for it intest_textkit.py. Run:python -m unittest -v. Then post the test result on the board withcoral-board post."
Speed and GPU memory: 14B dense vs. 30B MoE on 16 GB
We measured both models directly through Ollama's timing metrics (/api/generate, streaming, temperature 0, identical coding prompt) as well as inside pi at a 32,768-token context length:
| Metric | qwen2.5-coder:14b (dense) | qwen3-coder:30b (MoE, 3B active) |
|---|---|---|
| Disk size | 9.0 GB | 18 GB |
| Memory size loaded at 32K context | 15 GB | 22 GB |
CPU / GPU split (ollama ps) | 5% CPU / 95% GPU | 33% CPU / 67% GPU |
GPU VRAM used (nvidia-smi) | 15,350 of 16,376 MiB (~15.3 GB) | 15,343 of 16,376 MiB (~15.3 GB) |
| Model load time | 29.0 s | 27.6 s |
| First token (cold) | 58.6 s | 28.6 s |
| First token (warm) | 0.06 s | 0.05 s |
| Generation speed (warm) | 35.0 tok/s | 36.9 tok/s |
| Prompt processing (warm) | ~1,600 tok/s | ~900 tok/s |
What surprised us most:
qwen3-coder:30bgenerates at ~37 tok/s even with a third of the model spilled to system RAM: At 32K context, the 30B model takes 22 GB in memory—more than a 16 GB card can hold—so Ollama splits it 67% on the GPU and 33% on the CPU. Becauseqwen3-coder:30bis a Mixture-of-Experts model with only ~3B active parameters per token, it still generates slightly faster than the 14B dense model (36.9 tok/svs.35.0 tok/s), though warm prompt processing is roughly half (~900 tok/svs.~1,600 tok/s).- Watch out for Ollama's 5-minute idle unload: Once warm, responses feel snappy (
0.05 sto first token). However, Ollama unloads a model after 5 idle minutes by default, which means the next message after a break pays the ~28–59 second cold-start penalty again (unless you raiseOLLAMA_KEEP_ALIVE).
Model by model: why 14B failed and how 30B finished the job
qwen2.5-coder:14b: Failed (no structured tool calls)
In an agent CLI like pi, a model cannot change files or run tests by printing code blocks—it has to emit structured OpenAI tool_calls for edit, bash, and file-reading tools.
qwen2.5-coder:14b never called a single tool:
- On its first turn, it answered Coral's board-introduction instructions by printing a markdown
bashblock containingcoral-board post "@all Hello..."as plain text, never executing it. - When re-prompted with the coding task, it wrote out every step as raw JSON inside its text reply—
{"name": "edit", ...},{"name": "bash", ...}—without ever triggering a tool call. No file was touched, no test ran, and nothing reached the board. - Even the code inside its printed JSON had a logic bug in the test: it asserted
char_count('a b c') == 5instead of3.
To confirm whether the bug was in Coral, pi, or Ollama, we queried Ollama's /v1/chat/completions endpoint directly with a bash tool definition. Ollama returned finish_reason: stop, tool_calls: null, and the raw JSON inside content. Because Ollama does not parse qwen2.5-coder:14b's output into structured tool_calls, neither pi nor Coral can execute them.
{"name": "edit", ...} and {"name": "bash", ...} JSON as text instead of invoking tools.
17.7%/33k).qwen3-coder:30b: Finished the task (with two operator nudges)
When we probed qwen3-coder:30b against Ollama's /v1/chat/completions endpoint with the same tool definition, it returned a proper structured tool_calls entry immediately.
Inside Coral, the full run took about 8 minutes from launch to board post, including two short nudges from the operator:
- Turn 1 (orientation, then stopped early):
- Seeing
coral-board postin Coral's instructions, the model first tried to invoke a tool literally namedcoral-board post.pireplied:Tool coral-board post not found. - It then used its real tools to run
lsand readtextkit.pyandtest_textkit.py. - Then it stopped after saying "Let me start by examining…" without making any edits.
- Seeing
- Nudge 1 ("Go ahead: make the edits, run the tests, and post the result with the bash tool"):
- Its first
edittool call failed on a match mismatch; it recovered on its own by rewriting the test file cleanly. - It added
char_count(text)totextkit.pyand added 3 new unit tests totest_textkit.py. - It ran
python -m unittest -vviabash: 5 tests, OK (which we also verified independently). - When it tried to report back, it again called the non-existent
coral-board posttool, fell back to runningecho "<message>"inbash, and declared the task "completed as requested".
- Its first
- Nudge 2 ("The board did not get your message: echo only prints it. Use the bash tool to run exactly: coral-board post ..."):
- It ran
coral-board postviabash. Coral's CLI validation rejected its first attempt with a helpful error:this post notifies nobody: add @Name, --to, or --task. - The model read the error, retried with
@all, and posted to the board:@all char_count added; python -m unittest: 5 tests OK.
- It ran
python -m unittest -v (5 tests OK) and posting the result after two operator nudges.
demo-board) with the local qwen3-coder:30b agent’s final post: @all char_count added; python -m unittest: 5 tests OK.One honest code-quality note: qwen3-coder:30b implemented char_count by chaining .replace(' ', '').replace('\t', '').replace('\n', '') rather than using not ch.isspace() or re.sub(r'\s+', '', text). All 5 unit tests passed, but a string containing Windows \r\n line endings (char_count('a\r\nb')) would return 3 instead of 2. Local 30B models can write working code and use tools, but pairing them with a stronger reviewer (or a clear test checklist) still matters.
What you see in the Coral dashboard
Running pi + Ollama inside Coral already integrates cleanly in several places:
- Sidebar & Composer model labels: The sidebar and chat composer display the active local model (
qwen3-coder:30b · offandPi · qwen3-coder:30b, orollama/qwen2.5-coder:14bon initial launch). - Files panel diff tracking: Coral's Files panel tracks the local model's working-tree edits (
+18 −2acrosstextkit.pyandtest_textkit.py) just like a Claude Code, Codex, Antigravity, or pi session. - Board & CLI guardrails help smaller models self-correct: When
qwen3-coder:30bforgot to include an@mentionincoral-board post, Coral's CLI error message told it exactly what flag or@Nameto add, and the model fixed its command on the next turn without human help.
What broke in the integration (and what we improved in v2.1.19)
We ran this trial on an earlier Coral build not just to benchmark local models, but to see every rough edge a developer would hit. All of the fixes below are in Coral v2.1.19 and later:
- Preserving the
piagent type on resume: Resuming a sleepingpisession over the API without specifyingagent_typepreviously fell back to the defaultclaudetype instead of reading the session's storedpitype; Coral now uses the stored agent type automatically on resume. - Populating the
pimodel picker and clarifying usage display: Becausepi 0.73.1printspi --list-modelstostderr, Coral's model dropdown appeared empty (requiring the model ID to be typed manually), and the chat header left token usage blank whilepishowed it in the Terminal tab footer. Coral now readspi --list-modelsfrom either output stream and states plainly in the UI when an agent CLI does not report token usage. - Documenting Node LTS versions for
pifirst-run setup: Under Node 26.13,pi 0.73.1can stall on its first start while unpackingfdandripgrep; using Node 20 LTS, 22 LTS, or 24 LTS (or unzippingfdandrgintopi'sbinfolder ahead of time) avoids the hang, and we have added this note to the quickstart and troubleshooting docs.
Takeaways: when to use a local model in Coral
A 16 GB workstation GPU is enough to run a real tool-using coding agent inside Coral through pi and Ollama—if you pick a model whose tool calls Ollama supports (qwen3-coder:30b worked; qwen2.5-coder:14b did not) and configure a 32K context window (OLLAMA_CONTEXT_LENGTH=32768).
At ~37 tokens/sec warm, qwen3-coder:30b is fast enough for bounded coding tasks, test writing, and offline experimentation, especially when paired with Coral's board, file-diff view, and human or cross-model review gates to catch when a local model stops early or misses an edge case like \r\n.
Keep reading
- Mixing Agent Types in CoralWhy one team can run Claude, Codex, Antigravity, OpenCode, Hermes and Pi side by side, how to set it up, and how reviews and permissions work across agents.
- How to use Fable 5.2 without blowing your budgetOne advisor, one orchestrator, many hands: how we split work across models, how to set it up as a team in Coral, and where the cost and quality come from.
- Tuning the Harness: Coral’s Health Monitor and AnalyticsMulti-agent work rarely fails with a crash; it stalls quietly. How tunable health rules and built-in analytics catch stalls and show whether a change helped.