This is the whole definition of Model Ops: 374 lines. The server reads it at start-up and builds the database, the API, the permissions, the rules and the workflows from it.
# model-ops/backend/domain.yaml
#
# Model Ops — the ML model lifecycle, with the gates written down.
#
# dataset (registered → approved by a data steward → deprecated)
# model → candidate (trained on an approved dataset)
# → evaluations (accuracy, fairness, robustness, latency, safety; each with
# its threshold and direction, `passed` must match the numbers)
# → approve (reviewer; needs accuracy, fairness and safety evaluations and no failures)
# → canary rollout (traffic %, error budget) → completed | halted
# → production (needs a completed canary; one production version per model)
# → superseded / retired
# rollback: requested → approved by a second person → executed
# Every 15 minutes: running rollouts whose error rate exceeds their budget halt.
#
# An ISDG product for ML platform teams.
# query() filter keys are single lowercase words.
domain:
name: modelops
version: "1.0.0"
description: >
ML model lifecycle: approved datasets, evaluation-gated promotion, canary
rollouts that halt on regression, four-eyes rollbacks and lineage.
resources:
dataset:
description: "A versioned training dataset. Nothing trains on it until a data steward approves it."
object:
id: { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
name: { type: string, required: true, maxLength: 120 }
tag: { type: string, required: true, maxLength: 20 }
rowCount: { type: integer, required: true, min: 1 }
sha256: { type: string, required: true, pattern: "^[0-9a-f]{64}$" }
source: { type: text, required: true }
containsPii: { type: boolean, required: true, default: false }
steward: { type: string, maxLength: 100 }
status: { type: string, required: true, default: registered }
stateMachine:
field: status
initial: registered
states:
registered:
transitions:
approve: { to: approved, guards: [steward, admin], requiredFields: [steward] }
approved:
transitions:
deprecate: { to: deprecated, guards: [steward, admin] }
deprecated: {}
permissions:
list: [mlengineer, reviewer, steward, sre, admin]
get: [mlengineer, reviewer, steward, sre, admin]
create: [mlengineer, steward, admin]
update: [steward, admin]
delete: [admin]
features: { audit: true }
indexes:
- { fields: [name, tag], unique: true }
model:
description: "A model family: one task, one owning team."
object:
id: { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
name: { type: string, required: true, unique: true, maxLength: 80 }
task: { type: string, required: true, enum: [classification, ranking, generation, embedding, forecasting, detection] }
team: { type: string, required: true, maxLength: 80 }
sloP95Ms: { type: integer, required: true, min: 1 }
permissions:
list: [mlengineer, reviewer, steward, sre, admin]
get: [mlengineer, reviewer, steward, sre, admin]
create: [mlengineer, admin]
update: [mlengineer, admin]
delete: [admin]
features: { audit: true }
candidate:
description: "One trained version of a model, from training to retirement."
object:
id: { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
model:
type: reference
references: "adl.modelops.modelops.model"
required: true
dataset:
type: reference
references: "adl.modelops.modelops.dataset"
required: true
semver: { type: string, required: true, pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$" }
framework: { type: string, required: true, maxLength: 40 }
artifactSha: { type: string, required: true, pattern: "^[0-9a-f]{64}$" }
approvedBy: { type: string, maxLength: 100 }
retireNote: { type: text }
status: { type: string, required: true, default: trained }
stateMachine:
field: status
initial: trained
states:
trained:
transitions:
approve: { to: approved, guards: [reviewer, admin], requiredFields: [approvedBy] }
reject: { to: rejected, guards: [reviewer, admin], requiredFields: [retireNote] }
approved:
transitions:
startCanary: { to: canary, guards: [sre, mlengineer, admin] }
canary:
transitions:
promote: { to: production, guards: [sre, admin] }
abandon: { to: rejected, guards: [sre, admin], requiredFields: [retireNote] }
production:
transitions:
supersede: { to: superseded, guards: [sre, admin] }
rollBack: { to: rolled_back, guards: [sre, admin] }
superseded:
transitions:
retire: { to: retired, guards: [mlengineer, admin], requiredFields: [retireNote] }
rolled_back:
transitions:
retire: { to: retired, guards: [mlengineer, admin], requiredFields: [retireNote] }
rejected: {}
retired: {}
permissions:
list: [mlengineer, reviewer, steward, sre, admin]
get: [mlengineer, reviewer, steward, sre, admin]
create: [mlengineer, admin]
update: [mlengineer, reviewer, sre, admin]
delete: [admin]
features: { audit: true }
history:
events:
approved: { trigger: transition, transition: approve, capture: [approvedBy], label: "Approved by {approvedBy}", severity: info }
canary: { trigger: transition, transition: startCanary, severity: info }
promoted: { trigger: transition, transition: promote, label: "Promoted to production", severity: success }
rolledBack: { trigger: transition, transition: rollBack, severity: error }
abandoned: { trigger: transition, transition: abandon, capture: [retireNote], label: "Abandoned: {retireNote}", severity: error }
indexes:
- { fields: [model, status] }
- { fields: [model, semver], unique: true }
evaluation:
description: "One metric on one evaluation suite, with its threshold."
object:
id: { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
candidate:
type: reference
references: "adl.modelops.modelops.candidate"
required: true
suite: { type: string, required: true, enum: [accuracy, fairness, robustness, latency, safety] }
metric: { type: string, required: true, maxLength: 60 }
value: { type: decimal, required: true, precision: 12, scale: 4 }
threshold: { type: decimal, required: true, precision: 12, scale: 4 }
direction: { type: string, required: true, enum: [higher_better, lower_better] }
passed: { type: boolean, required: true }
validation:
passedMatchesTheNumbers:
rule: "passed == ((direction == 'higher_better' && value >= threshold) || (direction == 'lower_better' && value <= threshold))"
message: "passed must agree with the value, the threshold and the direction."
permissions:
list: [mlengineer, reviewer, steward, sre, admin]
get: [mlengineer, reviewer, steward, sre, admin]
create: [mlengineer, admin]
update: [admin]
delete: [admin]
features: { audit: true }
indexes:
- { fields: [candidate] }
rollout:
description: "A canary rollout of a candidate, with its error budget."
object:
id: { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
candidate:
type: reference
references: "adl.modelops.modelops.candidate"
required: true
trafficPercent: { type: percentage, required: true }
errorBudget: { type: decimal, required: true, precision: 6, scale: 3, min: 0 }
errorRate: { type: decimal, required: true, precision: 6, scale: 3, min: 0, default: 0 }
latencyP95Ms: { type: integer, min: 0 }
haltReason: { type: text }
status: { type: string, required: true, default: running }
stateMachine:
field: status
initial: running
states:
running:
transitions:
complete: { to: completed, guards: [sre, admin] }
halt: { to: halted, guards: [sre, admin] }
completed: {}
halted: {}
permissions:
list: [mlengineer, reviewer, steward, sre, admin]
get: [mlengineer, reviewer, steward, sre, admin]
create: [sre, mlengineer, admin]
update: [sre, admin]
delete: [admin]
features: { audit: true }
history:
events:
halted: { trigger: transition, transition: halt, capture: [candidate, haltReason], label: "Canary halted", severity: error }
indexes:
- { fields: [candidate] }
- { fields: [status] }
rollback:
description: "Taking a production version out. Requested by one person, approved by another."
object:
id: { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
candidate:
type: reference
references: "adl.modelops.modelops.candidate"
required: true
reason: { type: text, required: true }
requestedBy: { type: string, required: true, maxLength: 100 }
approver: { type: string, maxLength: 100 }
decisionNote: { type: text }
status: { type: string, required: true, default: requested }
stateMachine:
field: status
initial: requested
states:
requested:
transitions:
approve: { to: approved, guards: [sre, admin], requiredFields: [approver] }
reject: { to: rejected, guards: [sre, admin], requiredFields: [approver, decisionNote] }
approved:
transitions:
execute: { to: executed, guards: [sre, admin] }
executed: {}
rejected: {}
permissions:
list: [mlengineer, reviewer, steward, sre, admin]
get: [mlengineer, reviewer, steward, sre, admin]
create: [mlengineer, sre, admin]
update: [sre, admin]
delete: [admin]
features: { audit: true }
indexes:
- { fields: [candidate] }
rules:
trainOnlyOnApprovedData:
description: "A candidate is trained only on a dataset a data steward approved."
trigger: { resource: candidate, events: [create] }
condition: "some(query('dataset', { id: $record.dataset }), d => d.status != 'approved')"
action: reject
severity: error
message: "The training dataset is not approved."
approveOnlyEvaluated:
description: "Approval needs accuracy, fairness and safety evaluations, and no failed evaluation of any kind."
trigger: { resource: candidate, events: [transition], transition: approve }
condition: "len(query('evaluation', { candidate: $record.id, suite: 'accuracy' })) == 0
|| len(query('evaluation', { candidate: $record.id, suite: 'fairness' })) == 0
|| len(query('evaluation', { candidate: $record.id, suite: 'safety' })) == 0
|| len(query('evaluation', { candidate: $record.id, passed: false })) > 0"
action: reject
severity: error
message: "Accuracy, fairness and safety must be evaluated, and every evaluation must pass."
productionNeedsACompletedCanary:
description: "Nothing reaches production without a canary that completed."
trigger: { resource: candidate, events: [transition], transition: promote }
condition: "len(query('rollout', { candidate: $record.id, status: 'completed' })) == 0"
action: reject
severity: error
message: "No completed canary rollout for this candidate."
oneProductionVersionPerModel:
description: "Supersede the current production version before promoting another."
trigger: { resource: candidate, events: [transition], transition: promote }
condition: "len(query('candidate', { model: $record.model, status: 'production' })) > 0"
action: reject
severity: error
message: "Another version of this model is in production. Supersede it first."
canaryOnlyForCanaries:
description: "Rollouts are opened only for candidates in canary."
trigger: { resource: rollout, events: [create] }
condition: "some(query('candidate', { id: $record.candidate }), c => c.status != 'canary')"
action: reject
severity: error
message: "This candidate is not in canary."
fourEyesOnRollbacks:
description: "Whoever requested a rollback can't approve it."
trigger: { resource: rollback, events: [transition], transition: approve }
condition: "$record.approver == $record.requestedBy"
action: reject
severity: error
message: "A different SRE must approve this rollback."
rollBackOnlyUnderAnApprovedRollback:
description: "A production version is rolled back only under an approved (or executed) rollback."
trigger: { resource: candidate, events: [transition], transition: rollBack }
condition: "len(query('rollback', { candidate: $record.id, status: 'approved' })) == 0
&& len(query('rollback', { candidate: $record.id, status: 'executed' })) == 0"
action: reject
severity: error
message: "An approved rollback is required."
schedules:
haltCanariesOverBudget:
description: "Running canaries whose error rate exceeds their budget halt automatically."
recurrence: every 15 minutes
source:
resource: rollout
filter: "status == 'running' && errorRate > errorBudget"
action: transition
transition: halt
# ADL §37 (needs kalos with #2142). A halted canary abandons its version, so a
# version that failed in front of real traffic can't be started again by
# accident. Halts come from an SRE or from haltCanariesOverBudget, which sets
# no reason, so the note falls back to the budget. A transition trigger
# carries only what the history event captures: `halted` captures both.
workflows:
haltedCanaryAbandonsVersion:
description: "A halted canary abandons its candidate version."
trigger:
resource: rollout
event: transition
transition: halt
steps:
- name: abandonCandidate
action: transition
resource: candidate
transition: abandon
target: $trigger.record.candidate
input:
retireNote: "$trigger.record.haltReason ?? 'Canary halted: error rate over its budget.'"
views:
promotionPipeline:
description: "Every candidate and where it stands."
source: candidate
permissions: [mlengineer, reviewer, steward, sre, admin]
columns:
- { field: semver, label: "Version" }
- { field: framework, label: "Framework" }
- { field: approvedBy, label: "Approved by" }
- { field: status, label: "State" }
defaultLimit: 500
failingEvaluations:
description: "Evaluations below threshold — why a candidate is blocked."
source: evaluation
filter: "passed == false"
permissions: [mlengineer, reviewer, admin]
columns:
- { field: suite, label: "Suite" }
- { field: metric, label: "Metric" }
- { field: value, label: "Value" }
- { field: threshold, label: "Threshold" }
defaultLimit: 200
liveCanaries:
description: "Running canaries against their error budget."
source: rollout
filter: "status == 'running'"
permissions: [sre, mlengineer, admin]
columns:
- { field: trafficPercent, label: "Traffic %" }
- { field: errorRate, label: "Error rate" }
- { field: errorBudget, label: "Budget" }
- name: overBudget
label: "Over budget"
computed: "errorRate > errorBudget"
defaultLimit: 200