Ollama System One API Tutorial: Build a Local AI Ticket Router with Nimble and Python (2026)
Not every AI workflow needs a chatbot that writes paragraphs. A support inbox often needs three precise decisions: which team should receive a ticket, whether the customer is asking for a refund, and how urgent the issue is. Asking a general chat model to explain its answer and then parsing the prose is an avoidable source of brittle code.
Ollama's System One endpoint takes a different approach. You provide a piece of state and a schema of typed questions; a compatible decision model returns choices, yes/no probabilities, and rubric scores in one JSON response. This guide builds a local Python ticket router with the Nimble decision model, the Ollama System One API, and explicit human-review rules.
Version check: 28 November 2026. Ollama's latest listed server release is v0.40.19 (released 26 November 2026). The official Ollama Python SDK release v0.6.3 added System One API support. The tutorial pins that SDK version and uses the documented local endpoint, rather than relying on a cloud service.
What you will build
The finished program reads a support ticket and asks three independent questions about the same input:
- Choice: route it to billing, technical support, account access, or other.
- Yes/no: estimate whether the customer explicitly requests a refund.
- Score: place urgency on an ordered Routine, Soon, Immediate scale.
The application then applies conservative review rules. Low-concentration decisions go to a human queue; the model never issues a refund, changes an account, sends a message, or executes a tool. That boundary is intentional: System One is a decision endpoint, not a permission system or an agent runtime.
1. Understand System One before installing it
System One is designed for typed decisions over a shared input. The request contains a state value and a questions object. Each question has an identifier, instructions, a type, and (for choice and score questions) allowed criteria. The response contains one answer per question plus token usage.
| Question type | What you define | What comes back |
|---|---|---|
choice | A finite set of named options and descriptions | Chosen option, option probabilities, confidence |
noul | A yes/no proposition to evaluate | Probability that the proposition is true |
score | Ordered rubric levels, lowest first | Probability-weighted score, legend and probabilities |
Unlike a chat-completions request, System One does not return a free-form explanation or a generated chain of reasoning. It scores the defined answers. The questions share the same state; an answer to one question is not passed as context to the next. Use a normal chat or tool-calling model when you need narrative reasoning, multi-turn dialogue, or executable tool calls.
One important interpretation rule: confidence describes how concentrated the answer probabilities are. It is not a calibrated probability that the answer is correct. Treat it as a review signal that you must validate against your own labeled data, not as a guarantee.
2. Check prerequisites and install the model
You need:
- Ollama installed and running on your workstation.
- Ollama v0.35.0 or later for local Nimble/System One support. For this guide, use the current v0.40.19 release where possible.
- Python 3.10 or later and a virtual environment.
- Enough available memory for the 9B Nimble model plus your operating system and application. Actual memory use depends on the model build, context and runtime.
- A short, non-sensitive test ticket. Do not begin with production customer records.
Check the installed server and available models:
ollama --version
ollama list
If Ollama is not installed, use the official installer for your operating system at ollama.com/download. Start the Ollama application or service, then pull Nimble:
ollama pull nimble
ollama run nimble --ask "Which team should handle this?" --choice billing="Payments and refunds" --choice technical="Software problems" < ticket.txt
The CLI command is a quick smoke test. Create ticket.txt with a short sample such as: “I was charged twice for my order and cannot access the refund page.” The exact classification is model-dependent; the purpose is to confirm that the model loads and the decision interface responds.
3. Create a pinned Python environment
Create a project directory and virtual environment:
mkdir ollama-systemone-router
cd ollama-systemone-router
python -m venv .venv
Activate it:
# macOS / Linux
source .venv/bin/activate
# Windows PowerShell
.venv\Scripts\Activate.ps1
Install the official SDK version that includes the System One client method:
python -m pip install --upgrade pip
python -m pip install "ollama==0.6.3"
Confirm the package version:
python -c "from importlib.metadata import version; print(version('ollama'))"
Keep the server and Python client versions separate in your notes: ollama --version reports the server/runtime, while the Python command reports the SDK installed in this environment.
4. Send a direct request to the local API
The endpoint is POST /v1/systemone. The following request asks all three questions about the same ticket. Local requests do not require an API key.
curl http://localhost:11434/v1/systemone -H "Content-Type: application/json" -d '{
"model": "nimble",
"state": {
"subject": "Charged twice for my subscription",
"body": "I see two payments for the same month. Please refund the duplicate charge."
},
"questions": {
"team": {
"type": "choice",
"instructions": "Which team should handle this support ticket?",
"criteria": {
"billing": "Payments, invoices, duplicate charges and refunds",
"technical": "Product bugs, outages and integration failures",
"account": "Login, profile and account-access problems",
"other": "Requests that do not fit the other teams"
}
},
"refund_requested": {
"type": "noul",
"instructions": "Does the customer explicitly request a refund?",
"criteria": {
"false": "The customer does not request a refund",
"true": "The customer explicitly requests a refund"
}
},
"urgency": {
"type": "score",
"instructions": "How urgently does the support team need to review this ticket?",
"criteria": [
"Routine: general question with no immediate impact",
"Soon: customer is blocked or needs timely help",
"Immediate: active financial, security or widespread service impact"
]
}
},
"keep_alive": "10m"
}'
A successful response is one JSON object with model, answers, and usage. The answer keys match the names in your request. A choice answer includes the selected key and probabilities; a yes/no answer exposes the probability that the proposition is true; a score answer includes the weighted score and rubric information.
The values will vary with the model and server configuration. Do not copy a probability from an example into a production rule. The request schema defines the allowed output space; it does not establish that the model has understood the ticket correctly.
5. Build the Python ticket router
Create router.py. The implementation deliberately separates model inference from the decision to auto-route. It also caps the input size before sending it to the server.
from __future__ import annotations
import json
import sys
from pathlib import Path
import ollama
MODEL = "nimble"
MAX_STATE_BYTES = 56 * 1024
QUESTIONS = {
"team": {
"type": "choice",
"instructions": "Which team should handle this support ticket?",
"criteria": {
"billing": "Payments, invoices, duplicate charges and refunds",
"technical": "Product bugs, outages and integration failures",
"account": "Login, profile and account-access problems",
"other": "Requests that do not fit the other teams",
},
},
"refund_requested": {
"type": "noul",
"instructions": "Does the customer explicitly request a refund?",
"criteria": {
"false": "The customer does not request a refund",
"true": "The customer explicitly requests a refund",
},
},
"urgency": {
"type": "score",
"instructions": "How urgently does the support team need to review this ticket?",
"criteria": [
"Routine: general question with no immediate impact",
"Soon: customer is blocked or needs timely help",
"Immediate: active financial, security or widespread service impact",
],
},
}
def classify_ticket(ticket_text: str) -> dict:
state = {"ticket": ticket_text}
encoded_state = json.dumps(state, ensure_ascii=False).encode("utf-8")
if len(encoded_state) > MAX_STATE_BYTES:
raise ValueError("Ticket is too large for this example's local request limit.")
result = ollama.systemone(
model=MODEL,
state=state,
questions=QUESTIONS,
keep_alive="10m",
)
team = result.answers["team"]
refund = result.answers["refund_requested"]
urgency = result.answers["urgency"]
# These are review heuristics, not calibrated correctness guarantees.
review_reasons = []
if team.confidence < 0.75:
review_reasons.append("team decision has low probability concentration")
if urgency.confidence < 0.75:
review_reasons.append("urgency decision has low probability concentration")
if 0.35 < refund.noul < 0.65:
review_reasons.append("refund signal is ambiguous")
return {
"model": result.model,
"team": team.choice,
"team_probabilities": dict(team.probabilities),
"team_confidence": team.confidence,
"refund_probability": refund.noul,
"urgency_score": urgency.score,
"urgency_legend": dict(urgency.legend),
"urgency_probabilities": dict(urgency.probabilities),
"review_required": bool(review_reasons),
"review_reasons": review_reasons,
"usage": {
"input_tokens": result.usage.input_tokens,
"output_tokens": result.usage.output_tokens,
},
}
def main() -> None:
if len(sys.argv) != 2:
raise SystemExit("Usage: python router.py ticket.txt")
ticket_path = Path(sys.argv[1])
ticket_text = ticket_path.read_text(encoding="utf-8").strip()
if not ticket_text:
raise SystemExit("Ticket file is empty.")
try:
output = classify_ticket(ticket_text)
except ollama.ResponseError as exc:
raise SystemExit(f"Ollama returned HTTP {exc.status_code}: {exc.error}") from exc
print(json.dumps(output, indent=2, ensure_ascii=False))
if __name__ == "__main__":
main()
Save a test ticket in ticket.txt, then run:
python router.py ticket.txt
The output is a normal application-owned JSON object. Your application can persist it, display it in a review queue, or pass the proposed team to a separate routing service after its own checks. The model response itself should never be treated as authorization to issue a refund or change customer data.
6. Add a conservative human-review policy
The sample uses 0.75 as an illustrative concentration threshold and flags a yes/no probability near the midpoint. Those values are not universal defaults. Build a labeled evaluation set from representative tickets, including short messages, misspellings, mixed-language text, sarcasm, multiple issues, and cases that genuinely belong in “other.”
For each case, store the human-approved team, refund label, and urgency level. Run the model against the same set and calculate per-class precision, recall, confusion matrices, and the percentage sent to review. Tune the thresholds to the cost of mistakes. A false “billing” route may be inconvenient; a false approval of a refund or a missed security incident may be materially worse.
Keep the “other” option. Without it, the model is forced to choose among categories even when none fits. For high-impact decisions, prefer a review queue over automatic action, regardless of the model's confidence value.
7. Understand the API limits and response semantics
- One response, no stream: System One returns one JSON response. It does not support streaming, video, tools, or generation controls.
- Shared state: Every question sees the same state. Answers are not passed from one question to another.
- Local request size: The documented local text and schema limit is 64 KiB, excluding images; the full request limit is 32 MiB. The complete input must fit the model's context window. Oversized input is rejected rather than silently truncated.
- Question count: The local endpoint supports named questions about the shared state. Keep question names stable and simple so the response can be mapped safely.
- Score interpretation: A score is a probability-weighted value over the ordered rubric, not a free-form explanation. The first rubric item is the lowest level.
- Confidence interpretation: Confidence is probability concentration, not calibrated accuracy. Evaluate it empirically before using it for routing.
For the exact current request and response schema, use the official System One API reference. Do not assume a chat endpoint's parameters, streaming behavior, or error semantics apply to this endpoint.
8. Troubleshoot common problems
Ollama returns 404 or says the model is missing
Check ollama list and run ollama pull nimble. Confirm that the Python client points to the same local Ollama server that you tested from the terminal.
The Python package has no systemone method
Check the installed package version with python -m pip show ollama. Upgrade to the official SDK release that includes System One support:
python -m pip install --upgrade "ollama==0.6.3"
The server rejects the request with HTTP 400
Validate the JSON shape. Every question needs a supported type and instructions. A choice question needs a criteria mapping; a score question needs an ordered criteria list. Keep option descriptions concise and avoid unsupported nested criteria.
The server rejects a large request
Reduce the ticket text, remove irrelevant quoted history, or split a large case into a deliberate pre-processing workflow. Do not assume the model's advertised context window overrides the endpoint's request-size limit.
The result is plausible but wrong
Review the state, category descriptions, and human labels. Add examples of confusing categories to your evaluation set. If two categories overlap, rewrite the criteria so each option describes a distinct responsibility. Do not fix poor classifications by blindly lowering the review threshold.
The machine runs out of memory or inference is slow
Close other model processes, check ollama ps, and try a smaller compatible decision model such as clef-flash only after reviewing its model requirements. Smaller does not automatically mean more accurate for your task. Benchmark on your own labeled set and hardware.
9. Security and privacy checklist
- Keep the Ollama API bound to localhost unless you have deliberately designed remote access with authentication, TLS, firewall rules, and network restrictions.
- Do not log raw ticket bodies by default. Store only the fields needed for audit and debugging, with retention controls.
- Strip or redact passwords, payment-card data, access tokens, and unrelated personal information before inference.
- Treat ticket text as untrusted data. A customer can include instructions such as “ignore the routing rules”; those words are input to classify, not instructions to your application.
- Never let the returned team, refund probability, score, or confidence bypass authorization checks. Keep financial actions and account changes behind deterministic business rules and human approval.
- Restrict the set of allowed categories and validate every returned choice against that allowlist before using it.
- Keep a human override path and record the model version, prompt/schema version, and final human decision for quality review.
10. When to use System One instead of chat or tool calling
Use System One when the task is a bounded decision: select one of a known set of labels, answer a proposition, or score against an ordered rubric. Use a normal chat model when you need a summary or explanation. Use tool calling when a model needs to propose a function invocation and your program must validate and execute it. The output types are different, so choose the interface that matches the job rather than treating System One as a replacement for every chat workflow.
If you want a safe, read-only agent that can inspect project files, see Ollama Tool Calling with Python. For a stateful application-owned agent loop using the OpenAI-compatible Responses endpoint, see the Ollama Responses API tutorial. For reusable local terminal prompts and private history, read Ollama + LLM CLI.
FAQ
Does System One generate a natural-language explanation?
No. It returns typed decisions and probabilities. If an explanation is needed, use a separate chat request and clearly distinguish that explanation from the decision result.
Does it work without an internet connection?
After Ollama and the model weights are installed, local inference can run without a cloud API. The initial installer and model download require network access.
Can I ask multiple questions in one request?
Yes. The questions share one state and are returned together. They do not depend on one another's answers.
Is a 0.95 confidence score a 95% chance the answer is correct?
No. It describes how concentrated the model's answer probabilities are. Measure actual correctness on your own labeled data before making threshold decisions.
Can the model issue refunds or call my tools?
No. This endpoint returns decisions; it does not execute tools. Keep any action in a separate application layer with authorization, validation, audit logging, and human approval where appropriate.
Can I use images?
Some decision models, including Clef variants, support image input. This guide uses text-only Nimble to keep the example small and reproducible. Consult the chosen model's official page and the endpoint reference before adding images.
Official documentation and release references
- Ollama Decision guide — supported models, CLI workflow, question types and examples.
- Ollama System One API reference — endpoint, request fields, response format, limits and errors.
- Nimble model page — model purpose, decision types, context and license.
- Ollama v0.40.19 release — server release dated 26 November 2026.
- Ollama Python v0.6.3 release — adds System One API support.
- Official Ollama Python SDK repository — client installation and API usage.
Final takeaway: System One is useful when an application needs constrained, repeatable decisions rather than another paragraph of generated text. Keep the categories explicit, test against human labels, interpret confidence cautiously, and leave consequential actions under deterministic controls.
