Architecture
A domain profile is defined by theDomainProfile dataclass, which contains all the domain-specific configuration that layers on top of Attesta’s base scoring engine.
DomainProfile Structure
| Field | Type | Description |
|---|---|---|
name | str | Unique identifier (e.g., "my-industry") |
display_name | str | Human-readable label |
description | str | Summary of the profile’s purpose |
risk_patterns | list[RiskPattern] | Regex patterns that contribute to risk scoring |
sensitive_terms | dict[str, float] | Terms mapped to risk weights (0.0-1.0) |
critical_actions | list[str] | Function names that are always CRITICAL |
safe_actions | list[str] | Function names that are always LOW |
compliance_frameworks | list[str] | Applicable regulatory frameworks |
escalation_rules | list[EscalationRule] | Conditions that trigger extra approvers |
challenge_templates | list[DomainChallengeTemplate] | Domain-specific challenge questions |
min_review_overrides | dict | Per-risk-level review time overrides |
base_risk_floor | float | Minimum risk score for any action in this domain |
production_multiplier | float | Risk multiplier when running in production |
required_vocabulary | list[str] | Terms operators must understand |
RiskPattern
Each risk pattern defines a regex that matches against a specific part of the action context:| Target | What It Matches Against |
|---|---|
function_name | The gated function’s name |
args | Positional argument values (stringified) |
kwargs | Keyword argument values (stringified) |
docstring | The function’s docstring |
any | All of the above (matches if any target contains the pattern) |
EscalationRule
Escalation rules define conditions that require additional approvers or notifications beyond the standard challenge:| Condition | Example | Description |
|---|---|---|
| Risk score comparison | "risk_score > 0.9" | Numeric comparison on risk score |
| Pattern match | "matches_pattern:phi_access" | Fires when a named pattern matched |
| Environment check | "environment:production" | Fires when environment matches |
| Risk level check | "risk_level:critical" | Fires when risk level matches |
DomainChallengeTemplate
Challenge templates provide domain-specific questions for comprehension challenges:Domain Registry
TheDomainRegistry manages all registered domain profiles:
Merge Strategy
When merging multiple domains viaDomainRegistry.merge(), the strategy is conservative — it always picks the stricter option:
- Lists (risk_patterns, critical_actions, etc.): Union of all entries
- Dicts (sensitive_terms, min_review_overrides): Union with max value for conflicts
- Scalars (base_risk_floor, production_multiplier): Take the higher value
Registering Presets
You can register profiles as loadable presets for use inattesta.yaml:
Activation
Activate domain profiles viaattesta.yaml or programmatically:
Next Steps
Custom Domains
Build and deploy custom domain profiles
Custom Risk Scorer
Build risk scorers from scratch