Release candidate: decision models
Two opt-in, experimental features merged into main on 2026-10-28 let ModelSaar use decision models — small models that answer typed questions with probabilities instead of generating text. They are available for testing as the GitHub pre-release v0.1.0-rc.2 (tag on commit 7e7579825a2d), which adds the continuation probe and a corrected 422 remedy on top of v0.1.0-rc.1 (commit 5b947f2859a7, still available unchanged). This is a release candidate for testing, not a stable release: no package, no container image, and the default installer and the stable installation path are unchanged.
Status: GitHub-only release candidate (release notes). Both features are fixture-tested in CI (fake backend speaking Ollama's documented decision API), and one bounded live smoke test — three requests against a real decision model — succeeded on 2026-10-28 (details below). Nothing here has been benchmarked: no claim is made about answer quality or about the classifier improving routing.
What the two features do
POST /v1/decisions
Ask a decision model typed questions about a state (a string, or any JSON object/array) and get back per-option probabilities. The request and answer are Ollama's documented System One contract (POST /v1/systemone, Ollama ≥ 0.35.0), carried through the gateway's usual API-key authentication, model resolution, admission, locality policy and decision record:
model: a decision-capable deployment id (for exampleollama/nimble:latest) orauto— every decision-role deployment that passes the hard filters, resident ones first, then by id. No quality scoring: decision models are not measured by the evaluation harness, so the choice is deterministic and fully explained in the record.questions: 1–64 named questions of typechoice(2–255 options),noul(yes/no probability) orscore(2–10 ordered levels), each withinstructions; optional base64imagesfor vision-capable decision models.- Answers are validated against the questions before they are returned; a backend answer that breaks the contract is
502 decision_contract_violation, never passed on.
routing.classifier.mode: decision
The optional routing classifier — consulted only when the deterministic task signals are ambiguous — can now be a decision model instead of a small chat model. It is asked one choice question over the closed task-label set and the arg-max label (with its probability as confidence) refines the task label. Any timeout, error or out-of-contract answer falls back to the deterministic label, exactly as before. Default: mode: chat, classifier enabled: false — nothing changes unless you turn it on.
Prerequisites and limits
- A decision model on your backend. Ollama ≥ 0.35.0 with a model whose
/api/showcapabilities listdecision— for exampleollama pull nimble,cleforlaya. ModelSaar registers such models with roledecision; they are never offered or chosen for chat. Only the Ollama backend has a decision endpoint; a generic OpenAI-compatible backend answers501 unsupported_backend. - Request limits (checked in this order): the gateway reads at most
server.max_request_bytes(default 32 MiB) of the body — a larger declaredContent-Lengthis refused with413before reading and a streamed body is cut off at the limit; state + questions must fit 64 KiB; the request as the backend receives it (JSON including base64 images) must fit Ollama's 32 MiB whole-request limit (413, checked before dispatch). Any field other thanmodel,state,questions,imagesis refused with400naming the field (keep_aliveandstreamincluded). - Classifier mode
decisionneeds the configured deployment to have roledecision; a chat model in that mode (or a decision model inchatmode) is refused before any call, andmodelsaar doctorsays so. The classifier's 2 s timeout applies; a model that is not resident will usually time out on its first consultation and the deterministic label stands.
Full contract: Routing → Decisions (docs/routing.md) and Extending → Optional classifier.
Try it from GitHub (pinned to the pre-release tag)
The candidate uses the ordinary development install at the tag v0.1.0-rc.2 (commit 7e7579825a2d; GitHub pre-release), in its own directory and with its own MODELSAAR_HOME, so an existing stable installation (installer-managed environment, launcher, config, keys, service) is not touched. modelsaar --version still prints 0.1.0: a candidate does not bump the package version. The one-line installer still pins cf56cdd3416d, which does not contain these features; do not point it at the candidate, because it would replace your stable installation.
git clone https://github.com/gopalasubramanium/modelsaar.git modelsaar-preview && cd modelsaar-preview
git checkout v0.1.0-rc.2 # the pre-release tag = commit 7e7579825a2d
python3 -m venv .venv && . .venv/bin/activate && pip install -e . # or: uv venv && . .venv/bin/activate && uv pip install -e .
export MODELSAAR_HOME=~/.modelsaar-preview # separate config, keys and state: your normal install is untouched
modelsaar init --port 8485 # or: --endpoint http://host:11434 --type ollama
modelsaar discover # a decision model shows role "decision"
modelsaar serveFirst decision request (the same body the live smoke test used; the API key is the first line of the preview home's keys/api_keys):
curl -s http://127.0.0.1:8485/v1/decisions \
-H "Authorization: Bearer $(head -1 ~/.modelsaar-preview/keys/api_keys)" -H 'Content-Type: application/json' \
-d '{"model": "auto", "state": "Our checkout has returned 500 errors since 9am.",
"questions": {"label": {"type": "choice", "instructions": "Which label fits this ticket?",
"criteria": {"bug": "Software errors", "billing": "Payments and refunds", "account": "Login and account access"}},
"urgent": {"type": "noul", "instructions": "Is the ticket urgent?"}}}'Expected shape: {"model": "auto", "answers": {"label": {"type": "choice", "choice": …, "probabilities": {…}, "confidence": …}, "urgent": {"type": "noul", "noul": …}}, "usage": {…}}, with headers X-ModelSaar-Request-Id and X-ModelSaar-Deployment; modelsaar decisions shows the record with endpoint: decisions.
To try the classifier in decision mode, add this to ~/.modelsaar-preview/config.yaml, run modelsaar doctor (it checks the role/mode pairing) and restart modelsaar serve; then send an ambiguous chat request such as thoughts? to auto and look at classifier in its decision record:
routing:
classifier:
enabled: true
mode: decision
backend: ollama
model: nimble # a deployment with role decision (modelsaar discover)
only_when_ambiguous: true
timeout_s: 2.0To remove the candidate: delete the modelsaar-preview directory and ~/.modelsaar-preview. Nothing else was written. Problems or feedback: GitHub issues.
Agentic clients that replay reasoning (new in v0.1.0-rc.2)
Clients such as Odysseus send every follow-up turn with the previous assistant message and its reasoning_content. The gateway marks such requests as needing continuation, and a deployment is eligible only when its continuation capability is supported. No runtime reports that capability, so on a fresh installation every follow-up turn of this kind answers 422 no_eligible_deployment with capability continuation is unknown
on each deployment — this is exactly what the real-client Odysseus test against the stable gateway produced, and what v0.1.0-rc.1 could only pass with a hand-written override. v0.1.0-rc.2 adds a probe for it and corrects the remedy text:
# in a second shell, same MODELSAAR_HOME, while `modelsaar serve` is running (the probe goes through the gateway admission control)
export MODELSAAR_HOME=~/.modelsaar-preview
modelsaar probe ollama/<model> --which continuation # one bounded two-turn request; uses local compute
# the report prints continuation: supported | unsupported | unknown with the reason; re-run on unknown- What the probe does: one bounded two-turn request in exactly the client shape (user → assistant with
content+reasoning_content→ user), forwarded to the backend unchanged.supportedonly when that request is answered with a well-formed assistant message;unsupportedwhen the backend explicitly rejects it (4xx);unknown(nothing recorded) on 5xx, transport errors, a timeout or an exhausted output budget — re-run it. - What it establishes: protocol acceptance — the backend accepts and answers a history carrying
reasoning_content. It does not verify that the model semantically uses the replayed reasoning; the OpenAI-compatible API offers no way to check that. - Without probing you can still declare the capability yourself (recorded with operator provenance) in
~/.modelsaar-preview/config.yaml:
deployments:
- backend: ollama
model: <model> # e.g. qwen3.8:latest
capabilities: { continuation: supported } # operator provenance; no probe neededA context-length exclusion on the same deployment is separate: raising context_length/num_ctx does not establish continuation, and probing continuation does not change the context limit. The remedy printed by the gateway now says both. Unprobed, undeclared deployments behave exactly as before (excluded).
Live smoke test — 2026-10-28, completed
isolated preview checkout + home on the owner's MacBook Air (in-process gateway on 127.0.0.1:50826); backend the GX10's Ollama over Tailscale; production modelsaar.service, ~/.modelsaar, the Stage A home and the Pass 1 checkout untouched. Ollama 0.40.5; decision models discovered: ollama/nimble-v3:latest, ollama/d1:latest; the configured one, nimble-v3 (9.0B, Q8_0, capabilities ['decision']). Exactly three requests were made; every number below is read from the recorded result at build time.
| # | request | HTTP | time | deployment | result |
|---|---|---|---|---|---|
| 1 | POST /v1/decisions, model: ollama/nimble-v3:latest — includes the model's first load | 200 | 13 s | ollama/nimble-v3:latest | label → billing (bug 0.246, billing 0.753, account 0.001), confidence 0.63; urgent noul 0.933 |
| 2 | POST /v1/decisions, model: auto | 200 | 3 s | ollama/d1:latest | label → bug (bug 0.715, billing 0.267, account 0.018), confidence 0.573; urgent noul 0.927 |
| 3 | POST /v1/chat/completions, model: auto — ambiguous prompt; routing.classifier.mode: decision with nimble-v3 | 200 | 9 s | ollama/qwen3.8:latest | classifier used, status ok: task conversation, probability 0.997, 255.3 ms; then routed to the chat model shown |
What it establishes: the wire contract works end to end against a real decision model on this one machine — authentication, discovery of decision-role models, explicit and auto selection, schema-valid answers, and the classifier in decision mode consulting the model and refining an ambiguous label. What it does not establish: answer quality, latency distributions, the classifier decision rule (one consultation), behaviour under load; this is a wire-contract and routing smoke test with three requests.
- nimble-v3 answered 'billing' (0.753) for a checkout-500 ticket where a human would likely say 'bug'; d1 answered 'bug' (0.715). The smoke test validates the wire contract and routing, not answer quality.
- `auto` chose ollama/d1:latest (2.7B, decision+vision) although nimble-v3 had just been loaded by request 1: at decision time neither model was observed resident (residency is refreshed on an interval), so the documented tie-break 'by id' applied (d1 < nimble-v3). Documented behaviour; an explicit model id is the way to pick a specific decision model.
- the classifier's single consultation took 255 ms end to end (nimble-v3 resident), above the 250 ms median bound of the classifier decision rule; one request establishes nothing about that rule.
Record: docs/live-runs/2026-10-28-decision-preview-smoke/ (summary, responses, headers, decision records, discovery, launcher console; no prompts beyond the two synthetic inputs, no keys).
What this release candidate is not
- Not a stable release:
v0.1.0-rc.2is a GitHub pre-release tag only — no package on PyPI, no container image, no version bump; the default installer pin is unchanged and still predates these features. A stablev0.1.xremains a separate owner decision (release process). - Not a benchmark: the classifier comparison of 2026-10-25 used the chat classifier, and its result (that configuration failed its timeout criteria; not a causal on-versus-off comparison) stands unchanged — see Benchmarks. No live measurement of
mode: decisionexists beyond the one consultation above, and the continuation probe has not yet been run against a live backend from this candidate. - Not frozen: the wire contract follows Ollama's documented System One API and may change with it; a later candidate would be
-rc.3, never a moved tag. v0.1.0-rc.1 stays available unchanged.