Skip to content

Policy Authoring Guide

This guide explains how to write OSCAL policy files for Venturalitica. Policies define the fairness, performance, privacy, and data quality controls your AI system must pass.


Venturalitica uses the OSCAL assessment-plan format as its canonical policy format. While the SDK loader supports multiple OSCAL document types (catalog, system-security-plan, component-definition, profile), you should write new policies in assessment-plan format.


The simplest valid policy has one control:

assessment-plan:
metadata:
title: "My First Policy"
control-implementations:
- description: "Fairness Controls"
implemented-requirements:
- control-id: bias-check
description: "Disparate impact must satisfy the Four-Fifths Rule"
props:
- name: metric_key
value: disparate_impact
- name: threshold
value: "0.8"
- name: operator
value: ">"
- name: "input:dimension"
value: gender

Enforce it:

import venturalitica as vl
results = vl.enforce(
data=df,
target="class",
gender="Attribute9",
policy="my_policy.oscal.yaml"
)

Each control (an implemented-requirement) has these properties:

PropertyRequiredDescription
control-idYesUnique identifier for this control
descriptionNoHuman-readable description
propsYesList of key-value properties (see below)
Prop NameRequiredDescriptionExample
metric_keyYesRegistry key of the metric to computedisparate_impact
thresholdYesNumeric threshold value (as string)"0.8"
operatorYesComparison operator">", "<", ">=", "<=", "==", "gt", "lt"
input:dimensionDependsProtected attribute for fairness metricsgender, age
input:targetNoOverride target column for this controlclass
input:predictionNoOverride prediction columny_pred

Professional compliance separates data and model audits into two policies:

Checks the training data before model training:

assessment-plan:
metadata:
title: "Article 10: Data Assurance"
control-implementations:
- description: "Data Quality & Fairness"
implemented-requirements:
- control-id: data-imbalance
description: "Minority class must be > 20%"
props:
- name: metric_key
value: class_imbalance
- name: threshold
value: "0.2"
- name: operator
value: ">"
- control-id: data-gender-bias
description: "Gender disparate impact > 0.8 (Four-Fifths Rule)"
props:
- name: metric_key
value: disparate_impact
- name: "input:dimension"
value: gender
- name: threshold
value: "0.8"
- name: operator
value: ">"
- control-id: data-age-bias
description: "Age disparity > 0.5"
props:
- name: metric_key
value: disparate_impact
- name: "input:dimension"
value: age
- name: threshold
value: "0.5"
- name: operator
value: ">"

Checks model predictions after training:

assessment-plan:
metadata:
title: "Article 15: Model Assurance"
control-implementations:
- description: "Model Performance & Fairness"
implemented-requirements:
- control-id: model-accuracy
description: "Model accuracy >= 80%"
props:
- name: metric_key
value: accuracy_score
- name: threshold
value: "0.80"
- name: operator
value: ">="
- control-id: model-fairness
description: "Demographic parity difference < 0.10"
props:
- name: metric_key
value: demographic_parity_diff
- name: "input:dimension"
value: gender
- name: threshold
value: "0.10"
- name: operator
value: "<"

The recommended pattern is two separate calls — one per audit stage:

# Pre-training: audit the data
vl.enforce(data=train_df, target="class", gender="Attribute9",
policy="data_policy.oscal.yaml")
# Post-training: audit the model
vl.enforce(data=test_df, target="class", prediction="y_pred",
gender="Attribute9", policy="model_policy.oscal.yaml")

You can also pass a list of policies in a single call. Controls whose required inputs are not provided (e.g., prediction for model policies) will be silently skipped:

# Only data-policy controls will run here because
# 'prediction' is not provided — model-policy controls are skipped.
vl.enforce(
data=df,
target="class",
gender="Attribute9",
policy=["data_policy.oscal.yaml", "model_policy.oscal.yaml"]
)
# To evaluate both policies, supply all required inputs:
vl.enforce(
data=test_df,
target="class",
prediction="y_pred",
gender="Attribute9",
policy=["data_policy.oscal.yaml", "model_policy.oscal.yaml"]
)

Any metric registered in METRIC_REGISTRY can be used as a metric_key. See Metrics Reference for the full list. Common ones:

CategoryMetric KeyTypical OperatorTypical Threshold
Data Qualitydisparate_impact>0.8
Data Qualityclass_imbalance>0.2
Performanceaccuracy_score>=0.80
Performancef1_score>=0.75
Fairnessdemographic_parity_diff<0.10
Fairnessequalized_odds_ratio<0.20
Privacyk_anonymity>=5

The input:dimension prop tells the SDK which protected attribute to analyze. The value is an abstract name that gets resolved via Column Binding:

# In your policy:
- name: "input:dimension"
value: gender # Abstract name
# In your Python:
vl.enforce(data=df, gender="Attribute9") # Maps 'gender' -> 'Attribute9'

You can group controls logically:

assessment-plan:
metadata:
title: "Comprehensive AI Assurance Policy"
control-implementations:
- description: "Data Quality Controls (Article 10)"
implemented-requirements:
- control-id: dq-001
# ...
- control-id: dq-002
# ...
- description: "Fairness Controls (Article 9)"
implemented-requirements:
- control-id: fair-001
# ...
- description: "Privacy Controls (GDPR)"
implemented-requirements:
- control-id: priv-001
# ...

The Dashboard Policy Editor provides a visual interface for creating policies:

  1. Run venturalitica ui
  2. Navigate to Phase 2: Risk Policy
  3. Use the form to add controls, select metrics, and set thresholds
  4. The editor generates assessment-plan OSCAL YAML and saves it to your project

See Dashboard Guide for details.


FilePurpose
data_policy.oscal.yamlPre-training data audit controls
model_policy.oscal.yamlPost-training model audit controls
risks.oscal.yamlCombined quickstart policy (used by vl.quickstart())

The .oscal.yaml extension is a convention, not a requirement. The SDK loads any .yaml file.


While assessment-plan is canonical, the loader also accepts:

FormatSupport LevelNotes
assessment-planPrimaryCanonical format, Dashboard generates this
catalogSupportedUsed in some advanced samples
system-security-planSupportedUsed by SaaS pull command
component-definitionSupportedStandard OSCAL component format
profileSupportedOSCAL profile format
Flat YAML listFallbackEmergency format for simple lists