ollama-council
Small local models make mistakes. Two of them rarely make the same mistake.
ollama-council asks two different model families the same question, checks
whether they actually agree (by meaning, not word overlap), and only calls in a
third model when they don't. You get answers cross-checked by more than one
model at close to single-model cost, fully offline, with zero dependencies.
$ council "In one sentence: what is the capital of Japan?"
The capital of Japan is Tokyo.
[agreed · agreement 1.00 · 14.0s]
$ council --json 'Return JSON {"sentiment": "positive|negative"} for: I love this song'
{"sentiment": "positive"}
[agreed · agreement 1.00 · 3.8s]
How it works
question
│
┌───────┴────────┐
▼ ▼
gemma2:2b llama3.2 two model families answer independently
│ │
└──── agree? ────┘ prose: embedding cosine ≥ 0.80 (nomic-embed-text)
│ │ JSON: share of matching short fields ≥ 0.5
yes no / a model failed
│ ▼
│ qwen2.5:3b joins
│ ├─ JSON → majority vote (a real model's JSON, never a merge)
│ └─ prose → synthesizer merges the answers
▼
verify → redact secrets → cache 6h → answer
Why "by meaning": word overlap scored two answers that both said
"risk": "high" as 0.18 agreement. Comparing embeddings for prose, and the
actual field values for JSON, fixes that.
On an Intel MacBook Pro (CPU only), a benchmark of 4 real questions took 327 s / 9 model calls in adaptive mode vs 708 s / 14 calls asking all three models every time, and every answer was valid.
Built in
- Streaming with hard deadlines. Closing the stream cancels generation in Ollama. Non-streamed requests keep running after the client gives up and pile into a backlog.
- Cross-process FIFO queue. Ten scripts sharing one CPU-bound Ollama won't
stampede it: they take turns in arrival order. A council holds one slot for its
whole decision. Set
COUNCIL_SLOTS=2for more parallelism. - Prompt-injection screen. Suspicious text ("ignore previous instructions…") is flagged and wrapped as data, not blocked.
- Answer checks. Empty, refused or broken-JSON answers are replaced by a valid answer from another member.
- Secret redaction. Anthropic/OpenAI/GitHub/AWS/Google/Slack keys and private keys are stripped from answers.
- Cache. Identical questions within 6 hours are answered instantly (SQLite).
- No dependencies. Python stdlib only.
Install
pip install git+https://github.com/naviidaviimusic/ollama-council
ollama pull gemma2:2b && ollama pull llama3.2 && ollama pull qwen2.5:3b
ollama pull nomic-embed-text # optional, for meaning-based agreement
Use it in Python
from ollama_council import Council
council = Council() # gemma2:2b, llama3.2, qwen2.5:3b
r = council.ask("Is this email a phishing attempt? ...", schema="json")
print(r.answer) # the answer
print(r.mode) # agreed | escalated-vote | escalated-synthesis | cache | ...
print(r.agreement) # 0.0 – 1.0
print(r.members) # each model's own answer
# your own lineup, every model every time
Council(members=["qwen2.5:7b", "llama3.1:8b", "gemma2:9b"], strategy="full").ask("...")
schema can be "json" or a JSON-schema dict; Ollama then constrains decoding to it.
CLI
council [-m models] [-s system] [--json] [--full] [--no-cache] [--timeout s] [-v] question
-v prints each member's answer. The question can also come from stdin.
Configuration
| Env var | Default | |
|---|---|---|
OLLAMA_HOST |
http://localhost:11434 |
Ollama server |
COUNCIL_SLOTS |
1 |
concurrent model calls across all processes |
COUNCIL_QUEUE_DIR |
~/.cache/ollama-council/queue |
queue location |
Development
pip install -e ".[dev]" && pytest -q && ruff check .
Tests use fake models, so they run without Ollama.
License
MIT © Victor Navejar (Navii)
Metadata
Release files for ollama-council 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ollama_council-0.1.0.tar.gz | 15.6 kB | With provenance | Details for ollama_council-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ollama_council-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ollama_council-0.1.0-py3-none-any.whl |
Total release size: 30.1 kB
Release files / ollama_council-0.1.0.tar.gz
| Download URL | ollama_council-0.1.0.tar.gz |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
21d3651d1b31d1456cc5994b155e831a8aa8305a1a2124a468c9ceb4f25e16b7
|
|
BLAKE2b-256 checksum How to use checksums |
044a2ee8aca0241a048c71e5fe615b0a963b5d7e154d0b633f7c745fa5240711
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logRelease files / ollama_council-0.1.0-py3-none-any.whl
| Download URL | ollama_council-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
28f473e8e0989e890859fd8d66f8f0b52d4e4b71cad3a1b4658151e18b622eb3
|
|
BLAKE2b-256 checksum How to use checksums |
0f4c32448fae6e39522217cbb5a42608e9341667d0675b5c37f9c887f666d848
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logSecurity for ollama-council 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ollama_council-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.