DecisionKit can export JSON-serializable audit records and deterministic digests.
audit = result.to_audit_dict(
decision_id="req-123",
metadata={"tenant": "acme"},
timestamp="2026-07-10T10:00:00Z", # optional; never auto-generated
include_hash=True,
)digest = result.audit_hash() # sha256 hex digestschema_versionmethodmodel(criteria, constraints, penalties, bonuses, explain flag)contextinput_alternative_ids(original caller order fromrank(...), not ranking order)excludedranking(scores, contributions, triggered rules, explanations)best
decision_idmetadatatimestampaudit_hashitself
To include a caller-supplied timestamp in the digest:
result.audit_hash(include_timestamp=True, timestamp="2026-07-10T10:00:00Z")The digest is hashlib.<algorithm> over UTF-8 JSON with:
sort_keys=True- compact separators
(",", ":") ensure_ascii=Falseallow_nan=False
Supported algorithms: sha256 (default), sha384, sha512.