diff --git "a/app.py" "b/app.py"
--- "a/app.py"
+++ "b/app.py"
@@ -1,1950 +1,462 @@
"""
š ARF Ultimate Investor Demo v3.8.0 - ENTERPRISE EDITION
-With Audit Trail, Incident History, Memory Graph, and Enterprise Features
-FIXED VERSION - No Plot Errors
+Main entry point - Complex, comprehensive demo using actual OSS components
"""
import logging
-import datetime
-import random
-import uuid
-import json
-import tempfile
-from typing import Dict, List, Optional, Any, Tuple
-from collections import deque
-import gradio as gr
-import plotly.graph_objects as go
-import pandas as pd
-import numpy as np
-from plotly.subplots import make_subplots
+import sys
+import traceback
+from pathlib import Path
-# Import ARF OSS if available
-try:
- from agentic_reliability_framework.arf_core.models.healing_intent import (
- HealingIntent,
- create_scale_out_intent
- )
- from agentic_reliability_framework.arf_core.engine.simple_mcp_client import OSSMCPClient
- ARF_OSS_AVAILABLE = True
-except ImportError:
- ARF_OSS_AVAILABLE = False
- # Mock classes for demo
- class HealingIntent:
- def __init__(self, **kwargs):
- self.intent_type = kwargs.get("intent_type", "scale_out")
- self.parameters = kwargs.get("parameters", {})
-
- def to_dict(self) -> Dict[str, Any]:
- return {
- "intent_type": self.intent_type,
- "parameters": self.parameters,
- "created_at": datetime.datetime.now().isoformat()
- }
-
- def create_scale_out_intent(resource_type: str, scale_factor: float = 2.0) -> HealingIntent:
- return HealingIntent(
- intent_type="scale_out",
- parameters={
- "resource_type": resource_type,
- "scale_factor": scale_factor,
- "action": "Increase capacity"
- }
- )
-
- class OSSMCPClient:
- def analyze_incident(self, metrics: Dict, pattern: str = "") -> Dict[str, Any]:
- return {
- "status": "analysis_complete",
- "recommendations": [
- "Increase resource allocation",
- "Implement monitoring",
- "Add circuit breakers",
- "Optimize configuration"
- ],
- "confidence": 0.92
- }
+# Add parent directory to path for OSS imports
+sys.path.insert(0, str(Path(__file__).parent.parent))
-# Configure logging
-logging.basicConfig(level=logging.INFO)
+# Configure logging first
+logging.basicConfig(
+ level=logging.INFO,
+ format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
+ handlers=[
+ logging.StreamHandler(),
+ logging.FileHandler('arf_demo.log')
+ ]
+)
logger = logging.getLogger(__name__)
-# ===========================================
-# COMPREHENSIVE DATA
-# ===========================================
-
-INCIDENT_SCENARIOS = {
- "Cache Miss Storm": {
- "description": "Redis cluster experiencing 80% cache miss rate causing database overload",
- "severity": "CRITICAL",
- "metrics": {
- "Cache Hit Rate": "18.5% (Critical)",
- "Database Load": "92% (Overloaded)",
- "Response Time": "1850ms (Slow)",
- "Affected Users": "45,000",
- "Eviction Rate": "125/sec"
- },
- "impact": {
- "Revenue Loss": "$8,500/hour",
- "Page Load Time": "+300%",
- "Users Impacted": "45,000",
- "SLA Violation": "Yes",
- "Customer Sat": "-40%"
- },
- "oss_analysis": {
- "status": "ā
ARF OSS Analysis Complete",
- "recommendations": [
- "Increase Redis cache memory allocation",
- "Implement cache warming strategy",
- "Optimize key patterns (TTL adjustments)",
- "Add circuit breaker for database fallback",
- "Deploy monitoring for cache hit rate trends"
- ],
- "estimated_time": "60+ minutes",
- "engineers_needed": "2-3 SREs + 1 DBA",
- "manual_effort": "High",
- "total_cost": "$8,500",
- "healing_intent": "scale_out_cache"
- },
- "enterprise_results": {
- "actions_completed": [
- "ā
Auto-scaled Redis cluster: 4GB ā 8GB",
- "ā
Deployed intelligent cache warming service",
- "ā
Optimized 12 key patterns with ML recommendations",
- "ā
Implemented circuit breaker with 95% success rate",
- "ā
Validated recovery with automated testing"
- ],
- "metrics_improvement": {
- "Cache Hit Rate": "18.5% ā 72%",
- "Response Time": "1850ms ā 450ms",
- "Database Load": "92% ā 45%",
- "Throughput": "1250 ā 2450 req/sec"
- },
- "business_impact": {
- "Recovery Time": "60 min ā 12 min",
- "Cost Saved": "$7,200",
- "Users Impacted": "45,000 ā 0",
- "Revenue Protected": "$1,700",
- "MTTR Improvement": "80% reduction"
- }
- }
- },
- "Database Connection Pool Exhaustion": {
- "description": "Database connection pool exhausted causing API timeouts and user failures",
- "severity": "HIGH",
- "metrics": {
- "Active Connections": "98/100 (Critical)",
- "API Latency": "2450ms",
- "Error Rate": "15.2%",
- "Queue Depth": "1250",
- "Connection Wait": "45s"
- },
- "impact": {
- "Revenue Loss": "$4,200/hour",
- "Affected Services": "API Gateway, User Service, Payment",
- "SLA Violation": "Yes",
- "Partner Impact": "3 external APIs"
- }
- },
- "Memory Leak in Production": {
- "description": "Java service memory leak causing gradual performance degradation",
- "severity": "HIGH",
- "metrics": {
- "Memory Usage": "96% (Critical)",
- "GC Pause Time": "4500ms",
- "Error Rate": "28.5%",
- "Restart Frequency": "12/hour",
- "Heap Fragmentation": "42%"
- },
- "impact": {
- "Revenue Loss": "$5,500/hour",
- "Session Loss": "8,500 users",
- "Customer Impact": "High",
- "Support Tickets": "+300%"
- }
- },
- "API Rate Limit Exceeded": {
- "description": "Global API rate limit exceeded causing 429 errors for external clients",
- "severity": "MEDIUM",
- "metrics": {
- "429 Error Rate": "42.5%",
- "Successful Requests": "58.3%",
- "API Latency": "120ms",
- "Queue Depth": "1250",
- "Client Satisfaction": "65/100"
- },
- "impact": {
- "Revenue Loss": "$1,800/hour",
- "Affected Partners": "8",
- "Partner SLA Violations": "3",
- "Business Impact": "Medium"
- }
- },
- "Microservice Cascading Failure": {
- "description": "Order service failure causing cascading failures in dependent services",
- "severity": "CRITICAL",
- "metrics": {
- "Order Failure Rate": "68.2%",
- "Circuit Breakers Open": "4",
- "Retry Storm Intensity": "425",
- "Error Propagation": "85%",
- "System Stability": "15/100"
- },
- "impact": {
- "Revenue Loss": "$25,000/hour",
- "Abandoned Carts": "12,500",
- "Affected Users": "75,000",
- "Brand Damage": "High"
- }
- }
-}
-
-# ===========================================
-# AUDIT TRAIL & HISTORY MANAGEMENT
-# ===========================================
-
-class AuditTrailManager:
- """Manage audit trail and execution history"""
-
- def __init__(self) -> None:
- self.execution_history = deque(maxlen=50)
- self.incident_history = deque(maxlen=100)
- self._initialize_sample_data()
-
- def _initialize_sample_data(self) -> None:
- """Initialize with sample historical data"""
- base_time = datetime.datetime.now() - datetime.timedelta(hours=2)
-
- # Sample execution history
- sample_executions = [
- self._create_execution_entry(
- base_time - datetime.timedelta(minutes=90),
- "Cache Miss Storm", 4, 7200, "ā
Executed", "Auto-scaled cache"
- ),
- self._create_execution_entry(
- base_time - datetime.timedelta(minutes=75),
- "Memory Leak", 3, 5200, "ā
Executed", "Fixed memory leak"
- ),
- self._create_execution_entry(
- base_time - datetime.timedelta(minutes=60),
- "API Rate Limit", 4, 2800, "ā
Executed", "Increased rate limits"
- ),
- self._create_execution_entry(
- base_time - datetime.timedelta(minutes=45),
- "DB Connection Pool", 4, 3800, "ā
Executed", "Scaled connection pool"
- ),
- self._create_execution_entry(
- base_time - datetime.timedelta(minutes=30),
- "Cascading Failure", 5, 12500, "ā
Executed", "Isolated services"
- ),
- self._create_execution_entry(
- base_time - datetime.timedelta(minutes=15),
- "Cache Miss Storm", 4, 7200, "ā
Executed", "Optimized cache"
- )
- ]
-
- for execution in sample_executions:
- self.execution_history.append(execution)
-
- # Sample incident history
- services = ["API Gateway", "Database", "Cache", "Auth Service", "Payment Service",
- "Order Service", "User Service", "Session Service"]
-
- for _ in range(25):
- incident_time = base_time - datetime.timedelta(minutes=random.randint(5, 120))
- self.incident_history.append({
- "timestamp": incident_time,
- "time_str": incident_time.strftime("%H:%M"),
- "service": random.choice(services),
- "type": random.choice(list(INCIDENT_SCENARIOS.keys())),
- "severity": random.randint(1, 3),
- "description": f"{random.choice(['High latency', 'Connection failed', 'Memory spike', 'Timeout'])} on {random.choice(services)}",
- "id": str(uuid.uuid4())[:8]
- })
-
- def _create_execution_entry(self, timestamp: datetime.datetime, scenario: str,
- actions: int, savings: int, status: str, details: str) -> Dict[str, Any]:
- """Create an execution history entry"""
- return {
- "timestamp": timestamp,
- "time_str": timestamp.strftime("%H:%M"),
- "scenario": scenario,
- "actions": str(actions),
- "savings": f"${savings:,}",
- "status": status,
- "details": details,
- "id": str(uuid.uuid4())[:8]
- }
-
- def add_execution(self, scenario: str, actions: List[str],
- savings: int, approval_required: bool, details: str = "") -> Dict[str, Any]:
- """Add new execution to history"""
- entry = self._create_execution_entry(
- datetime.datetime.now(),
- scenario,
- len(actions),
- savings,
- "ā
Approved & Executed" if approval_required else "ā
Auto-Executed",
- details
- )
- self.execution_history.appendleft(entry) # Newest first
- return entry
-
- def add_incident(self, scenario_name: str, metrics: Dict) -> Dict[str, Any]:
- """Add incident to history"""
- severity = 2 if "MEDIUM" in INCIDENT_SCENARIOS.get(scenario_name, {}).get("severity", "") else 3
- entry = {
- "timestamp": datetime.datetime.now(),
- "time_str": datetime.datetime.now().strftime("%H:%M"),
- "service": "Demo System",
- "type": scenario_name,
- "severity": severity,
- "description": f"Demo incident: {scenario_name}",
- "id": str(uuid.uuid4())[:8]
- }
- self.incident_history.appendleft(entry)
- return entry
-
- def get_execution_history_table(self, limit: int = 10) -> List[List[str]]:
- """Get execution history for table display"""
- return [
- [entry["time_str"], entry["scenario"], entry["actions"],
- entry["status"], entry["savings"], entry["details"]]
- for entry in list(self.execution_history)[:limit]
- ]
-
- def get_incident_history_table(self, limit: int = 15) -> List[List[str]]:
- """Get incident history for table display"""
- return [
- [entry["time_str"], entry["service"], entry["type"],
- f"{entry['severity']}/3", entry["description"]]
- for entry in list(self.incident_history)[:limit]
- ]
-
- def clear_history(self) -> Tuple[List[List[str]], List[List[str]]]:
- """Clear all history"""
- self.execution_history.clear()
- self.incident_history.clear()
- self._initialize_sample_data() # Restore sample data
- return self.get_execution_history_table(), self.get_incident_history_table()
-
- def export_audit_trail(self) -> str:
- """Export audit trail as JSON"""
- total_savings = 0
- for e in self.execution_history:
- if "$" in e["savings"]:
- try:
- total_savings += int(e["savings"].replace("$", "").replace(",", ""))
- except ValueError:
- continue
-
- return json.dumps({
- "executions": list(self.execution_history),
- "incidents": list(self.incident_history),
- "exported_at": datetime.datetime.now().isoformat(),
- "total_executions": len(self.execution_history),
- "total_incidents": len(self.incident_history),
- "total_savings": total_savings
- }, indent=2, default=str)
-
-# ===========================================
-# ENHANCED VISUALIZATION ENGINE (FIXED)
-# ===========================================
-
-class EnhancedVisualizationEngine:
- """Enhanced visualization engine with memory graph support"""
-
- @staticmethod
- def create_incident_timeline() -> go.Figure:
- """Create interactive incident timeline"""
- fig = go.Figure()
-
- # Create timeline events
- now = datetime.datetime.now()
- events = [
- {"time": now - datetime.timedelta(minutes=25), "event": "š Cache hit rate drops to 18.5%", "type": "problem"},
- {"time": now - datetime.timedelta(minutes=22), "event": "ā ļø Alert: Database load hits 92%", "type": "alert"},
- {"time": now - datetime.timedelta(minutes=20), "event": "š¤ ARF detects pattern", "type": "detection"},
- {"time": now - datetime.timedelta(minutes=18), "event": "š§ Analysis: Cache Miss Storm identified", "type": "analysis"},
- {"time": now - datetime.timedelta(minutes=15), "event": "ā” Healing actions executed", "type": "action"},
- {"time": now - datetime.timedelta(minutes=12), "event": "ā
Cache hit rate recovers to 72%", "type": "recovery"},
- {"time": now - datetime.timedelta(minutes=10), "event": "š System stabilized", "type": "stable"}
- ]
-
- color_map = {
- "problem": "red", "alert": "orange", "detection": "blue",
- "analysis": "purple", "action": "green", "recovery": "lightgreen",
- "stable": "darkgreen"
- }
-
- symbol_map = {
- "problem": "circle", "alert": "circle", "detection": "diamond",
- "analysis": "diamond", "action": "square", "recovery": "star",
- "stable": "cross"
- }
-
- # Convert datetime objects to strings for Plotly
- times = [event["time"] for event in events]
- events_text = [event["event"] for event in events]
- event_types = [event["type"] for event in events]
- colors = [color_map[event_type] for event_type in event_types]
- symbols = [symbol_map[event_type] for event_type in event_types]
-
- fig.add_trace(go.Scatter(
- x=times,
- y=[1] * len(events), # Fixed y-position
- mode='markers+text',
- marker=dict(
- size=20,
- color=colors,
- symbol=symbols,
- line=dict(width=2, color='white')
- ),
- text=events_text,
- textposition="top center",
- hoverinfo="text",
- hovertemplate="%{text}
%{x|%H:%M:%S}
Savings: %{text}
Severity: {node.get('severity', 'N/A')}" for node in nodes],
- hoverinfo="text",
- name="Nodes"
- ))
-
- # Add edges if we have them
- if edges:
- for edge in edges:
- try:
- source_idx = int(edge["source"].split("_")[1])
- target_idx = int(edge["target"].split("_")[1])
-
- if source_idx < num_nodes and target_idx < num_nodes:
- fig.add_trace(go.Scatter(
- x=[node_x[source_idx], node_x[target_idx], None],
- y=[node_y[source_idx], node_y[target_idx], None],
- mode='lines',
- line=dict(
- width=2 * edge.get("weight", 1.0),
- color='rgba(100, 100, 100, 0.5)'
- ),
- hoverinfo='none',
- showlegend=False
- ))
- except (ValueError, IndexError):
- continue
-
- fig.update_layout(
- title=f"Incident Memory Graph ({len(nodes)} nodes)",
- showlegend=False,
- height=600,
- paper_bgcolor='white',
- plot_bgcolor='white',
- hovermode='closest',
- xaxis=dict(
- showgrid=False,
- zeroline=False,
- showticklabels=False,
- range=[-1.5, 1.5]
- ),
- yaxis=dict(
- showgrid=False,
- zeroline=False,
- showticklabels=False,
- range=[-1.5, 1.5]
- ),
- margin=dict(l=50, r=50, t=80, b=50)
- )
-
- return fig
-
- @staticmethod
- def create_pattern_analysis_chart(analysis_data: Dict[str, Any]) -> go.Figure:
- """Create pattern analysis visualization"""
- fig = make_subplots(
- rows=2, cols=2,
- subplot_titles=('Incident Frequency', 'Resolution Times',
- 'Success Rates', 'Pattern Correlation'),
- vertical_spacing=0.15,
- horizontal_spacing=0.15
- )
-
- # Sample data - in real app this would come from analysis
- patterns = ['Cache Issues', 'DB Connections', 'Memory Leaks', 'API Limits', 'Cascading']
- frequencies = [12, 8, 5, 7, 3]
- resolution_times = [8.2, 15.5, 45.2, 5.1, 32.8]
- success_rates = [92, 85, 78, 96, 65]
-
- # Incident Frequency
- fig.add_trace(
- go.Bar(
- x=patterns,
- y=frequencies,
- name='Frequency',
- marker_color='#4ECDC4'
- ),
- row=1, col=1
- )
-
- # Resolution Times
- fig.add_trace(
- go.Bar(
- x=patterns,
- y=resolution_times,
- name='Resolution Time (min)',
- marker_color='#45B7D1'
- ),
- row=1, col=2
- )
-
- # Success Rates
- fig.add_trace(
- go.Bar(
- x=patterns,
- y=success_rates,
- name='Success Rate %',
- marker_color='#96CEB4'
- ),
- row=2, col=1
- )
-
- # Correlation Matrix
- corr_matrix = np.array([
- [1.0, 0.3, 0.1, 0.2, 0.05],
- [0.3, 1.0, 0.4, 0.1, 0.25],
- [0.1, 0.4, 1.0, 0.05, 0.6],
- [0.2, 0.1, 0.05, 1.0, 0.1],
- [0.05, 0.25, 0.6, 0.1, 1.0]
- ])
-
- fig.add_trace(
- go.Heatmap(
- z=corr_matrix,
- x=patterns,
- y=patterns,
- colorscale='Blues',
- showscale=True
- ),
- row=2, col=2
- )
-
- fig.update_layout(
- height=700,
- showlegend=False,
- title_text="Pattern Analysis Dashboard",
- paper_bgcolor='white',
- plot_bgcolor='white'
- )
-
- # Update axes
- fig.update_xaxes(title_text="Pattern Type", row=1, col=1)
- fig.update_yaxes(title_text="Frequency", row=1, col=1)
- fig.update_xaxes(title_text="Pattern Type", row=1, col=2)
- fig.update_yaxes(title_text="Time (minutes)", row=1, col=2)
- fig.update_xaxes(title_text="Pattern Type", row=2, col=1)
- fig.update_yaxes(title_text="Success Rate (%)", row=2, col=1)
-
- return fig
-
-# ===========================================
-# ENHANCED BUSINESS LOGIC
-# ===========================================
+
+ def mark_as_oss_advisory(self):
+ return self
+
+ class OSSMCPClient:
+ def __init__(self):
+ self.mode = "advisory"
+
+ async def analyze_and_recommend(self, tool_name, component, parameters, context=None):
+ return HealingIntent(
+ action=tool_name,
+ component=component,
+ parameters=parameters,
+ justification=f"OSS Analysis: {tool_name} recommended for {component}",
+ confidence=0.85,
+ similar_incidents=[
+ {"id": "inc_001", "similarity": 0.78, "resolution": "scaled_out"},
+ {"id": "inc_045", "similarity": 0.65, "resolution": "restarted"}
+ ],
+ rag_similarity_score=0.72
+ )
+
+ class MCPServer:
+ def __init__(self, mode="advisory"):
+ self.mode = mode
+
+ async def execute_tool(self, request_dict):
+ return {
+ 'status': 'advisory_completed',
+ 'message': 'Mock OSS analysis complete',
+ 'executed': False,
+ 'requires_enterprise': True
+ }
+
+ MCPMode = type('MCPMode', (), {'ADVISORY': 'advisory', 'APPROVAL': 'approval', 'AUTONOMOUS': 'autonomous'})
-class EnhancedBusinessLogic:
- """Enhanced business logic with enterprise features"""
-
- def __init__(self, audit_manager: AuditTrailManager):
- self.audit_manager = audit_manager
- self.viz_engine = EnhancedVisualizationEngine()
- self.license_info = {
- "valid": True,
- "customer_name": "Demo Enterprise Corp",
- "customer_email": "demo@enterprise.com",
- "tier": "ENTERPRISE",
- "expires_at": "2024-12-31T23:59:59",
- "features": ["autonomous_healing", "compliance", "audit_trail", "multi_cloud"],
- "max_services": 100,
- "max_incidents_per_month": 1000,
- "status": "ā
Active"
- }
- self.mcp_mode = "approval"
- self.learning_stats = {
- "total_incidents": 127,
- "resolved_automatically": 89,
- "average_resolution_time": "8.2 min",
- "success_rate": "92.1%",
- "patterns_detected": 24,
- "confidence_threshold": 0.85,
- "memory_size": "4.7 MB",
- "embeddings": 127,
- "graph_nodes": 89,
- "graph_edges": 245
- }
-
- def run_oss_analysis(self, scenario_name: str) -> Dict[str, Any]:
- """Run OSS analysis"""
- scenario = INCIDENT_SCENARIOS.get(scenario_name, {})
- analysis = scenario.get("oss_analysis", {})
-
- if not analysis:
- analysis = {
- "status": "ā
Analysis Complete",
- "recommendations": [
- "Increase resource allocation",
- "Implement monitoring",
- "Add circuit breakers",
- "Optimize configuration"
- ],
- "estimated_time": "45-60 minutes",
- "engineers_needed": "2-3",
- "manual_effort": "Required",
- "total_cost": "$3,000 - $8,000"
+ # Import Gradio
+ import gradio as gr
+ import plotly.graph_objects as go
+
+ def create_demo_interface():
+ """Create the comprehensive demo interface"""
+ logger.info("Initializing ARF Demo Interface...")
+
+ # Initialize components
+ audit_manager = AuditTrailManager()
+ oss_integration = OSSIntegrationManager(
+ oss_available=ARF_OSS_AVAILABLE,
+ oss_version=OSS_VERSION
+ )
+ business_logic = EnhancedBusinessLogic(
+ audit_manager=audit_manager,
+ oss_integration=oss_integration
+ )
+ roi_calculator = ROICalculator()
+ viz_engine = EnhancedVisualizationEngine()
+
+ # Create Gradio interface
+ with gr.Blocks(
+ title=f"š ARF Investor Demo v3.8.0",
+ theme=gr.themes.Soft(
+ primary_hue="blue",
+ secondary_hue="teal",
+ font=[gr.themes.GoogleFont("Inter"), "Arial", "sans-serif"]
+ ),
+ css="""
+ .gradio-container {
+ max-width: 1800px !important;
+ margin: auto !important;
+ font-family: 'Inter', sans-serif !important;
}
-
- # Add ARF context
- analysis["arf_context"] = {
- "oss_available": ARF_OSS_AVAILABLE,
- "version": "3.3.6",
- "mode": "advisory_only",
- "healing_intent": True
- }
-
- # Add to incident history
- self.audit_manager.add_incident(scenario_name, scenario.get("metrics", {}))
-
- return analysis
-
- def execute_enterprise_healing(self, scenario_name: str, approval_required: bool) -> Tuple[Any, ...]:
- """Execute enterprise healing"""
- scenario = INCIDENT_SCENARIOS.get(scenario_name, {})
- results = scenario.get("enterprise_results", {})
-
- # Use default results if not available
- if not results:
- results = {
- "actions_completed": [
- "ā
Auto-scaled resources based on ARF healing intent",
- "ā
Implemented optimization recommendations",
- "ā
Deployed monitoring and alerting",
- "ā
Validated recovery with automated testing"
- ],
- "metrics_improvement": {
- "Performance": "Dramatically improved",
- "Stability": "Restored",
- "Recovery": "Complete"
- },
- "business_impact": {
- "Recovery Time": f"60 min ā {random.randint(5, 15)} min",
- "Cost Saved": f"${random.randint(2000, 10000):,}",
- "Users Impacted": "45,000 ā 0",
- "Revenue Protected": f"${random.randint(1000, 5000):,}"
- }
+ h1 {
+ background: linear-gradient(90deg, #1a365d 0%, #2d3748 100%);
+ -webkit-background-clip: text;
+ -webkit-text-fill-color: transparent;
+ background-clip: text;
+ font-weight: 800 !important;
+ font-size: 2.5rem !important;
+ margin-bottom: 0.5rem !important;
+ }
+ .critical {
+ color: #FF6B6B !important;
+ font-weight: 900 !important;
+ text-shadow: 0 1px 2px rgba(0,0,0,0.1);
+ }
+ .success {
+ color: #4ECDC4 !important;
+ font-weight: 900 !important;
+ }
+ .plot-container {
+ background: white !important;
+ border-radius: 12px !important;
+ padding: 20px !important;
+ box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
+ border: 1px solid #e2e8f0 !important;
+ }
+ .tab-nav {
+ background: linear-gradient(90deg, #f8fafc 0%, #ffffff 100%) !important;
+ border-radius: 10px !important;
+ padding: 5px !important;
+ margin-bottom: 20px !important;
+ }
+ .metric-card {
+ background: white !important;
+ border-radius: 10px !important;
+ padding: 20px !important;
+ box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
+ border-left: 4px solid #4ECDC4 !important;
+ margin-bottom: 15px !important;
+ }
+ .enterprise-badge {
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
+ color: white !important;
+ padding: 8px 16px !important;
+ border-radius: 20px !important;
+ font-weight: 700 !important;
+ font-size: 0.85rem !important;
+ display: inline-block !important;
+ margin: 5px 0 !important;
+ }
+ .oss-badge {
+ background: linear-gradient(135deg, #4299e1 0%, #38b2ac 100%) !important;
+ color: white !important;
+ padding: 8px 16px !important;
+ border-radius: 20px !important;
+ font-weight: 700 !important;
+ font-size: 0.85rem !important;
+ display: inline-block !important;
+ margin: 5px 0 !important;
}
-
- # Calculate savings
- savings = 0
- if "Cost Saved" in results["business_impact"]:
- try:
- savings_str = results["business_impact"]["Cost Saved"]
- savings = int(''.join(filter(str.isdigit, savings_str)))
- except (ValueError, TypeError):
- savings = random.randint(2000, 10000)
-
- # Update status
- if approval_required:
- results["status"] = "ā
Approved and Executed"
- approval_html = self._create_approval_html(scenario_name, True)
- else:
- results["status"] = "ā
Auto-Executed"
- approval_html = self._create_approval_html(scenario_name, False)
-
- # Add to audit trail
- details = f"{len(results['actions_completed'])} actions executed"
- self.audit_manager.add_execution(
- scenario_name,
- results["actions_completed"],
- savings,
- approval_required,
- details
- )
-
- # Add enterprise context
- results["enterprise_context"] = {
- "approval_required": approval_required,
- "compliance_mode": "strict",
- "audit_trail": "created",
- "learning_applied": True,
- "roi_measured": True
- }
-
- # Update visualizations
- execution_chart = self.viz_engine.create_execution_history_chart(self.audit_manager)
-
- return (
- approval_html,
- {"approval_required": approval_required, "compliance_mode": "strict"},
- results,
- execution_chart,
- self.audit_manager.get_execution_history_table(),
- self.audit_manager.get_incident_history_table()
- )
-
- def _create_approval_html(self, scenario_name: str, approval_required: bool) -> str:
- """Create approval workflow HTML"""
- if approval_required:
- return f"""
-
Action: Scale resources for {scenario_name}
-Risk Level: Low (auto-rollback available)
-Blast Radius: Limited to affected service
-Status: ā Approved & Executed
-Action: Autonomous healing for {scenario_name}
-Mode: Fully autonomous (safety guardrails active)
-Guardrails: Blast radius limits, rollback ready, compliance logging
-Status: ā Successfully completed
+ ) as demo: + + # ============ COMPLEX HEADER ============ + gr.Markdown(f""" +Ā© 2024 Agentic Reliability Framework. Demo v3.8.0 Enterprise Edition.
+This is a demonstration of capabilities. Actual results may vary based on implementation.
+