| """ |
| π ARF Ultimate Investor Demo v3.8.0 - ENTERPRISE EDITION |
| Main entry point - Complex, comprehensive demo using actual OSS components |
| """ |
|
|
| import logging |
| import sys |
| import traceback |
| from pathlib import Path |
|
|
| |
| sys.path.insert(0, str(Path(__file__).parent.parent)) |
|
|
| |
| 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__) |
|
|
| try: |
| |
| from demo.core.data_models import ( |
| IncidentSeverity, Incident, AuditEntry, |
| EnterpriseLicense, MCPServerConfig |
| ) |
| from demo.core.audit_trail import AuditTrailManager |
| from demo.business.logic import EnhancedBusinessLogic |
| from demo.business.roi_calculator import ROICalculator |
| from demo.visualization.engine import EnhancedVisualizationEngine |
| from demo.ui.components import create_all_tabs |
| from demo.ui.event_handlers import register_all_handlers |
| from demo.integration.oss_integration import OSSIntegrationManager |
| |
| |
| try: |
| from agentic_reliability_framework.arf_core.models.healing_intent import ( |
| HealingIntent, create_scale_out_intent, create_rollback_intent |
| ) |
| from agentic_reliability_framework.arf_core.engine.simple_mcp_client import OSSMCPClient |
| from agentic_reliability_framework.engine.mcp_server import MCPServer, MCPMode |
| ARF_OSS_AVAILABLE = True |
| OSS_VERSION = "3.3.6" |
| logger.info(f"β
Successfully imported ARF OSS v{OSS_VERSION}") |
| |
| except ImportError as e: |
| logger.warning(f"Failed to import ARF OSS: {e}") |
| ARF_OSS_AVAILABLE = False |
| OSS_VERSION = "Mock 3.3.6" |
| |
| |
| class HealingIntent: |
| def __init__(self, action, component, parameters, **kwargs): |
| self.action = action |
| self.component = component |
| self.parameters = parameters |
| self.justification = kwargs.get('justification', '') |
| self.confidence = kwargs.get('confidence', 0.85) |
| self.similar_incidents = kwargs.get('similar_incidents', []) |
| self.rag_similarity_score = kwargs.get('rag_similarity_score') |
| |
| def to_enterprise_request(self): |
| return { |
| 'action': self.action, |
| 'component': self.component, |
| 'parameters': self.parameters, |
| 'justification': self.justification, |
| 'confidence': self.confidence, |
| 'requires_enterprise': True, |
| 'oss_metadata': { |
| 'similar_incidents_count': len(self.similar_incidents), |
| 'rag_used': self.rag_similarity_score is not None |
| } |
| } |
| |
| 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'}) |
|
|
| |
| 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...") |
| |
| |
| 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() |
| |
| |
| 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; |
| } |
| 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; |
| } |
| """ |
| ) as demo: |
| |
| |
| gr.Markdown(f""" |
| <div style="text-align: center; padding: 30px 20px 20px 20px; background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%); border-radius: 0 0 20px 20px; margin-bottom: 30px; border-bottom: 3px solid #4ECDC4;"> |
| <h1 style="margin-bottom: 10px;">π Agentic Reliability Framework</h1> |
| <h2 style="color: #4a5568; font-weight: 600; margin-bottom: 20px;">Investor Demo v3.8.0 - Enterprise Edition</h2> |
| |
| <div style="display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; margin-bottom: 20px;"> |
| <div class="enterprise-badge">π’ Enterprise Features</div> |
| <div class="oss-badge">π OSS v{OSS_VERSION}</div> |
| <div style="background: #e8f5e8; color: #2d3748; padding: 8px 16px; border-radius: 20px; font-weight: 600; font-size: 0.85rem;"> |
| π 5.2Γ Average ROI |
| </div> |
| <div style="background: #fff3cd; color: #856404; padding: 8px 16px; border-radius: 20px; font-weight: 600; font-size: 0.85rem;"> |
| β‘ 85% MTTR Reduction |
| </div> |
| </div> |
| |
| <div style="color: #718096; font-size: 16px; max-width: 800px; margin: 0 auto; line-height: 1.6;"> |
| Transform your reliability operations from a <span style="font-weight: 700; color: #FF6B6B;">cost center</span> |
| to a <span style="font-weight: 700; color: #4ECDC4;">profit engine</span> with autonomous incident resolution. |
| Experience the full spectrum from OSS advisory to Enterprise autonomous healing. |
| </div> |
| </div> |
| """) |
| |
| |
| with gr.Row(): |
| with gr.Column(scale=1): |
| status_html = f""" |
| <div class="metric-card"> |
| <div style="display: flex; justify-content: space-between; align-items: center;"> |
| <div> |
| <h4 style="margin: 0 0 5px 0; color: #4a5568;">System Status</h4> |
| <div style="display: flex; align-items: center; gap: 10px;"> |
| <div style="width: 12px; height: 12px; background: #4ECDC4; border-radius: 50%;"></div> |
| <span style="font-weight: 600; color: #2d3748;">Operational</span> |
| </div> |
| </div> |
| <div style="text-align: right;"> |
| <div style="font-size: 0.9rem; color: #718096;">OSS Integration</div> |
| <div style="font-weight: 700; color: {"#4ECDC4" if ARF_OSS_AVAILABLE else "#FF6B6B"}"> |
| {"β
Connected" if ARF_OSS_AVAILABLE else "β οΈ Mock Mode"} |
| </div> |
| </div> |
| </div> |
| </div> |
| """ |
| gr.HTML(status_html) |
| |
| with gr.Column(scale=2): |
| performance_html = """ |
| <div class="metric-card"> |
| <div style="display: flex; justify-content: space-between;"> |
| <div> |
| <h4 style="margin: 0 0 5px 0; color: #4a5568;">Performance Metrics</h4> |
| <div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px;"> |
| <div> |
| <div style="font-size: 0.85rem; color: #718096;">Auto-Heal Rate</div> |
| <div style="font-weight: 800; color: #4ECDC4; font-size: 1.2rem;">81.7%</div> |
| </div> |
| <div> |
| <div style="font-size: 0.85rem; color: #718096;">Avg Resolution</div> |
| <div style="font-weight: 800; color: #4ECDC4; font-size: 1.2rem;">8.2 min</div> |
| </div> |
| <div> |
| <div style="font-size: 0.85rem; color: #718096;">Cost Savings</div> |
| <div style="font-weight: 800; color: #4ECDC4; font-size: 1.2rem;">$6.2M/yr</div> |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |
| """ |
| gr.HTML(performance_html) |
| |
| with gr.Column(scale=1): |
| license_html = """ |
| <div class="metric-card"> |
| <h4 style="margin: 0 0 10px 0; color: #4a5568;">License Status</h4> |
| <div style="display: flex; align-items: center; justify-content: space-between;"> |
| <div> |
| <div style="font-weight: 700; color: #4ECDC4; font-size: 1.1rem;">ENTERPRISE</div> |
| <div style="font-size: 0.85rem; color: #718096;">Active β’ Expires 2024-12-31</div> |
| </div> |
| <div style="background: #e8f5e8; color: #276749; padding: 4px 10px; border-radius: 15px; font-size: 0.8rem; font-weight: 600;"> |
| β
Valid |
| </div> |
| </div> |
| </div> |
| """ |
| gr.HTML(license_html) |
| |
| |
| logger.info("Creating main tabs...") |
| tabs_components = create_all_tabs( |
| business_logic=business_logic, |
| viz_engine=viz_engine, |
| audit_manager=audit_manager, |
| roi_calculator=roi_calculator, |
| oss_available=ARF_OSS_AVAILABLE, |
| oss_version=OSS_VERSION |
| ) |
| |
| |
| logger.info("Registering event handlers...") |
| register_all_handlers( |
| demo=demo, |
| components=tabs_components, |
| business_logic=business_logic, |
| viz_engine=viz_engine, |
| audit_manager=audit_manager, |
| roi_calculator=roi_calculator |
| ) |
| |
| |
| gr.Markdown(""" |
| <div style="margin-top: 40px; padding: 30px; background: linear-gradient(135deg, #1a365d 0%, #2d3748 100%); border-radius: 20px; color: white;"> |
| <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; margin-bottom: 30px;"> |
| <div> |
| <h4 style="color: white; margin-bottom: 15px;">π Enterprise Features</h4> |
| <ul style="list-style: none; padding: 0; margin: 0; color: #cbd5e0;"> |
| <li style="margin-bottom: 8px;">β
Autonomous Healing Engine</li> |
| <li style="margin-bottom: 8px;">β
Compliance Automation</li> |
| <li style="margin-bottom: 8px;">β
Learning & Optimization</li> |
| <li style="margin-bottom: 8px;">β
Multi-Cloud Support</li> |
| <li>β
Executive Dashboards</li> |
| </ul> |
| </div> |
| <div> |
| <h4 style="color: white; margin-bottom: 15px;">π§ Integration</h4> |
| <ul style="list-style: none; padding: 0; margin: 0; color: #cbd5e0;"> |
| <li style="margin-bottom: 8px;">AWS β’ Azure β’ GCP</li> |
| <li style="margin-bottom: 8px;">Datadog β’ New Relic</li> |
| <li style="margin-bottom: 8px;">PagerDuty β’ ServiceNow</li> |
| <li style="margin-bottom: 8px;">Slack β’ Microsoft Teams</li> |
| <li>GitHub β’ GitLab β’ Jira</li> |
| </ul> |
| </div> |
| <div> |
| <h4 style="color: white; margin-bottom: 15px;">π Business Impact</h4> |
| <ul style="list-style: none; padding: 0; margin: 0; color: #cbd5e0;"> |
| <li style="margin-bottom: 8px;">5.2Γ Average ROI</li> |
| <li style="margin-bottom: 8px;">85% MTTR Reduction</li> |
| <li style="margin-bottom: 8px;">$6.2M Annual Savings</li> |
| <li style="margin-bottom: 8px;">325+ Hours Reclaimed</li> |
| <li>60% Innovation Increase</li> |
| </ul> |
| </div> |
| </div> |
| |
| <div style="border-top: 1px solid #4a5568; padding-top: 20px; text-align: center;"> |
| <div style="display: flex; justify-content: center; gap: 20px; margin-bottom: 15px;"> |
| <a href="https://arf.dev/enterprise" style="background: #4ECDC4; color: white; padding: 10px 25px; border-radius: 25px; text-decoration: none; font-weight: 600; font-size: 0.9rem;"> |
| π Start 30-Day Trial |
| </a> |
| <a href="https://docs.arfinvestor.com" style="background: transparent; color: #cbd5e0; padding: 10px 25px; border-radius: 25px; text-decoration: none; font-weight: 600; font-size: 0.9rem; border: 1px solid #4a5568;"> |
| π Documentation |
| </a> |
| <a href="https://slack.arfinvestor.com" style="background: transparent; color: #cbd5e0; padding: 10px 25px; border-radius: 25px; text-decoration: none; font-weight: 600; font-size: 0.9rem; border: 1px solid #4a5568;"> |
| π¬ Join Community |
| </a> |
| </div> |
| |
| <div style="color: #a0aec0; font-size: 0.85rem;"> |
| <p style="margin: 5px 0;">Β© 2024 Agentic Reliability Framework. Demo v3.8.0 Enterprise Edition.</p> |
| <p style="margin: 5px 0; font-size: 0.8rem;">This is a demonstration of capabilities. Actual results may vary based on implementation.</p> |
| </div> |
| </div> |
| </div> |
| """) |
| |
| logger.info("Demo interface created successfully") |
| return demo |
| |
| |
| return create_demo_interface() |
|
|
| except Exception as e: |
| logger.error(f"Failed to create demo interface: {e}") |
| logger.error(traceback.format_exc()) |
| |
| |
| import gradio as gr |
| |
| with gr.Blocks(title="π ARF Demo - Error Recovery") as demo: |
| gr.Markdown(f""" |
| # β οΈ ARF Demo Initialization Error |
| |
| An error occurred while initializing the demo: |
| |
| ```python |
| {str(e)} |
| ``` |
| |
| Please check the logs for more details. |
| """) |
| |
| return demo |
|
|
|
|
| def main(): |
| """Main entry point""" |
| try: |
| print("π Starting ARF Ultimate Investor Demo v3.8.0...") |
| print("=" * 70) |
| print("π Features:") |
| print(" β’ 5 Comprehensive Tabs with Advanced Visualizations") |
| print(" β’ Memory Graph & Learning Engine") |
| print(" β’ Enterprise License Management") |
| print(" β’ OSS Integration & HealingIntent Orchestration") |
| print(" β’ ROI Calculator & Business Impact Analysis") |
| print("=" * 70) |
| print("\nInitializing components...") |
| |
| |
| demo = create_demo_interface() |
| |
| |
| demo.launch( |
| server_name="0.0.0.0", |
| server_port=7860, |
| share=False, |
| debug=True, |
| show_error=True, |
| quiet=False, |
| favicon_path=None, |
| ssl_verify=True, |
| max_file_size="100MB", |
| auth=None, |
| auth_message=None, |
| prevent_thread_lock=False, |
| show_api=True, |
| allowed_paths=["./"], |
| block_thread=True, |
| ssl_keyfile=None, |
| ssl_certfile=None, |
| ssl_keyfile_password=None, |
| root_path=None, |
| _frontend=False |
| ) |
| |
| except KeyboardInterrupt: |
| print("\n\nπ Demo stopped by user") |
| except Exception as e: |
| print(f"\nβ Fatal error: {e}") |
| print(traceback.format_exc()) |
| sys.exit(1) |
|
|
|
|
| if __name__ == "__main__": |
| main() |