""" 🚀 ARF Ultimate Investor Demo v3.8.0 - ENTERPRISE EDITION UPDATED: Scenario-integrated ROI Calculator + MCP Mode explanations """ import logging import sys import traceback import json import datetime import asyncio import time import numpy as np from pathlib import Path from typing import Dict, List, Any, Optional, Tuple # Configure logging logging.basicConfig( level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', handlers=[ logging.StreamHandler(sys.stdout), logging.FileHandler('arf_demo.log') ] ) logger = logging.getLogger(__name__) # Add parent directory to path sys.path.insert(0, str(Path(__file__).parent)) # Import Plotly try: import plotly.graph_objects as go import plotly.express as px from plotly.subplots import make_subplots PLOTLY_AVAILABLE = True except ImportError: PLOTLY_AVAILABLE = False # =========================================== # ENHANCED SCENARIOS WITH ROI CALCULATION DATA # =========================================== ENHANCED_SCENARIOS = { "Cache Miss Storm": { "description": "Redis cluster experiencing 80% cache miss rate causing database overload", "severity": "CRITICAL", "component": "redis_cache", "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%" }, # ROI CALCULATION DATA (Extracted for calculator) "roi_data": { "hourly_revenue_loss": 8500, "manual_recovery_hours": 1.0, # 60 minutes "enterprise_recovery_hours": 0.2, # 12 minutes "engineers_required": 4, # 2-3 SREs + 1 DBA "engineer_hourly_rate": 150, # $150/hour "estimated_monthly_occurrences": 2, # Happens twice monthly on average "enterprise_savings_percentage": 0.85 # 85% savings with Enterprise }, # OSS RESULTS - ADVISORY ONLY "oss_results": { "status": "✅ OSS Analysis Complete", "confidence": 0.87, "similar_incidents": 3, "rag_similarity_score": 0.72, "recommendations": [ "Scale Redis cache memory from 4GB → 8GB", "Implement cache warming strategy", "Optimize key patterns with TTL adjustments", "Add circuit breaker for database fallback" ], "estimated_time": "60+ minutes manually", "engineers_needed": "2-3 SREs + 1 DBA", "advisory_only": True, "healing_intent": { "action": "scale_out", "component": "redis_cache", "parameters": {"scale_factor": 2.0}, "confidence": 0.87, "requires_enterprise": True } }, # ENTERPRISE RESULTS - ACTUAL EXECUTION "enterprise_results": { "execution_mode": "Autonomous", "actions_executed": [ "✅ 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" ], "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": "PostgreSQL connection pool exhausted causing API timeouts", "severity": "HIGH", "component": "postgresql_database", "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" }, "roi_data": { "hourly_revenue_loss": 4200, "manual_recovery_hours": 0.75, # 45 minutes "enterprise_recovery_hours": 0.13, # 8 minutes "engineers_required": 2, # 1 DBA + 1 Backend Engineer "engineer_hourly_rate": 150, "estimated_monthly_occurrences": 3, "enterprise_savings_percentage": 0.82 }, "oss_results": { "status": "✅ OSS Analysis Complete", "confidence": 0.82, "similar_incidents": 2, "rag_similarity_score": 0.65, "recommendations": [ "Increase connection pool size from 100 → 200", "Implement connection pooling monitoring", "Add query timeout enforcement", "Deploy read replica for read-heavy queries" ], "estimated_time": "45+ minutes manually", "engineers_needed": "1 DBA + 1 Backend Engineer", "advisory_only": True }, "enterprise_results": { "execution_mode": "Approval Required", "actions_executed": [ "✅ Increased connection pool: 100 → 200 connections", "✅ Deployed real-time connection monitoring", "✅ Implemented query timeout: 30s → 10s", "✅ Automated read replica traffic routing" ], "metrics_improvement": { "API Latency": "2450ms → 320ms", "Error Rate": "15.2% → 0.8%", "Connection Wait": "45s → 120ms", "Throughput": "850 → 2100 req/sec" }, "business_impact": { "Recovery Time": "45 min → 8 min", "Cost Saved": "$3,150", "Failed Transactions": "12,500 → 0", "SLA Compliance": "Restored to 99.9%" } } }, "Kubernetes Memory Leak": { "description": "Java microservice memory leak causing pod restarts", "severity": "HIGH", "component": "java_payment_service", "metrics": { "Memory Usage": "96% (Critical)", "GC Pause Time": "4500ms", "Error Rate": "28.5%", "Pod Restarts": "12/hour", "Heap Fragmentation": "42%" }, "impact": { "Revenue Loss": "$5,500/hour", "Session Loss": "8,500 users", "Payment Failures": "3.2% of transactions", "Support Tickets": "+300%" }, "roi_data": { "hourly_revenue_loss": 5500, "manual_recovery_hours": 1.5, # 90 minutes "enterprise_recovery_hours": 0.25, # 15 minutes "engineers_required": 3, # 2 Java Devs + 1 SRE "engineer_hourly_rate": 150, "estimated_monthly_occurrences": 1, "enterprise_savings_percentage": 0.79 }, "oss_results": { "status": "✅ OSS Analysis Complete", "confidence": 0.79, "similar_incidents": 4, "rag_similarity_score": 0.68, "recommendations": [ "Increase pod memory limits from 2GB → 4GB", "Implement memory leak detection", "Deploy canary with fixed version", "Add circuit breaker for graceful degradation" ], "estimated_time": "90+ minutes manually", "engineers_needed": "2 Java Devs + 1 SRE", "advisory_only": True }, "enterprise_results": { "execution_mode": "Autonomous with Rollback", "actions_executed": [ "✅ Scaled pod memory: 2GB → 4GB with monitoring", "✅ Deployed memory leak detection service", "✅ Rolled out canary with memory fixes", "✅ Implemented auto-rollback on failure" ], "metrics_improvement": { "Memory Usage": "96% → 68%", "GC Pause Time": "4500ms → 320ms", "Error Rate": "28.5% → 1.2%", "Pod Stability": "12/hour → 0 restarts" }, "business_impact": { "Recovery Time": "90 min → 15 min", "Cost Saved": "$4,950", "Transaction Success": "96.8% → 99.9%", "User Impact": "8,500 → 0 affected" } } }, "API Rate Limit Storm": { "description": "Third-party API rate limiting causing cascading failures", "severity": "MEDIUM", "component": "external_api_gateway", "metrics": { "Rate Limit Hits": "95% of requests", "Error Rate": "42.8%", "Retry Storm": "Active", "Cascade Effect": "3 dependent services", "Queue Backlog": "8,500 requests" }, "impact": { "Revenue Loss": "$3,800/hour", "Partner SLA Breach": "Yes", "Data Sync Delay": "4+ hours", "Customer Reports": "Delayed by 6 hours" }, "roi_data": { "hourly_revenue_loss": 3800, "manual_recovery_hours": 1.25, # 75 minutes "enterprise_recovery_hours": 0.17, # 10 minutes "engineers_required": 3, # 2 Backend Engineers + 1 DevOps "engineer_hourly_rate": 150, "estimated_monthly_occurrences": 4, "enterprise_savings_percentage": 0.85 }, "oss_results": { "status": "✅ OSS Analysis Complete", "confidence": 0.85, "similar_incidents": 3, "rag_similarity_score": 0.71, "recommendations": [ "Implement exponential backoff with jitter", "Deploy circuit breaker pattern", "Add request queuing with prioritization", "Implement adaptive rate limiting" ], "estimated_time": "75+ minutes manually", "engineers_needed": "2 Backend Engineers + 1 DevOps", "advisory_only": True }, "enterprise_results": { "execution_mode": "Autonomous", "actions_executed": [ "✅ Implemented exponential backoff: 1s → 32s with jitter", "✅ Deployed circuit breaker with 80% success threshold", "✅ Added intelligent request queuing", "✅ Enabled adaptive rate limiting based on API health" ], "metrics_improvement": { "Rate Limit Hits": "95% → 12%", "Error Rate": "42.8% → 3.5%", "Successful Retries": "18% → 89%", "Queue Processing": "8,500 → 0 backlog" }, "business_impact": { "Recovery Time": "75 min → 10 min", "Cost Saved": "$3,420", "SLA Compliance": "Restored within 5 minutes", "Data Freshness": "4+ hours → <5 minute delay" } } } } # =========================================== # MCP MODE EXPLANATIONS # =========================================== MCP_MODE_DESCRIPTIONS = { "advisory": { "name": "Advisory Mode", "icon": "📋", "description": "OSS Edition - Analysis only, no execution", "purpose": "Analyzes incidents and provides recommendations. Perfect for teams starting with AI reliability.", "features": [ "✅ Incident detection & analysis", "✅ RAG similarity search", "✅ HealingIntent creation", "❌ No action execution", "❌ Manual implementation required" ], "use_case": "Compliance-heavy environments, initial AI adoption phases" }, "approval": { "name": "Approval Mode", "icon": "🔐", "description": "Enterprise - Executes after human approval", "purpose": "Balances automation with human oversight. Actions require explicit approval before execution.", "features": [ "✅ All OSS advisory features", "✅ Action execution capability", "✅ Human-in-the-loop approval", "✅ Audit trail & compliance", "✅ Rollback capabilities" ], "use_case": "Regulated industries, critical production systems" }, "autonomous": { "name": "Autonomous Mode", "icon": "⚡", "description": "Enterprise - Fully autonomous execution", "purpose": "Maximum efficiency with AI-driven autonomous healing. Self-corrects based on learned patterns.", "features": [ "✅ All approval mode features", "✅ Fully autonomous execution", "✅ Machine learning optimization", "✅ Predictive incident prevention", "✅ Continuous learning loop" ], "use_case": "High-scale systems, mature reliability teams, 24/7 operations" } } # =========================================== # ROI CALCULATOR ENGINE # =========================================== class ROI_Calculator: """Calculates ROI based on scenario data and user inputs""" @staticmethod def calculate_scenario_roi(scenario_name, monthly_incidents, team_size): """Calculate ROI for a specific scenario""" scenario = ENHANCED_SCENARIOS.get(scenario_name, {}) roi_data = scenario.get("roi_data", {}) if not roi_data: return {"error": "No ROI data for this scenario"} # Extract data hourly_loss = roi_data.get("hourly_revenue_loss", 0) manual_hours = roi_data.get("manual_recovery_hours", 1) enterprise_hours = roi_data.get("enterprise_recovery_hours", 0.2) monthly_occurrences = roi_data.get("estimated_monthly_occurrences", 2) savings_pct = roi_data.get("enterprise_savings_percentage", 0.85) # Calculate costs monthly_manual_cost = hourly_loss * manual_hours * monthly_occurrences monthly_enterprise_cost = hourly_loss * enterprise_hours * monthly_occurrences monthly_savings = monthly_manual_cost - monthly_enterprise_cost # Annual calculations annual_manual_cost = monthly_manual_cost * 12 annual_enterprise_cost = monthly_enterprise_cost * 12 annual_savings = monthly_savings * 12 # Team costs engineer_hourly = roi_data.get("engineer_hourly_rate", 150) engineers_needed = roi_data.get("engineers_required", 2) team_hourly_cost = engineers_needed * engineer_hourly manual_team_cost = team_hourly_cost * manual_hours * monthly_occurrences * 12 # Enterprise subscription (simplified) enterprise_monthly_cost = 499 # Base subscription enterprise_usage_cost = monthly_enterprise_cost * 0.10 # $0.10 per incident # ROI calculation total_enterprise_cost = (enterprise_monthly_cost * 12) + (enterprise_usage_cost * 12) roi_multiplier = annual_savings / total_enterprise_cost if total_enterprise_cost > 0 else 0 payback_months = total_enterprise_cost / (annual_savings / 12) if annual_savings > 0 else 0 return { "scenario": scenario_name, "monthly_manual_cost": f"${monthly_manual_cost:,.0f}", "monthly_enterprise_cost": f"${monthly_enterprise_cost:,.0f}", "monthly_savings": f"${monthly_savings:,.0f}", "annual_manual_cost": f"${annual_manual_cost:,.0f}", "annual_enterprise_cost": f"${annual_enterprise_cost:,.0f}", "annual_savings": f"${annual_savings:,.0f}", "enterprise_subscription": f"${enterprise_monthly_cost:,.0f}/month", "roi_multiplier": f"{roi_multiplier:.1f}×", "payback_months": f"{payback_months:.1f} months", "manual_recovery_time": f"{manual_hours*60:.0f} minutes", "enterprise_recovery_time": f"{enterprise_hours*60:.0f} minutes", "recovery_improvement": f"{(1 - enterprise_hours/manual_hours)*100:.0f}% faster" } @staticmethod def create_comparison_chart(scenario_name): """Create ROI comparison chart""" if not PLOTLY_AVAILABLE: return None scenario = ENHANCED_SCENARIOS.get(scenario_name, {}) roi_data = scenario.get("roi_data", {}) fig = go.Figure() # Manual vs Enterprise cost comparison manual_cost = roi_data.get("hourly_revenue_loss", 0) * roi_data.get("manual_recovery_hours", 1) enterprise_cost = roi_data.get("hourly_revenue_loss", 0) * roi_data.get("enterprise_recovery_hours", 0.2) fig.add_trace(go.Bar( x=['Manual Resolution', 'ARF Enterprise'], y=[manual_cost, enterprise_cost], name='Cost per Incident', marker_color=['#FF6B6B', '#4ECDC4'], text=[f'${manual_cost:,.0f}', f'${enterprise_cost:,.0f}'], textposition='auto' )) fig.update_layout( title=f"Cost Comparison: {scenario_name}", yaxis_title="Cost ($)", showlegend=False, height=300 ) return fig # =========================================== # CREATE DEMO INTERFACE WITH ENHANCEMENTS # =========================================== def create_demo_interface(): """Create demo with scenario-integrated ROI calculator and MCP explanations""" import gradio as gr # Initialize roi_calculator = ROI_Calculator() # Custom CSS for enhancements custom_css = """ .mcp-mode-card { background: white !important; border-radius: 10px !important; padding: 20px !important; margin-bottom: 15px !important; border-left: 4px solid #4ECDC4 !important; box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important; } .mcp-advisory { border-left-color: #2196f3 !important; } .mcp-approval { border-left-color: #ff9800 !important; } .mcp-autonomous { border-left-color: #4caf50 !important; } .roi-highlight { background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%) !important; padding: 15px !important; border-radius: 8px !important; border-left: 4px solid #4caf50 !important; margin: 10px 0 !important; } """ with gr.Blocks(title="🚀 ARF Investor Demo v3.8.0", css=custom_css) as demo: # Header gr.Markdown("""

🚀 Agentic Reliability Framework

Investor Demo v3.8.0

🏢 Enterprise Edition
🆓 OSS v3.3.6
📈 5.2× ROI
⚡ 85% MTTR Reduction
From OSS Advisory to Enterprise Autonomous Healing. New: Scenario-integrated ROI Calculator
⚠️ Mock Mode (Enhanced ROI Calculator)
""") # Status Bar gr.Markdown("""
System Status
Operational
Active Scenario
Cache Miss Storm
MCP Mode
Advisory (OSS)
""") # Tabs with gr.Tabs(): # TAB 1: Live Incident Demo with gr.TabItem("🔥 Live Incident Demo"): with gr.Row(): # Left Panel with gr.Column(scale=1): gr.Markdown("### 🎬 Select Incident Scenario") scenario_dropdown = gr.Dropdown( choices=list(ENHANCED_SCENARIOS.keys()), value="Cache Miss Storm", label="Choose an incident to analyze:", interactive=True ) scenario_description = gr.Markdown() gr.Markdown("### 📊 Current Metrics") metrics_display = gr.JSON(label="") gr.Markdown("### 💰 Business Impact") impact_display = gr.JSON(label="") # Right Panel with gr.Column(scale=2): gr.Markdown("### 📈 Incident Timeline") timeline_output = gr.Plot() gr.Markdown("### ⚡ Take Action") with gr.Row(): oss_btn = gr.Button("🆓 Run OSS Analysis", variant="secondary", size="lg") enterprise_btn = gr.Button("🚀 Execute Enterprise Healing", variant="primary", size="lg") with gr.Row(): approval_toggle = gr.Checkbox(label="🔐 Require Manual Approval", value=True) demo_btn = gr.Button("⚡ Quick Demo", variant="secondary", size="sm") approval_display = gr.HTML( value="
Approval workflow will appear here after execution
" ) gr.Markdown("### 📋 OSS Analysis Results (Advisory Only)") oss_results = gr.JSON(label="") gr.Markdown("### 🎯 Enterprise Execution Results") enterprise_results = gr.JSON(label="") # TAB 2: Business Impact & ROI (ENHANCED) with gr.TabItem("💰 Business Impact & ROI"): with gr.Column(): gr.Markdown("### 📊 Executive Dashboard") dashboard_output = gr.Plot() gr.Markdown("### 🧮 ROI Calculator (Scenario-Integrated)") with gr.Row(): with gr.Column(scale=1): # Scenario selector for ROI roi_scenario_dropdown = gr.Dropdown( choices=list(ENHANCED_SCENARIOS.keys()), value="Cache Miss Storm", label="Select scenario for ROI calculation:", interactive=True ) gr.Markdown("#### 📈 Adjust Parameters") monthly_slider = gr.Slider( 1, 100, value=15, step=1, label="Monthly similar incidents:", info="How often this type of incident occurs", interactive=True ) team_slider = gr.Slider( 1, 20, value=5, step=1, label="Reliability team size:", info="Engineers available for manual resolution", interactive=True ) calculate_roi_btn = gr.Button( "Calculate Scenario ROI", variant="primary", size="lg" ) # Show scenario data being used gr.Markdown("#### 📊 Using Scenario Data:") scenario_data_display = gr.JSON( label="Extracted from selected scenario", value={} ) with gr.Column(scale=2): gr.Markdown("#### 📈 ROI Analysis Results") roi_output = gr.JSON(label="") gr.Markdown("#### 📊 Cost Comparison") roi_chart = gr.Plot(label="") # Highlight key metrics gr.Markdown("""

💰 Key Insight

The ROI calculator now extracts real numbers from your selected incident scenario, showing the actual business impact of ARF Enterprise vs manual resolution.

""") # TAB 4: Enterprise Features (ENHANCED WITH MCP EXPLANATIONS) with gr.TabItem("🏢 Enterprise Features"): with gr.Row(): # Left Column with gr.Column(scale=1): gr.Markdown("### 🔐 License Management") license_display = gr.JSON( value={ "status": "Active", "tier": "Enterprise", "expires": "2024-12-31", "mcp_mode": "advisory" }, label="Current License" ) gr.Markdown("### ⚡ MCP Execution Modes") # MCP Mode Cards with explanations for mode_key, mode_info in MCP_MODE_DESCRIPTIONS.items(): with gr.Column(): gr.Markdown(f"""
{mode_info['icon']}

{mode_info['name']}

{mode_info['description']}
Purpose: {mode_info['purpose']}
Best for: {mode_info['use_case']}
""") # MCP Mode Selector gr.Markdown("### ⚙️ Configure MCP Mode") mcp_mode = gr.Radio( choices=list(MCP_MODE_DESCRIPTIONS.keys()), value="advisory", label="Execution Mode", info="Select the execution mode for demonstration", interactive=True ) mcp_mode_info = gr.JSON( label="Selected Mode Details", value=MCP_MODE_DESCRIPTIONS["advisory"] ) # Right Column with gr.Column(scale=1): gr.Markdown("### 📋 Feature Comparison") features_table = gr.Dataframe( headers=["Feature", "OSS", "Starter", "Enterprise"], value=[ ["Autonomous Healing", "❌", "✅ Auto", "✅ AI-Driven"], ["MCP Modes", "Advisory only", "Advisory + Approval", "All 3 modes"], ["Compliance Automation", "❌", "✅", "✅ SOC2/GDPR"], ["Predictive Analytics", "❌", "Basic", "✅ ML-Powered"], ["Multi-Cloud Support", "❌", "❌", "✅ Native"], ["Audit Trail", "Basic", "✅", "✅ Comprehensive"], ["Role-Based Access", "❌", "✅", "✅ Granular"], ], label="", interactive=False ) gr.Markdown("### 🔗 Integrations") integrations_table = gr.Dataframe( headers=["Platform", "Status", "Last Sync"], value=[ ["AWS", "✅ Connected", "5 min ago"], ["Azure", "✅ Connected", "8 min ago"], ["GCP", "✅ Connected", "3 min ago"], ["Datadog", "✅ Connected", "Active"], ["PagerDuty", "✅ Connected", "Active"], ["ServiceNow", "✅ Connected", "15 min ago"], ], label="", interactive=False ) # Other tabs... with gr.TabItem("📜 Audit Trail & History"): with gr.Row(): with gr.Column(): gr.Markdown("### 📋 Execution History") execution_table = gr.Dataframe( headers=["Time", "Scenario", "Mode", "Status", "Savings", "Details"], value=[], label="" ) with gr.Column(): gr.Markdown("### 📊 Incident History") incident_table = gr.Dataframe( headers=["Time", "Component", "Scenario", "Severity", "Status"], value=[], label="" ) # Footer gr.Markdown("""

🚀 User Journey

  1. 1. Select Incident Scenario
  2. 2. Calculate Scenario-specific ROI
  3. 3. Execute Enterprise Healing
  4. 4. Compare MCP Execution Modes
  5. 5. Explore Audit Trail

📞 Get Started

  • 📧 sales@arfinvestor.com
  • 📚 docs.arfinvestor.com
  • 💬 Join Slack Community
  • 🆓 30-Day Enterprise Trial

🛡️ Enterprise Grade

  • ✅ SOC 2 Type II
  • ✅ GDPR & CCPA
  • ✅ ISO 27001
  • ✅ HIPAA Ready

© 2024 Agentic Reliability Framework. Demo v3.8.0 Enterprise Edition.

Enhanced with scenario-integrated ROI calculator and MCP mode explanations

""") # ============ EVENT HANDLERS ============ # Update scenario (enhanced with ROI data) def update_scenario(scenario_name): scenario = ENHANCED_SCENARIOS.get(scenario_name, {}) # Extract ROI data for display roi_data = scenario.get("roi_data", {}) display_roi_data = { "Hourly Revenue Loss": f"${roi_data.get('hourly_revenue_loss', 0):,.0f}", "Manual Recovery Time": f"{roi_data.get('manual_recovery_hours', 1)*60:.0f} minutes", "Enterprise Recovery Time": f"{roi_data.get('enterprise_recovery_hours', 0.2)*60:.0f} minutes", "Monthly Occurrences": roi_data.get("estimated_monthly_occurrences", 2), "Engineers Required": roi_data.get("engineers_required", 2) } return ( f"### {scenario_name}\n{scenario.get('description', '')}", scenario.get("metrics", {}), scenario.get("impact", {}), None, # Placeholder for timeline {}, # Clear OSS results {}, # Clear Enterprise results display_roi_data ) scenario_dropdown.change( fn=update_scenario, inputs=[scenario_dropdown], outputs=[scenario_description, metrics_display, impact_display, timeline_output, oss_results, enterprise_results, scenario_data_display] ) # Update ROI scenario dropdown roi_scenario_dropdown.change( fn=lambda name: ENHANCED_SCENARIOS.get(name, {}).get("roi_data", {}), inputs=[roi_scenario_dropdown], outputs=[scenario_data_display] ) # Calculate ROI with scenario data def calculate_scenario_roi(scenario_name, monthly_incidents, team_size): """Calculate ROI using scenario-specific data""" roi_result = roi_calculator.calculate_scenario_roi(scenario_name, monthly_incidents, team_size) roi_chart_plot = roi_calculator.create_comparison_chart(scenario_name) return roi_result, roi_chart_plot calculate_roi_btn.click( fn=calculate_scenario_roi, inputs=[roi_scenario_dropdown, monthly_slider, team_slider], outputs=[roi_output, roi_chart] ) # Update MCP mode info def update_mcp_mode(mode): return MCP_MODE_DESCRIPTIONS.get(mode, {}) mcp_mode.change( fn=update_mcp_mode, inputs=[mcp_mode], outputs=[mcp_mode_info] ) # Initialize with first scenario ROI data demo.load( fn=lambda: ENHANCED_SCENARIOS["Cache Miss Storm"].get("roi_data", {}), outputs=[scenario_data_display] ) return demo # =========================================== # MAIN EXECUTION # =========================================== def main(): """Main entry point""" print("🚀 Starting ARF Ultimate Investor Demo v3.8.0...") print("=" * 70) print("📊 New Features:") print(" • Scenario-integrated ROI Calculator") print(" • Extracts revenue loss from incident scenarios") print(" • MCP Mode explanations with use cases") print(" • 4 Enhanced incident scenarios") print("=" * 70) print("🌐 Opening web interface...") demo = create_demo_interface() demo.launch( server_name="0.0.0.0", server_port=7860, share=False ) if __name__ == "__main__": main()