Decision Contracts
Define typed Choice, Noul and Score decisions once, with their gates, properties and policies, in one versioned YAML file.
Decisions and results
Define decision contracts, test behavioral invariants, detect regressions, and gate unreliable model versions before production.
$ pip install decguard
$ decguard test decguard.yaml --all
refund_request (choice)
PASS min_accuracy 1.000 ≥ 0.9
PASS max_ece 0.139 ≤ 0.15
PASS min_coverage 0.727 ≥ 0.5
PASS option_order 0 / 33 violating
PASS whitespace 0 / 22 violating
PASS: all gates holdA Decision Contract describes the decision and what "reliable" means for it. Every command reads the same file.
schema_version: "0.1"
decision:
name: refund_request
description: How should this customer refund request be handled?
type: choice
options: [refund, reject, review]
backend: # Jev through OpenRouter; or mock, http, a plugin
provider: systemone
model: typesafe/jev-1.13
url: https://openrouter.ai/api/alpha/decisions
bearer_token_env: OPENROUTER_API_KEY
dataset: cases.jsonl
evaluation:
probability_tolerance: 0.02 # Jev rounds probabilities to two decimals
requirements: # violated -> FAIL, exit 1
min_accuracy: 0.9
max_ece: 0.1
properties: # decguard fuzz / decguard test --all
option_order:
max_tv_distance: 0.03| Command | Question it answers |
|---|---|
decguard test | Does the model meet its accuracy, calibration and coverage gates on the golden dataset? |
decguard fuzz | Does the answer stay stable when irrelevant details of the input change? |
decguard diff | Is the candidate version worse than the one it replaces? |
decguard check | Is the deployed model still calibrated on real traffic, in every segment? |
decguard run | Given this confidence, should the application accept, abstain, fall back or ask a human? |
Exit codes are the interface: 0 pass, 1 a reliability gate failed, 2 the run could not be evaluated. Start with the quickstart, or read what DecGuard is first.