Skip to main content

Enterprise Governance Architecture

ASCEND provides banking-level governance for AI agents and MCP servers. This guide covers the enterprise features implemented in the backend that enable organizations to maintain full control over autonomous AI systems.

Overview

ASCEND's governance architecture is built on three verified pillars:

┌─────────────────────────────────────────────────────────────────────────────┐
│ ASCEND ENTERPRISE GOVERNANCE │
│ (Verified Backend Implementation - SEC-077) │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │
│ │ Circuit Breaker │ │ Anomaly Detection│ │ Policy Resolver │ │
│ │ │ │ │ │ │ │
│ │ Auto-disable │ │ Z-score based │ │ Priority-based │ │
│ │ failing servers │ │ behavior alerts │ │ conflict detect │ │
│ └────────┬─────────┘ └────────┬─────────┘ └────────┬─────────┘ │
│ │ │ │ │
│ └─────────────────────┼─────────────────────┘ │
│ │ │
│ ┌──────────▼──────────┐ │
│ │ Policy Enforcement │ │
│ │ Cedar-style engine │ │
│ │ Natural language │ │
│ └─────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘

Backend Source: /ow-ai-backend/services/ (SEC-077 implementation)


Circuit Breaker Pattern

The circuit breaker automatically detects and isolates failing MCP servers to prevent cascade failures across your AI infrastructure.

Implementation

Backend Service: /ow-ai-backend/services/circuit_breaker_service.py (SEC-077) Lines: 1-456 (456 lines of code) Industry Alignment: Netflix Hystrix, AWS ALB health checks

States

StateDescriptionRequest BehaviorBackend Implementation
CLOSEDNormal operationRequests pass throughCircuitState.CLOSED (line 31)
OPENFailures exceeded thresholdRequests blocked immediatelyCircuitState.OPEN (line 32)
HALF_OPENRecovery testingLimited probe requests allowedCircuitState.HALF_OPEN (line 33)

State Transitions

┌─────────┐  failure_threshold  ┌─────────┐  timeout  ┌───────────┐
│ CLOSED │ ─────────────────→ │ OPEN │ ────────→ │ HALF_OPEN │
│(healthy)│ │(blocked)│ │ (testing) │
└────┬────┘ ←───────────────────└─────────┘ ←──────── └─────┬─────┘
│ recovery failure │
└───────────────────────────────────────────────────────┘
success

Source: circuit_breaker_service.py (lines 43-54)

Configuration

Configure circuit breaker thresholds per MCP server:

{
"server_id": "mcp-production-001",
"circuit_failure_threshold": 5,
"circuit_recovery_timeout_seconds": 300,
"circuit_required_successes": 2
}

Default Values (from models_mcp_governance.py):

  • circuit_failure_threshold: 5 consecutive failures
  • circuit_recovery_timeout_seconds: 300 seconds (5 minutes)
  • circuit_required_successes: 2 successful probes to close

Key Methods

MethodPurposeLine Reference
record_success()Record successful MCP callLines 61-105
record_failure()Record failed MCP callLines 107-169
check_circuit()Check if requests allowedLines 171-238
force_open()Emergency shutdown (audit logged)Lines 240-268
force_close()Manual recovery (audit logged)Lines 270-300

Audit Trail

All circuit state changes are logged to circuit_breaker_events table:

# From circuit_breaker_service.py (lines 411-449)
{
"organization_id": 1,
"server_id": "mcp-prod-001",
"event_time": "2025-12-04T10:00:00Z",
"previous_state": "CLOSED",
"new_state": "OPEN",
"trigger_reason": "failure_threshold_exceeded",
"failure_count": 5,
"correlation_id": "sha256:..."
}

Anomaly Detection

Real-time statistical analysis of agent behavior to detect unusual patterns that may indicate security threats or misconfigurations.

Implementation

Backend Service: /ow-ai-backend/services/anomaly_detection_service.py (SEC-077) Lines: 1-522 (522 lines of code) Algorithm: Z-score based detection (industry standard)

Algorithm

# From anomaly_detection_service.py (lines 198-199)
z = (current_value - baseline_mean) / standard_deviation

# If |z| > threshold → ANOMALY DETECTED

Thresholds (lines 451-457):

if z_score > 4.0:
severity = "CRITICAL" # Auto-suspend if enabled
elif z_score > 3.0:
severity = "HIGH" # Escalation triggered
elif z_score > 2.0:
severity = "MEDIUM" # Alert sent
else:
severity = "LOW" # Log only

Monitored Metrics

MetricDescriptionCalculation MethodLine Reference
Actions/HourRequest frequencyEMA + SMALines 223-225
Error RateFailed action percentageRolling averageLines 227-229
Risk ScoreAverage risk of actionsRolling averageLines 231-233

Data Source: Hourly aggregates from agent_actions table (lines 397-429)

Severity Levels

Z-Score RangeSeverityActionLine Reference
2.0 - 3.0LOWLog onlyLine 452
3.0 - 4.0MEDIUMAlert sentLine 456
4.0 - 5.0HIGHEscalation triggeredLine 454
> 5.0CRITICALAuto-suspension (if enabled)Lines 148-158

Configuration

# From anomaly_detection_service.py (lines 318-372)
{
"agent_id": "agent-001",
"anomaly_detection_enabled": true,
"anomaly_sensitivity": 2.0, # Z-score threshold (1.0-4.0)
"anomaly_auto_suspend": false, # Auto-suspend on critical
"anomaly_escalation_threshold": 3, # Consecutive anomalies before escalation
"baseline_window_hours": 168 # 1 week baseline
}

API Methods

MethodPurposeReturnsLine Reference
check_agent_anomalies()Detect anomalies for agentDetection resultsLines 72-186
update_rolling_statistics()Update baseline metricsUpdated statisticsLines 188-266
get_anomaly_history()Historical anomaly eventsList of eventsLines 268-316
configure_agent_detection()Configure detection settingsUpdated configLines 318-372

Auto-Suspension

Implementation (lines 148-158):

if (
agent.anomaly_auto_suspend and
max_severity == AnomalySeverity.CRITICAL
):
agent.status = "suspended"
agent.auto_suspended_at = now
agent.auto_suspend_reason = f"SEC-077: Critical anomaly detected - {anomalies[0]['metric']}"
logger.warning(f"SEC-077: Agent {agent.agent_id} AUTO-SUSPENDED due to critical anomaly")

Policy Conflict Resolution

Automatically detects and resolves conflicts between overlapping governance policies.

Implementation

Backend Service: /ow-ai-backend/services/policy_conflict_resolver.py (SEC-077) Lines: 1-465 (465 lines of code) Pattern: AWS IAM policy evaluation logic, Cedar policy language

Conflict Types

TypeDescriptionSeverityLine Reference
PRIORITY_TIESame priority on overlapping scopeHIGHLine 30
EFFECT_CONTRADICTIONALLOW vs DENY on same resourceCRITICALLine 31
RESOURCE_OVERLAPAmbiguous resource patternsMEDIUMLine 32
CONDITION_AMBIGUITYAmbiguous condition evaluationMEDIUMLine 33

Source: policy_conflict_resolver.py (lines 28-34)

Resolution Strategies

StrategyDescriptionUse CaseLine Reference
MOST_RESTRICTIVEDENY always winsSecurity-first (default)Lines 436-443
MOST_PERMISSIVEALLOW wins unless explicit DENYAvailability-firstLines 445-450
HIGHEST_PRIORITYLower number = higher priorityExplicit orderingLines 452-454
FIRST_MATCHFirst matching policy winsCedar-style evaluationLines 456-458

Default Strategy (line 76):

self.default_strategy = ResolutionStrategy.MOST_RESTRICTIVE

API Methods

MethodPurposeLine Reference
detect_conflicts()Scan all policies for conflictsLines 78-120
resolve_policy_match()Resolve multiple matching policiesLines 122-173
record_conflict()Log conflict to databaseLines 175-218
resolve_conflict()Mark conflict as resolvedLines 220-266
get_unresolved_conflicts()Get pending conflictsLines 268-305

Conflict Detection Example

# From policy_conflict_resolver.py (lines 307-360)
# Detects MCP policy conflicts
for policy_a, policy_b in policy_pairs:
if policy_a.priority == policy_b.priority:
if self._scopes_overlap(policy_a, policy_b):
# PRIORITY_TIE conflict detected
# Record to policy_conflicts table
# Severity: HIGH

Best Practice: Priority Assignment

1-99:    System policies (reserved)
100-199: Security policies
200-299: Compliance policies
300-399: Business policies
400+: Custom policies

Policy Enforcement

Cedar-style policy engine with natural language compilation.

Implementation

Backend Service: /ow-ai-backend/services/cedar_enforcement_service.py Lines: 1-321 (321 lines of code) Pattern: AWS Cedar policy language, Open Policy Agent (OPA)

Policy Compilation

Compiler Class (lines 49-126):

class PolicyCompiler:
@staticmethod
def compile(natural_language: str, risk_level: str) -> Dict[str, Any]:
"""Convert natural language policy to structured Cedar-style policy"""
# Extracts: effect, actions, resources, conditions
# Validation: PolicyValidator.validate_natural_language()

Supported Effects:

  • deny: Block the action
  • permit: Allow the action
  • require_approval: Require human approval

Enforcement Engine

Engine Class (lines 128-318):

class EnforcementEngine:
def evaluate(
self,
principal: str,
action: str,
resource: str,
context: Optional[Dict] = None
) -> Dict[str, Any]:
"""
Evaluate action against all policies
Returns: {decision: "ALLOW|DENY|REQUIRE_APPROVAL", policies_triggered: [...]}
"""

Decision Logic (lines 182-198):

for policy in self.policies:
if self._matches_policy(policy, principal, action, resource, context):
if policy.effect == "deny":
final_decision = "DENY" # Deny takes precedence
break
elif policy.effect == "require_approval":
final_decision = "REQUIRE_APPROVAL"

Semantic Action Taxonomy

Implementation: services/action_taxonomy.py

def actions_match(policy_action: str, actual_action: str) -> bool:
"""
Semantic matching of actions
Example: "write" matches "file.write", "database.insert", "api.create"
"""

def resource_matches(policy_resource: str, actual_resource: str) -> bool:
"""
Hierarchical resource matching with wildcards
Example: "database:*" matches "database:prod", "database:staging"
"""

Source: cedar_enforcement_service.py (lines 243-258)


Compliance Mapping

FeatureSOC 2PCI-DSSNISTGDPRBackend File
Circuit BreakerCC7.16.5.5SI-4circuit_breaker_service.py
Anomaly DetectionCC7.110.6SI-4anomaly_detection_service.py
Policy ResolverCC6.17.1AC-3policy_conflict_resolver.py
Policy EnforcementCC6.17.1AC-3cedar_enforcement_service.py

API Endpoints

All governance features are accessible via REST API:

EndpointMethodDescriptionBackend Route
/api/governance/circuitsGETGet all circuit statesCircuit breaker service
/api/governance/circuits/{server_id}GETGet specific circuit statusCircuit breaker service
/api/governance/anomalies/{agent_id}GETCheck agent anomaliesAnomaly detection service
/api/governance/policies/conflictsGETDetect policy conflictsPolicy resolver service
/api/governance/policies/evaluatePOSTEvaluate policy decisionPolicy enforcement service

Monitoring & Alerts

AlertConditionSeverityBackend Trigger
Circuit OpenAny MCP server circuit opensHIGHcircuit_state == "OPEN"
Anomaly Streak3+ consecutive anomaliesHIGHconsecutive_anomalies >= 3
Policy ConflictCritical conflict detectedCRITICALseverity == "critical"
Auto-SuspensionAgent auto-suspendedCRITICALauto_suspended_at IS NOT NULL

SIEM Integration

Metrics for Export:

ascend.circuit_breaker.state (CLOSED/OPEN/HALF_OPEN)
ascend.circuit_breaker.failure_count
ascend.anomaly.detection_count
ascend.anomaly.severity (LOW/MEDIUM/HIGH/CRITICAL)
ascend.policy.conflict_count
ascend.policy.evaluation_count

Implementation Verification

All governance features documented here are verified implementations:

FeatureBackend FileLinesStatus
Circuit Breakercircuit_breaker_service.py456✅ Implemented (SEC-077)
Anomaly Detectionanomaly_detection_service.py522✅ Implemented (SEC-077)
Policy Resolverpolicy_conflict_resolver.py465✅ Implemented (SEC-077)
Policy Enforcementcedar_enforcement_service.py321✅ Implemented
Policy Compilercedar_enforcement_service.py321✅ Implemented

Total Backend Code: 2,085 lines of enterprise-grade governance logic


Next Steps

SDK Integration

Learn how to integrate verified governance features into your agents.

Security Overview

Complete security architecture with verified implementations.

Get Help