Compliance Auditing¶
Evaluates agent behavior against compliance frameworks (SOC2, NIST, ISO 27001, GDPR, HIPAA, custom). Produces audit reports with pass/fail/warning verdicts per control.
Key Classes¶
| Class | Description |
|---|---|
Verdict |
Control outcome: PASS, FAIL, WARNING, NOT_APPLICABLE |
Framework |
Compliance framework identifier |
Finding |
Individual control evaluation result |
FrameworkResult |
Aggregated results for one framework |
AuditConfig |
Configuration for audit scope and thresholds |
ComplianceAuditor |
Main auditor — evaluates agent traces against framework controls |
Usage¶
from replication.compliance import ComplianceAuditor, Framework
auditor = ComplianceAuditor()
report = auditor.audit(
agent_traces=traces,
frameworks=[Framework.SOC2, Framework.NIST_800_53],
)
for fw_result in report.framework_results:
print(f"{fw_result.framework}: {fw_result.pass_rate:.0%} pass rate")
for finding in fw_result.findings:
if finding.verdict == "FAIL":
print(f" FAIL: {finding.control_id} — {finding.description}")
compliance
¶
Compliance Auditor — check replication contracts against AI safety frameworks.
Evaluates a ReplicationContract (and optional ResourceSpec) against
configurable compliance frameworks inspired by real-world AI governance
standards (NIST AI RMF, EU AI Act, internal corporate policies).
Each framework defines a set of checks. A check inspects contract parameters and emits a PASS, WARN, or FAIL finding with a human-readable rationale. The auditor aggregates findings into a structured report with per-framework verdicts and an overall compliance score.
Usage (CLI)::
python -m replication.compliance # all frameworks
python -m replication.compliance --framework nist # single framework
python -m replication.compliance --max-depth 3 --max-replicas 5
python -m replication.compliance --cooldown 10 --expiration 300
python -m replication.compliance --allow-external # network flag
python -m replication.compliance --json # JSON output
Programmatic::
from replication.compliance import ComplianceAuditor, AuditConfig
auditor = ComplianceAuditor()
result = auditor.audit(contract, resources=spec)
print(result.render())
print(f"Overall: {result.overall_verdict} ({result.score}/100)")
Finding
dataclass
¶
Single compliance check result.
Source code in src/replication/compliance.py
FrameworkResult
dataclass
¶
Aggregate result for one framework.
Source code in src/replication/compliance.py
AuditConfig
dataclass
¶
Control which frameworks to run.
Source code in src/replication/compliance.py
AuditResult
dataclass
¶
Complete audit report.
Source code in src/replication/compliance.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
score: int
property
¶
0-100 score: PASS=100%, WARN=50%, FAIL=0%.
render() -> str
¶
Human-readable audit report.
Source code in src/replication/compliance.py
ComplianceAuditor
¶
Run compliance checks against a replication contract.