ommat
ommat is a Python decision engine for workflows that put many small, closed questions to a model. You write each question and each rule separately and declare what it reads. ommat works out the order, skips the questions that earlier answers make unnecessary, and returns a record of the turn that can be replayed without calling the model.
An assistant design with nine questions, each drawn as a small idia, decides three requests. Each round, ommat sends the model only the questions that are ready. The first two requests each take five questions in two calls, a different pair in the second call, and four are never asked. The third is vague, so d:action is the marker Unsure after one call and nothing more is asked. The model's answers are canned; the calls, the skipped questions, the values and the marker are drawn from a run of the engine by draw.py, and assistant.py prints a turn in a terminal.
TL;DR
- You write questions and rules, and each declares what it reads. You don't write the order they run in.
- ommat builds the dependency graph from those declarations, runs it in rounds, and sends the questions that are ready at the same time in one call. A question that depends on an earlier answer is asked only when that answer calls for it.
- When an answer isn't confident enough to act on, the result is a marker (
Unsure,UnavailableorUnasked) that names its cause, so your code can send it to a person or a larger model. It is neverNone. - Each turn produces a record. Replaying it reruns the rules against the recorded answers with no model call, which makes debugging and evals cheap.
- The core imports only the standard library. Python 3.11+, MIT.
Install
pip install ommat
A first decision
This runs as it is, with no API key: a fixed binding answers in place of a model.
The design is a help desk. A source puts questions to a model: a choice picks a label and a noul is yes or no. A rule reads answers and settles a value. The design asks what a message is about, and asks whether the customer wants money back only when the message is about billing:
from ommat import Design, Question, ReadView, Rule, Source, SourceRequirement, Text
from ommat import Undetermined, decide_sync, escalation, load, replay_sync
from ommat import types as t
from ommat.bindings import fixed
from ommat.helpers import pick_with_margin
TOPICS = ["billing", "shipping", "other"]
def topic(r: ReadView) -> str | Undetermined:
return pick_with_margin(r, "q:topic", 0.6, 0.2) # top label at 0.6 or more, 0.2 clear
def route(r: ReadView) -> str | Undetermined:
topic = r.read("d:topic")
if topic != "billing":
return topic # a queue name, or the marker saying why there is none
refund = pick_with_margin(r, "q:refund", 0.6, 0.2)
if isinstance(refund, Undetermined):
return refund
return "refunds" if refund == "yes" else "billing"
DESIGN = Design(
name="helpdesk",
state=t.record(message=t.string),
sources={
"triage": Source(
{"q:topic": Question("choice", Text("What is the message about?"), TOPICS)},
needs=["t:state"],
),
"billing": Source(
{"q:refund": Question("noul", Text("Does the customer want money back?"))},
needs=["t:state"],
requirement=SourceRequirement("d:topic", ["billing"]), # ask only about billing
),
},
rules={
"topic": Rule("d:topic", t.label(*TOPICS), topic, version="1", reads=["q:topic"]),
"route": Rule(
"d:route",
t.label("refunds", *TOPICS),
route,
version="1",
reads=["d:topic", "q:refund"],
),
},
)
The design doesn't say what runs first. route reads d:topic and the billing source requires it, and ommat orders the turn from those declarations.
Now decide three messages. The stand-in model would answer yes to the refund question for all three, so when q:refund goes unasked, that is the engine's decision:
loaded = load(DESIGN) # checks the whole design before any turn runs
YES = {"yes": 0.9, "no": 0.1}
INBOX = {
"The invoice is wrong and I want a refund.": {"billing": 0.8, "shipping": 0.1, "other": 0.1},
"Where is my parcel?": {"billing": 0.05, "shipping": 0.9, "other": 0.05},
"Hello?": {"billing": 0.4, "shipping": 0.35, "other": 0.25},
}
for message, topics in INBOX.items():
model = fixed({"q:topic": topics, "q:refund": YES})
record = decide_sync(loaded, {"message": message}, {"default": model}).record
asked = [ref for ref, e in record.entries.items() if ref[:2] == "q:" and "value" in e]
print(message)
print(" route:", record.entries["d:route"].get("value", "undecided"))
print(" asked:", ", ".join(asked))
if why := escalation(record, "d:route"):
print(" why:", why["kind"], why["root_cause"])
_, findings = replay_sync(record, loaded)
print(" replay findings:", findings)
It prints:
The invoice is wrong and I want a refund.
route: refunds
asked: q:topic, q:refund
replay findings: []
Where is my parcel?
route: shipping
asked: q:topic
replay findings: []
Hello?
route: undecided
asked: q:topic
why: Unsure {'code': 'abstained', 'refs': ['q:topic']}
replay findings: []
The parcel message was never asked the refund question: its topic wasn't billing, so q:refund holds Unasked. For "Hello?" no topic reached the 0.6 bar, so d:topic is Unsure, d:route passes that marker on, and escalation traces it back to q:topic. Each replay_sync reran its turn from the record and found no differences.
In a real project the design lives in its own module, so that it has the same hash from every script that imports it. The tutorial Write your first design starts there.
Why it exists
Judgement models answer a closed question with probabilities instead of prose, quickly and cheaply enough that I stopped rationing questions. A dozen can be sequenced by hand. A hundred can't, because the answer to one decides whether another is asked at all, and those dependencies end up encoded in the order of the code, where they are hard to see and easy to break.
With ommat each piece declares what it reads and the engine does the sequencing. load checks the whole design before any turn runs, and refuses one where a read has no provider, something depends on itself, or the types disagree.
A rule can also be a decision table as DMN 1.5 defines one, and the declared reads are DMN's information requirements. ommat adds what DMN leaves out and this job needs: markers with causes where DMN has one null, rounds where DMN has a single pass, and a record of every turn.
Is it for you?
It fits when:
- your workflow's decision is made of many closed questions, and later ones depend on earlier answers;
- you need to explain why a turn went the way it did, or rerun last month's turns against today's rules without paying for the model again;
- an uncertain answer has to be routed somewhere, and a default value would hide it.
It doesn't fit when:
- one prompt and an
ifstatement cover the decision; - you want generated text. ommat only decides, though it can hand the turn to a generative model afterwards;
- you want a workflow runner. ommat has no schedules or retries, and no state carries between turns.
Real models
idia puts the questions to judgement-model providers, and ommat[idia] ships the binding. Install it with idia's extras for your providers:
pip install "ommat[idia]" "idia[openai,cloudflare]"
The tutorial Decide with real models through idia covers the rest. A binding of your own is a plain async function, as Add a source shows.
Viewing a turn
Save decision.record.document and loaded.document as .json files, then:
python -m ommat.lens records/ --open # a page that draws each turn
python -m ommat.outline records/ # the same, as text
These are the quickstart's three turns. The page holds the records whole, user text included, so store it as carefully as you store them.
Docs
- Write your first design: the tutorial to start with.
- Decide with real models through idia: bind a design to providers.
- How-tos: add a source, gate a source on an earlier estimate, read a record, hand off a turn to a generative model, combine designs and lay out a design module.
- The spec: the normative description, including evals from recorded turns and designs as TOML.
- skills/ommat: a skill for coding agents. For Claude Code, from a clone at v0.5.1:
cp -r skills/ommat ~/.claude/skills/. - CHANGELOG.md: each release.
Status
ommat is pre-release, at 0.5.0, with one maintainer. The public names carry no stability promise before 1.0, and the changelog says what each release changes. Issues come first: see CONTRIBUTING.md, and report vulnerabilities privately as SECURITY.md describes. MIT licensed.
The name
Ommat and Idia come from ommatidia, the thousands of small hexagonal eyes that make up a compound eye and combine into one picture. Many small, cheap questions add up to one full picture. Ommat is the engine that asks them; Idia puts them to the models.
Metadata
Release files for ommat 0.5.1
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 |
|---|---|---|---|---|
| ommat-0.5.1.tar.gz | 1.8 MB | With provenance | Details for ommat-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ommat-0.5.1-py3-none-any.whl | Python 3 | none | any | Details for ommat-0.5.1-py3-none-any.whl |
Total release size: 2.2 MB
Release files / ommat-0.5.1.tar.gz
| Download URL | ommat-0.5.1.tar.gz |
|---|---|
| Size | 1.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c0149874ea50c4fb63352cdcae63e712e2d879f2ceae11c77806ac2d089c3e6
|
|
BLAKE2b-256 checksum How to use checksums |
eef8576b399ba54f35d58092d1b2b14e973b311f919d66f4cbb40b889c7c8f38
|
| 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 29, 2026.
Transparency logRelease files / ommat-0.5.1-py3-none-any.whl
| Download URL | ommat-0.5.1-py3-none-any.whl |
|---|---|
| Size | 451.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5920e261b6fac8a5afccb9f8a778fe73e0e1fc84a589828f1de81b20c5a92450
|
|
BLAKE2b-256 checksum How to use checksums |
98c266883541f761c35a5818088777bae864da453448922bf94e566f0c724ddf
|
| 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 29, 2026.
Transparency logSecurity for ommat 0.5.1
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 ommat-0.5.1.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 29, 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.