Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,22 @@
|
|
| 1 |
"""
|
| 2 |
-
🚀 ARF
|
| 3 |
-
|
| 4 |
-
|
| 5 |
"""
|
| 6 |
|
| 7 |
import logging
|
| 8 |
-
import
|
| 9 |
import random
|
| 10 |
-
|
| 11 |
-
from typing import Dict,
|
| 12 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
# Import
|
| 15 |
try:
|
| 16 |
from agentic_reliability_framework.arf_core.models.healing_intent import (
|
| 17 |
HealingIntent,
|
|
@@ -26,7 +31,7 @@ except ImportError as e:
|
|
| 26 |
logger = logging.getLogger(__name__)
|
| 27 |
logger.warning(f"⚠️ ARF OSS not available: {e}. Running in simulation mode.")
|
| 28 |
|
| 29 |
-
# Mock classes
|
| 30 |
class HealingIntent:
|
| 31 |
def __init__(self, **kwargs):
|
| 32 |
self.intent_type = kwargs.get("intent_type", "scale_out")
|
|
@@ -36,7 +41,7 @@ except ImportError as e:
|
|
| 36 |
return {
|
| 37 |
"intent_type": self.intent_type,
|
| 38 |
"parameters": self.parameters,
|
| 39 |
-
"created_at": datetime.now().isoformat()
|
| 40 |
}
|
| 41 |
|
| 42 |
def create_scale_out_intent(resource_type: str, scale_factor: float = 2.0):
|
|
@@ -50,9 +55,6 @@ except ImportError as e:
|
|
| 50 |
)
|
| 51 |
|
| 52 |
class OSSMCPClient:
|
| 53 |
-
def __init__(self):
|
| 54 |
-
self.mode = "advisory"
|
| 55 |
-
|
| 56 |
def analyze_incident(self, metrics: Dict, pattern: str = "") -> Dict:
|
| 57 |
return {
|
| 58 |
"status": "analysis_complete",
|
|
@@ -62,384 +64,337 @@ except ImportError as e:
|
|
| 62 |
"Add circuit breakers",
|
| 63 |
"Optimize configuration"
|
| 64 |
],
|
| 65 |
-
"confidence": 0.92
|
| 66 |
-
"pattern_matched": pattern,
|
| 67 |
-
"healing_intent": {
|
| 68 |
-
"type": "scale_out",
|
| 69 |
-
"requires_execution": True
|
| 70 |
-
}
|
| 71 |
}
|
| 72 |
|
| 73 |
-
# Import our enhanced modules
|
| 74 |
-
from core.data_models import (
|
| 75 |
-
IncidentDatabase, IncidentScenario, OSSAnalysis,
|
| 76 |
-
EnterpriseResults, DemoMode
|
| 77 |
-
)
|
| 78 |
-
from core.visualizations import EnhancedVisualizationEngine
|
| 79 |
-
from core.calculators import EnhancedROICalculator
|
| 80 |
-
from demo.orchestrator import DemoOrchestrator
|
| 81 |
-
from ui.components import (
|
| 82 |
-
create_metric_card,
|
| 83 |
-
create_business_impact_section,
|
| 84 |
-
create_approval_workflow,
|
| 85 |
-
create_roi_comparison_table
|
| 86 |
-
)
|
| 87 |
-
from ui.styles import CUSTOM_CSS, THEME
|
| 88 |
-
|
| 89 |
# Configure logging
|
| 90 |
-
logging.basicConfig(
|
| 91 |
-
level=logging.INFO,
|
| 92 |
-
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
| 93 |
-
)
|
| 94 |
logger = logging.getLogger(__name__)
|
| 95 |
|
| 96 |
# ===========================================
|
| 97 |
-
#
|
| 98 |
# ===========================================
|
| 99 |
|
| 100 |
-
|
| 101 |
-
"
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
""
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
"
|
| 130 |
-
"
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
"
|
| 136 |
-
"
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
"
|
| 142 |
-
"
|
| 143 |
-
"arf_oss_version": "3.3.6",
|
| 144 |
-
"mode": "advisory_only",
|
| 145 |
-
"requires_execution": True,
|
| 146 |
-
"estimated_time": "45-90 minutes",
|
| 147 |
-
"engineers_needed": "2-3 engineers"
|
| 148 |
-
}
|
| 149 |
-
|
| 150 |
-
except Exception as e:
|
| 151 |
-
logger.error(f"ARF analysis error: {e}")
|
| 152 |
-
return {
|
| 153 |
-
"analysis": "⚠️ ARF Analysis (Simulation Mode)",
|
| 154 |
-
"recommendations": [
|
| 155 |
-
"Increase cache memory allocation",
|
| 156 |
-
"Implement cache warming strategy",
|
| 157 |
-
"Optimize key patterns",
|
| 158 |
-
"Add circuit breaker"
|
| 159 |
-
],
|
| 160 |
-
"arf_oss_available": ARF_OSS_AVAILABLE,
|
| 161 |
-
"error": str(e) if not ARF_OSS_AVAILABLE else None
|
| 162 |
}
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
""
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
elif "API" in scenario_name:
|
| 193 |
-
return "api_gateway"
|
| 194 |
-
else:
|
| 195 |
-
return "service"
|
| 196 |
|
| 197 |
# ===========================================
|
| 198 |
-
#
|
| 199 |
# ===========================================
|
| 200 |
|
| 201 |
-
|
| 202 |
-
"""
|
|
|
|
| 203 |
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
self.current_scenario = None
|
| 212 |
-
self.approval_required = True
|
| 213 |
-
self.arf_analysis_results = {}
|
| 214 |
-
|
| 215 |
-
def get_scenario(self, name: str) -> Optional[IncidentScenario]:
|
| 216 |
-
"""Get scenario by name"""
|
| 217 |
-
scenarios = self.scenario_db.get_scenarios()
|
| 218 |
-
return scenarios.get(name)
|
| 219 |
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
scenarios = self.scenario_db.get_scenarios()
|
| 223 |
-
return list(scenarios.keys())
|
| 224 |
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
# Format for display
|
| 236 |
-
return {
|
| 237 |
-
"status": analysis_result["analysis"],
|
| 238 |
-
"recommendations": analysis_result["recommendations"],
|
| 239 |
-
"healing_intent": analysis_result.get("healing_intent", {}),
|
| 240 |
-
"arf_oss": {
|
| 241 |
-
"version": analysis_result.get("arf_oss_version", "3.3.6"),
|
| 242 |
-
"available": ARF_OSS_AVAILABLE,
|
| 243 |
-
"mode": "advisory_only"
|
| 244 |
-
},
|
| 245 |
-
"estimated_impact": analysis_result.get("estimated_time", "45-90 minutes"),
|
| 246 |
-
"action_required": "Manual implementation required",
|
| 247 |
-
"team_effort": analysis_result.get("engineers_needed", "2-3 engineers"),
|
| 248 |
-
"total_cost": self._calculate_oss_cost(scenario)
|
| 249 |
-
}
|
| 250 |
|
| 251 |
-
|
| 252 |
-
"
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 264 |
|
| 265 |
# ===========================================
|
| 266 |
-
#
|
| 267 |
# ===========================================
|
| 268 |
|
| 269 |
-
|
| 270 |
-
"""
|
|
|
|
|
|
|
| 271 |
|
| 272 |
-
|
| 273 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
# Create visualization
|
| 284 |
-
if viz_type == "Interactive Timeline":
|
| 285 |
-
viz = self.state.viz_engine.create_interactive_timeline(scenario)
|
| 286 |
-
else:
|
| 287 |
-
viz = self.state.viz_engine.create_executive_dashboard()
|
| 288 |
-
|
| 289 |
-
return scenario.metrics, scenario.impact, viz
|
| 290 |
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
# Add ARF branding
|
| 299 |
-
result["arf_oss_edition"] = {
|
| 300 |
-
"version": "3.3.6",
|
| 301 |
-
"license": "Apache 2.0",
|
| 302 |
-
"mode": "advisory_only",
|
| 303 |
-
"execution": "manual_required",
|
| 304 |
-
"healing_intent_created": "healing_intent" in result
|
| 305 |
-
}
|
| 306 |
-
|
| 307 |
-
return result
|
| 308 |
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
"
|
| 320 |
-
"
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
if scenario.enterprise_results:
|
| 326 |
-
results = scenario.enterprise_results.to_dict()
|
| 327 |
-
else:
|
| 328 |
-
results = self._simulate_enterprise_execution(scenario)
|
| 329 |
-
|
| 330 |
-
# Update status based on approval
|
| 331 |
-
if approval_required:
|
| 332 |
-
results["status"] = "✅ Approved and Executed"
|
| 333 |
-
results["approval_workflow"] = {
|
| 334 |
-
"required": True,
|
| 335 |
-
"approved_by": "demo_user",
|
| 336 |
-
"timestamp": datetime.now().isoformat()
|
| 337 |
-
}
|
| 338 |
-
else:
|
| 339 |
-
results["status"] = "✅ Auto-Executed"
|
| 340 |
-
results["approval_workflow"] = {
|
| 341 |
-
"required": False,
|
| 342 |
-
"mode": "autonomous",
|
| 343 |
-
"safety_guardrails": "active"
|
| 344 |
}
|
| 345 |
-
|
| 346 |
-
# Add ARF Enterprise context
|
| 347 |
-
results["arf_enterprise"] = {
|
| 348 |
-
"execution_complete": True,
|
| 349 |
-
"learning_applied": True,
|
| 350 |
-
"audit_trail_created": True,
|
| 351 |
-
"compliance_mode": "strict",
|
| 352 |
-
"roi_measured": True
|
| 353 |
}
|
| 354 |
-
|
| 355 |
-
# Create approval workflow display
|
| 356 |
-
approval_display = create_approval_workflow(approval_required)
|
| 357 |
-
|
| 358 |
-
# Configuration
|
| 359 |
-
config = {
|
| 360 |
-
"approval_required": approval_required,
|
| 361 |
-
"compliance_mode": "strict",
|
| 362 |
-
"arf_enterprise": True,
|
| 363 |
-
"safety_mode": "guardrails_active"
|
| 364 |
-
}
|
| 365 |
-
|
| 366 |
-
return approval_display, config, results
|
| 367 |
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 397 |
|
| 398 |
return {
|
| 399 |
-
"
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
"
|
| 403 |
-
"
|
| 404 |
-
"
|
| 405 |
-
"
|
| 406 |
-
"
|
| 407 |
}
|
| 408 |
}
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
avg_impact: int, team_size: int) -> Dict:
|
| 412 |
-
"""Handle ROI calculation"""
|
| 413 |
-
try:
|
| 414 |
-
return self.state.roi_calculator.calculate_comprehensive_roi(
|
| 415 |
-
monthly_incidents, avg_impact, team_size
|
| 416 |
-
)
|
| 417 |
-
except Exception as e:
|
| 418 |
-
logger.error(f"ROI calculation error: {e}")
|
| 419 |
-
return {"error": "Calculation failed"}
|
| 420 |
-
|
| 421 |
-
def handle_next_demo_step(self) -> Dict:
|
| 422 |
-
"""Get next demo step guidance"""
|
| 423 |
-
return self.state.demo_orchestrator.get_next_guidance()
|
| 424 |
|
| 425 |
# ===========================================
|
| 426 |
# MAIN INTERFACE
|
| 427 |
# ===========================================
|
| 428 |
|
| 429 |
-
def
|
| 430 |
-
"""Create the
|
| 431 |
|
| 432 |
-
|
| 433 |
-
|
|
|
|
|
|
|
| 434 |
|
| 435 |
with gr.Blocks(
|
| 436 |
title="🚀 ARF Investor Demo v3.6.0",
|
| 437 |
-
theme=
|
| 438 |
-
css=
|
| 439 |
) as demo:
|
| 440 |
|
| 441 |
-
# ============ HEADER
|
| 442 |
-
arf_status = "✅ ARF OSS v3.3.6" if ARF_OSS_AVAILABLE else "⚠️
|
| 443 |
|
| 444 |
gr.Markdown(f"""
|
| 445 |
# 🚀 Agentic Reliability Framework - Investor Demo v3.6.0
|
|
@@ -450,134 +405,71 @@ def create_main_interface():
|
|
| 450 |
</div>
|
| 451 |
""")
|
| 452 |
|
| 453 |
-
# ============ ARF STATUS BADGE ============
|
| 454 |
-
if ARF_OSS_AVAILABLE:
|
| 455 |
-
gr.Markdown("""
|
| 456 |
-
<div style='
|
| 457 |
-
background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
|
| 458 |
-
color: white;
|
| 459 |
-
padding: 10px 20px;
|
| 460 |
-
border-radius: 20px;
|
| 461 |
-
display: inline-block;
|
| 462 |
-
margin: 10px 0;
|
| 463 |
-
font-weight: bold;
|
| 464 |
-
'>
|
| 465 |
-
✅ Connected to ARF OSS v3.3.6
|
| 466 |
-
</div>
|
| 467 |
-
""")
|
| 468 |
-
|
| 469 |
-
# ============ PRESENTER GUIDANCE ============
|
| 470 |
-
gr.Markdown("### 🎯 Presenter Guidance")
|
| 471 |
-
with gr.Row():
|
| 472 |
-
next_step_btn = gr.Button("🎬 Next Demo Step", variant="secondary")
|
| 473 |
-
quick_demo_btn = gr.Button("⚡ Quick Demo Mode", variant="secondary", size="sm")
|
| 474 |
-
|
| 475 |
-
guidance_display = gr.HTML(
|
| 476 |
-
value="<div class='presenter-guidance'>Click 'Next Demo Step' for guidance</div>"
|
| 477 |
-
)
|
| 478 |
-
|
| 479 |
# ============ MAIN TABS ============
|
| 480 |
with gr.Tabs():
|
| 481 |
|
| 482 |
# TAB 1: LIVE INCIDENT DEMO
|
| 483 |
-
with gr.TabItem("🔥 Live Incident Demo"
|
| 484 |
with gr.Row():
|
| 485 |
-
# Left Panel
|
| 486 |
with gr.Column(scale=1):
|
| 487 |
gr.Markdown("### 🎬 Incident Scenario")
|
| 488 |
scenario_dropdown = gr.Dropdown(
|
| 489 |
-
choices=
|
| 490 |
value="Cache Miss Storm",
|
| 491 |
-
label="Select critical incident:"
|
| 492 |
-
interactive=True
|
| 493 |
)
|
| 494 |
|
| 495 |
gr.Markdown("### 📊 Current Crisis Metrics")
|
| 496 |
metrics_display = gr.JSON(
|
| 497 |
-
value=
|
| 498 |
-
label="Live Metrics"
|
| 499 |
)
|
| 500 |
|
| 501 |
gr.Markdown("### 💰 Business Impact")
|
| 502 |
impact_display = gr.JSON(
|
| 503 |
-
value=
|
| 504 |
-
label="Impact Analysis"
|
| 505 |
)
|
| 506 |
|
| 507 |
-
# Right Panel
|
| 508 |
with gr.Column(scale=2):
|
| 509 |
-
# Visualization
|
| 510 |
-
gr.Markdown("### 📈 Incident
|
| 511 |
-
|
| 512 |
-
choices=["Interactive Timeline", "Executive Dashboard"],
|
| 513 |
-
value="Interactive Timeline",
|
| 514 |
-
label="Choose visualization:"
|
| 515 |
-
)
|
| 516 |
-
|
| 517 |
-
# Visualization Output
|
| 518 |
-
timeline_output = gr.Plot(
|
| 519 |
-
label="Visualization",
|
| 520 |
-
show_label=False
|
| 521 |
-
)
|
| 522 |
|
| 523 |
-
# Action
|
| 524 |
-
gr.Markdown("### 🤖 ARF Analysis & Execution")
|
| 525 |
with gr.Row():
|
| 526 |
-
oss_btn = gr.Button("🆓 Run
|
| 527 |
enterprise_btn = gr.Button("🚀 Execute Enterprise Healing", variant="primary")
|
| 528 |
|
| 529 |
-
# Approval
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
)
|
| 536 |
-
|
| 537 |
-
# ARF Context Information
|
| 538 |
-
if ARF_OSS_AVAILABLE:
|
| 539 |
-
gr.Markdown("""
|
| 540 |
-
<div style='
|
| 541 |
-
background: rgba(78, 205, 196, 0.1);
|
| 542 |
-
padding: 10px;
|
| 543 |
-
border-radius: 8px;
|
| 544 |
-
border-left: 4px solid #4ECDC4;
|
| 545 |
-
margin: 10px 0;
|
| 546 |
-
font-size: 14px;
|
| 547 |
-
'>
|
| 548 |
-
<b>ARF OSS v3.3.6 Active</b><br>
|
| 549 |
-
• Advisory healing intent creation<br>
|
| 550 |
-
• RAG graph memory for pattern recall<br>
|
| 551 |
-
• MCP safety layer (advisory mode)<br>
|
| 552 |
-
• Apache 2.0 licensed
|
| 553 |
-
</div>
|
| 554 |
-
""")
|
| 555 |
|
| 556 |
-
# Approval
|
| 557 |
-
approval_display = gr.HTML(
|
|
|
|
|
|
|
| 558 |
|
| 559 |
# Configuration
|
| 560 |
config_display = gr.JSON(
|
| 561 |
label="⚙️ Enterprise Configuration",
|
| 562 |
-
value={
|
| 563 |
-
"approval_required": True,
|
| 564 |
-
"compliance_mode": "strict",
|
| 565 |
-
"arf_enterprise": True,
|
| 566 |
-
"safety_guardrails": "active"
|
| 567 |
-
}
|
| 568 |
)
|
| 569 |
|
| 570 |
# Results
|
| 571 |
results_display = gr.JSON(
|
| 572 |
label="🎯 Execution Results",
|
| 573 |
-
value={"status": "Ready for
|
| 574 |
)
|
| 575 |
|
| 576 |
# TAB 2: BUSINESS IMPACT & ROI
|
| 577 |
-
with gr.TabItem("💰 Business Impact & ROI"
|
| 578 |
with gr.Column():
|
| 579 |
# Business Dashboard
|
| 580 |
-
gr.Markdown("### 📊
|
| 581 |
dashboard_output = gr.Plot()
|
| 582 |
|
| 583 |
# ROI Calculator
|
|
@@ -590,7 +482,7 @@ def create_main_interface():
|
|
| 590 |
)
|
| 591 |
impact_slider = gr.Slider(
|
| 592 |
1000, 50000, value=8500, step=500,
|
| 593 |
-
label="
|
| 594 |
)
|
| 595 |
team_slider = gr.Slider(
|
| 596 |
1, 20, value=5, step=1,
|
|
@@ -601,200 +493,113 @@ def create_main_interface():
|
|
| 601 |
with gr.Column(scale=2):
|
| 602 |
roi_output = gr.JSON(
|
| 603 |
label="Your ROI Analysis",
|
| 604 |
-
value={"
|
| 605 |
)
|
| 606 |
|
| 607 |
-
# ARF ROI Context
|
| 608 |
-
gr.Markdown("""
|
| 609 |
-
<div style='
|
| 610 |
-
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
|
| 611 |
-
padding: 20px;
|
| 612 |
-
border-radius: 10px;
|
| 613 |
-
margin: 20px 0;
|
| 614 |
-
'>
|
| 615 |
-
<h4 style='margin: 0 0 15px 0;'>📈 ARF ROI Measurement (Enterprise)</h4>
|
| 616 |
-
<div style='display: grid; grid-template-columns: 1fr 1fr; gap: 15px;'>
|
| 617 |
-
<div>
|
| 618 |
-
<div style='font-size: 24px; color: #4ECDC4;'>5.2×</div>
|
| 619 |
-
<div style='font-size: 12px; color: #666;'>Average ROI</div>
|
| 620 |
-
</div>
|
| 621 |
-
<div>
|
| 622 |
-
<div style='font-size: 24px; color: #4ECDC4;'>2-3 mo</div>
|
| 623 |
-
<div style='font-size: 12px; color: #666;'>Payback Period</div>
|
| 624 |
-
</div>
|
| 625 |
-
<div>
|
| 626 |
-
<div style='font-size: 24px; color: #4ECDC4;'>81.7%</div>
|
| 627 |
-
<div style='font-size: 12px; color: #666;'>Auto-Heal Rate</div>
|
| 628 |
-
</div>
|
| 629 |
-
<div>
|
| 630 |
-
<div style='font-size: 24px; color: #4ECDC4;'>85%</div>
|
| 631 |
-
<div style='font-size: 12px; color: #666;'>MTTR Reduction</div>
|
| 632 |
-
</div>
|
| 633 |
-
</div>
|
| 634 |
-
</div>
|
| 635 |
-
""")
|
| 636 |
-
|
| 637 |
# Capability Comparison
|
| 638 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 639 |
|
| 640 |
# ============ FOOTER ============
|
| 641 |
gr.Markdown("---")
|
| 642 |
with gr.Row():
|
| 643 |
with gr.Column(scale=2):
|
| 644 |
-
|
| 645 |
-
**
|
| 646 |
-
|
| 647 |
-
|
| 648 |
-
|
| 649 |
-
|
| 650 |
-
</div>
|
| 651 |
-
"""
|
| 652 |
-
|
| 653 |
-
contact_info = """
|
| 654 |
-
**📞 Contact & Enterprise**
|
| 655 |
-
<div style='margin-top: 10px;'>
|
| 656 |
-
📧 <b>Email:</b> enterprise@arf.dev<br>
|
| 657 |
-
🌐 <b>Website:</b> <a href='https://arf.dev' target='_blank'>https://arf.dev</a><br>
|
| 658 |
-
📚 <b>Docs:</b> <a href='https://docs.arf.dev' target='_blank'>https://docs.arf.dev</a>
|
| 659 |
-
</div>
|
| 660 |
-
"""
|
| 661 |
-
|
| 662 |
-
gr.Markdown(f"""
|
| 663 |
-
<div style='display: grid; grid-template-columns: 1fr 1fr; gap: 40px;'>
|
| 664 |
-
<div>{arf_links}</div>
|
| 665 |
-
<div>{contact_info}</div>
|
| 666 |
-
</div>
|
| 667 |
""")
|
| 668 |
-
|
| 669 |
with gr.Column(scale=1):
|
| 670 |
gr.Markdown("""
|
| 671 |
-
**🎯 Schedule a Demo**
|
| 672 |
-
|
| 673 |
-
<a href='https://arf.dev/demo' target='_blank' style='
|
| 674 |
-
display: inline-block;
|
| 675 |
-
background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
|
| 676 |
-
color: white;
|
| 677 |
-
padding: 12px 24px;
|
| 678 |
-
border-radius: 8px;
|
| 679 |
-
text-decoration: none;
|
| 680 |
-
font-weight: bold;
|
| 681 |
-
text-align: center;
|
| 682 |
-
'>Schedule Enterprise Demo →</a>
|
| 683 |
-
</div>
|
| 684 |
""")
|
| 685 |
|
| 686 |
# ============ EVENT HANDLERS ============
|
| 687 |
|
| 688 |
-
|
| 689 |
-
|
| 690 |
-
|
| 691 |
-
|
| 692 |
-
|
| 693 |
-
|
|
|
|
|
|
|
| 694 |
|
| 695 |
-
|
| 696 |
-
|
| 697 |
-
|
|
|
|
| 698 |
outputs=[metrics_display, impact_display, timeline_output]
|
| 699 |
)
|
| 700 |
|
| 701 |
-
# OSS Analysis
|
| 702 |
oss_btn.click(
|
| 703 |
-
|
| 704 |
inputs=[scenario_dropdown],
|
| 705 |
outputs=[results_display]
|
| 706 |
)
|
| 707 |
|
| 708 |
# Enterprise Execution
|
| 709 |
enterprise_btn.click(
|
| 710 |
-
|
| 711 |
inputs=[scenario_dropdown, approval_toggle],
|
| 712 |
outputs=[approval_display, config_display, results_display]
|
| 713 |
)
|
| 714 |
|
| 715 |
# Approval toggle updates config
|
| 716 |
approval_toggle.change(
|
| 717 |
-
lambda approval: {
|
| 718 |
-
"approval_required": approval,
|
| 719 |
-
"compliance_mode": "strict",
|
| 720 |
-
"arf_enterprise": True,
|
| 721 |
-
"safety_guardrails": "active"
|
| 722 |
-
},
|
| 723 |
inputs=[approval_toggle],
|
| 724 |
outputs=[config_display]
|
| 725 |
)
|
| 726 |
|
| 727 |
# ROI Calculation
|
| 728 |
calculate_btn.click(
|
| 729 |
-
|
| 730 |
inputs=[monthly_slider, impact_slider, team_slider],
|
| 731 |
outputs=[roi_output]
|
| 732 |
)
|
| 733 |
|
| 734 |
-
# Next demo step guidance
|
| 735 |
-
next_step_btn.click(
|
| 736 |
-
handlers.handle_next_demo_step,
|
| 737 |
-
outputs=[guidance_display]
|
| 738 |
-
)
|
| 739 |
-
|
| 740 |
-
# Quick demo button - runs OSS analysis automatically
|
| 741 |
-
quick_demo_btn.click(
|
| 742 |
-
lambda scenario: handlers.handle_oss_analysis(scenario),
|
| 743 |
-
inputs=[scenario_dropdown],
|
| 744 |
-
outputs=[results_display]
|
| 745 |
-
)
|
| 746 |
-
|
| 747 |
# ============ INITIAL LOAD ============
|
| 748 |
-
|
| 749 |
-
|
| 750 |
-
"""Load initial visualizations and data"""
|
| 751 |
-
# Get initial scenario
|
| 752 |
-
scenario = state.get_scenario("Cache Miss Storm")
|
| 753 |
-
|
| 754 |
-
# Create visualizations
|
| 755 |
-
timeline_viz = state.viz_engine.create_interactive_timeline(scenario)
|
| 756 |
-
dashboard_viz = state.viz_engine.create_executive_dashboard()
|
| 757 |
-
|
| 758 |
-
# Get initial guidance
|
| 759 |
-
guidance = state.demo_orchestrator.get_next_guidance()
|
| 760 |
-
|
| 761 |
-
# Add ARF status
|
| 762 |
-
arf_status_html = ""
|
| 763 |
-
if ARF_OSS_AVAILABLE:
|
| 764 |
-
arf_status_html = """
|
| 765 |
-
<div style='
|
| 766 |
-
background: rgba(78, 205, 196, 0.1);
|
| 767 |
-
padding: 10px;
|
| 768 |
-
border-radius: 8px;
|
| 769 |
-
border-left: 4px solid #4ECDC4;
|
| 770 |
-
margin: 10px 0;
|
| 771 |
-
'>
|
| 772 |
-
✅ <b>ARF OSS v3.3.6 Loaded</b> - Real framework analysis available
|
| 773 |
-
</div>
|
| 774 |
-
"""
|
| 775 |
-
|
| 776 |
return (
|
| 777 |
-
|
| 778 |
-
|
| 779 |
-
|
| 780 |
-
|
| 781 |
-
arf_status_html + guidance["html"]
|
| 782 |
)
|
| 783 |
|
| 784 |
demo.load(
|
| 785 |
-
|
| 786 |
-
outputs=[
|
| 787 |
-
metrics_display,
|
| 788 |
-
impact_display,
|
| 789 |
-
timeline_output,
|
| 790 |
-
dashboard_output,
|
| 791 |
-
guidance_display
|
| 792 |
-
]
|
| 793 |
)
|
| 794 |
|
| 795 |
# ============ INSTRUCTIONS ============
|
| 796 |
gr.Markdown(f"""
|
| 797 |
-
<div
|
| 798 |
🚀 <b>ARF Ultimate Investor Demo v3.6.0</b> | {'✅ Integrated with ARF OSS v3.3.6' if ARF_OSS_AVAILABLE else '⚠️ Running in simulation mode'}
|
| 799 |
<i>From Cost Center to Profit Engine: 5.2× ROI with Autonomous Reliability</i>
|
| 800 |
</div>
|
|
@@ -803,27 +608,21 @@ def create_main_interface():
|
|
| 803 |
return demo
|
| 804 |
|
| 805 |
# ===========================================
|
| 806 |
-
#
|
| 807 |
# ===========================================
|
| 808 |
|
| 809 |
-
|
| 810 |
-
"""Main entry point"""
|
| 811 |
logger.info("=" * 80)
|
| 812 |
logger.info("🚀 Launching ARF Investor Demo v3.6.0")
|
| 813 |
logger.info(f"✅ ARF OSS Available: {ARF_OSS_AVAILABLE}")
|
| 814 |
-
logger.info("✅
|
| 815 |
-
logger.info("✅ Best practices applied")
|
| 816 |
-
logger.info("✅ Investor-grade UX")
|
| 817 |
logger.info("=" * 80)
|
| 818 |
|
| 819 |
-
demo =
|
| 820 |
demo.launch(
|
| 821 |
server_name="0.0.0.0",
|
| 822 |
server_port=7860,
|
| 823 |
share=False,
|
| 824 |
debug=False,
|
| 825 |
show_error=True
|
| 826 |
-
)
|
| 827 |
-
|
| 828 |
-
if __name__ == "__main__":
|
| 829 |
-
main()
|
|
|
|
| 1 |
"""
|
| 2 |
+
🚀 ARF Investor Demo - COMPLETE STANDALONE VERSION
|
| 3 |
+
No module dependencies - Everything in one file
|
| 4 |
+
Works on Hugging Face Spaces
|
| 5 |
"""
|
| 6 |
|
| 7 |
import logging
|
| 8 |
+
import datetime
|
| 9 |
import random
|
| 10 |
+
import uuid
|
| 11 |
+
from typing import Dict, List, Optional, Any
|
| 12 |
import gradio as gr
|
| 13 |
+
import plotly.graph_objects as go
|
| 14 |
+
import plotly.express as px
|
| 15 |
+
import pandas as pd
|
| 16 |
+
import numpy as np
|
| 17 |
+
from plotly.subplots import make_subplots
|
| 18 |
|
| 19 |
+
# Import ARF OSS if available
|
| 20 |
try:
|
| 21 |
from agentic_reliability_framework.arf_core.models.healing_intent import (
|
| 22 |
HealingIntent,
|
|
|
|
| 31 |
logger = logging.getLogger(__name__)
|
| 32 |
logger.warning(f"⚠️ ARF OSS not available: {e}. Running in simulation mode.")
|
| 33 |
|
| 34 |
+
# Mock classes
|
| 35 |
class HealingIntent:
|
| 36 |
def __init__(self, **kwargs):
|
| 37 |
self.intent_type = kwargs.get("intent_type", "scale_out")
|
|
|
|
| 41 |
return {
|
| 42 |
"intent_type": self.intent_type,
|
| 43 |
"parameters": self.parameters,
|
| 44 |
+
"created_at": datetime.datetime.now().isoformat()
|
| 45 |
}
|
| 46 |
|
| 47 |
def create_scale_out_intent(resource_type: str, scale_factor: float = 2.0):
|
|
|
|
| 55 |
)
|
| 56 |
|
| 57 |
class OSSMCPClient:
|
|
|
|
|
|
|
|
|
|
| 58 |
def analyze_incident(self, metrics: Dict, pattern: str = "") -> Dict:
|
| 59 |
return {
|
| 60 |
"status": "analysis_complete",
|
|
|
|
| 64 |
"Add circuit breakers",
|
| 65 |
"Optimize configuration"
|
| 66 |
],
|
| 67 |
+
"confidence": 0.92
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
}
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
# Configure logging
|
| 71 |
+
logging.basicConfig(level=logging.INFO)
|
|
|
|
|
|
|
|
|
|
| 72 |
logger = logging.getLogger(__name__)
|
| 73 |
|
| 74 |
# ===========================================
|
| 75 |
+
# DATA - Everything in one place
|
| 76 |
# ===========================================
|
| 77 |
|
| 78 |
+
INCIDENT_SCENARIOS = {
|
| 79 |
+
"Cache Miss Storm": {
|
| 80 |
+
"metrics": {
|
| 81 |
+
"Cache Hit Rate": "18.5% (Critical)",
|
| 82 |
+
"Database Load": "92% (Overloaded)",
|
| 83 |
+
"Response Time": "1850ms (Slow)",
|
| 84 |
+
"Affected Users": "45,000"
|
| 85 |
+
},
|
| 86 |
+
"impact": {
|
| 87 |
+
"Revenue Loss": "$8,500/hour",
|
| 88 |
+
"Page Load Time": "+300%",
|
| 89 |
+
"Users Impacted": "45,000"
|
| 90 |
+
},
|
| 91 |
+
"oss_analysis": {
|
| 92 |
+
"status": "✅ ARF OSS Analysis Complete",
|
| 93 |
+
"recommendations": [
|
| 94 |
+
"Increase Redis cache memory allocation",
|
| 95 |
+
"Implement cache warming strategy",
|
| 96 |
+
"Optimize key patterns (TTL adjustments)",
|
| 97 |
+
"Add circuit breaker for database fallback"
|
| 98 |
+
],
|
| 99 |
+
"estimated_time": "60+ minutes",
|
| 100 |
+
"engineers_needed": "2-3 SREs",
|
| 101 |
+
"manual_effort": "High",
|
| 102 |
+
"arf_oss": True,
|
| 103 |
+
"healing_intent_created": True
|
| 104 |
+
},
|
| 105 |
+
"enterprise_results": {
|
| 106 |
+
"actions_completed": [
|
| 107 |
+
"✅ Auto-scaled Redis: 4GB → 8GB",
|
| 108 |
+
"✅ Deployed cache warming service",
|
| 109 |
+
"✅ Optimized 12 key patterns",
|
| 110 |
+
"✅ Implemented circuit breaker"
|
| 111 |
+
],
|
| 112 |
+
"metrics_improvement": {
|
| 113 |
+
"Cache Hit Rate": "18.5% → 72%",
|
| 114 |
+
"Response Time": "1850ms → 450ms",
|
| 115 |
+
"Database Load": "92% → 45%"
|
| 116 |
+
},
|
| 117 |
+
"business_impact": {
|
| 118 |
+
"Recovery Time": "60 min → 12 min",
|
| 119 |
+
"Cost Saved": "$7,200",
|
| 120 |
+
"Users Impacted": "45,000 → 0"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
}
|
| 122 |
+
}
|
| 123 |
+
},
|
| 124 |
+
"Database Connection Pool Exhaustion": {
|
| 125 |
+
"metrics": {
|
| 126 |
+
"Active Connections": "98/100 (Critical)",
|
| 127 |
+
"API Latency": "2450ms",
|
| 128 |
+
"Error Rate": "15.2%",
|
| 129 |
+
"Queue Depth": "1250"
|
| 130 |
+
},
|
| 131 |
+
"impact": {
|
| 132 |
+
"Revenue Loss": "$4,200/hour",
|
| 133 |
+
"Affected Services": "API Gateway, User Service",
|
| 134 |
+
"SLA Violation": "Yes"
|
| 135 |
+
}
|
| 136 |
+
},
|
| 137 |
+
"Memory Leak in Production": {
|
| 138 |
+
"metrics": {
|
| 139 |
+
"Memory Usage": "96% (Critical)",
|
| 140 |
+
"GC Pause Time": "4500ms",
|
| 141 |
+
"Error Rate": "28.5%",
|
| 142 |
+
"Restart Frequency": "12/hour"
|
| 143 |
+
},
|
| 144 |
+
"impact": {
|
| 145 |
+
"Revenue Loss": "$5,500/hour",
|
| 146 |
+
"Session Loss": "8,500 users",
|
| 147 |
+
"Customer Impact": "High"
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
|
| 152 |
# ===========================================
|
| 153 |
+
# VISUALIZATION FUNCTIONS
|
| 154 |
# ===========================================
|
| 155 |
|
| 156 |
+
def create_timeline_visualization():
|
| 157 |
+
"""Create interactive timeline"""
|
| 158 |
+
fig = go.Figure()
|
| 159 |
|
| 160 |
+
events = [
|
| 161 |
+
{"time": "T-5m", "event": "📉 Cache hit rate drops", "type": "problem"},
|
| 162 |
+
{"time": "T-3m", "event": "🤖 ARF detects pattern", "type": "detection"},
|
| 163 |
+
{"time": "T-2m", "event": "🧠 Analysis complete", "type": "analysis"},
|
| 164 |
+
{"time": "T-1m", "event": "⚡ Healing executed", "type": "action"},
|
| 165 |
+
{"time": "Now", "event": "✅ System recovered", "type": "recovery"}
|
| 166 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
|
| 168 |
+
colors = {"problem": "red", "detection": "blue", "analysis": "purple",
|
| 169 |
+
"action": "green", "recovery": "lightgreen"}
|
|
|
|
|
|
|
| 170 |
|
| 171 |
+
for event in events:
|
| 172 |
+
fig.add_trace(go.Scatter(
|
| 173 |
+
x=[event["time"]],
|
| 174 |
+
y=[1],
|
| 175 |
+
mode='markers+text',
|
| 176 |
+
marker=dict(size=15, color=colors[event["type"]], symbol='circle'),
|
| 177 |
+
text=[event["event"]],
|
| 178 |
+
textposition="top center",
|
| 179 |
+
name=event["type"].capitalize()
|
| 180 |
+
))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
|
| 182 |
+
fig.update_layout(
|
| 183 |
+
title="<b>Incident Timeline</b>",
|
| 184 |
+
height=400,
|
| 185 |
+
showlegend=True,
|
| 186 |
+
paper_bgcolor='rgba(0,0,0,0)',
|
| 187 |
+
plot_bgcolor='rgba(0,0,0,0)',
|
| 188 |
+
yaxis=dict(showticklabels=False, range=[0.5, 1.5])
|
| 189 |
+
)
|
| 190 |
+
|
| 191 |
+
return fig
|
| 192 |
+
|
| 193 |
+
def create_business_dashboard():
|
| 194 |
+
"""Create executive dashboard"""
|
| 195 |
+
fig = make_subplots(
|
| 196 |
+
rows=2, cols=2,
|
| 197 |
+
subplot_titles=('Cost Impact', 'Team Time', 'MTTR Comparison', 'ROI'),
|
| 198 |
+
vertical_spacing=0.15
|
| 199 |
+
)
|
| 200 |
+
|
| 201 |
+
# 1. Cost Impact
|
| 202 |
+
categories = ['Without ARF', 'With ARF Enterprise', 'Savings']
|
| 203 |
+
values = [2.96, 1.0, 1.96]
|
| 204 |
+
|
| 205 |
+
fig.add_trace(
|
| 206 |
+
go.Bar(x=categories, y=values, marker_color=['#FF6B6B', '#4ECDC4', '#45B7D1']),
|
| 207 |
+
row=1, col=1
|
| 208 |
+
)
|
| 209 |
+
|
| 210 |
+
# 2. Team Time
|
| 211 |
+
activities = ['Firefighting', 'Innovation', 'Strategic']
|
| 212 |
+
before = [60, 20, 20]
|
| 213 |
+
after = [10, 60, 30]
|
| 214 |
+
|
| 215 |
+
fig.add_trace(go.Bar(x=activities, y=before, name='Before', marker_color='#FF6B6B'), row=1, col=2)
|
| 216 |
+
fig.add_trace(go.Bar(x=activities, y=after, name='After', marker_color='#4ECDC4'), row=1, col=2)
|
| 217 |
+
|
| 218 |
+
# 3. MTTR Comparison
|
| 219 |
+
mttr_methods = ['Manual', 'Traditional', 'ARF OSS', 'ARF Enterprise']
|
| 220 |
+
mttr_times = [120, 45, 25, 8]
|
| 221 |
+
|
| 222 |
+
fig.add_trace(
|
| 223 |
+
go.Bar(x=mttr_methods, y=mttr_times, marker_color=['#FF6B6B', '#FFE66D', '#45B7D1', '#4ECDC4']),
|
| 224 |
+
row=2, col=1
|
| 225 |
+
)
|
| 226 |
+
|
| 227 |
+
# 4. ROI Gauge
|
| 228 |
+
fig.add_trace(
|
| 229 |
+
go.Indicator(
|
| 230 |
+
mode="gauge+number",
|
| 231 |
+
value=5.2,
|
| 232 |
+
title={'text': "ROI Multiplier"},
|
| 233 |
+
gauge={
|
| 234 |
+
'axis': {'range': [0, 10]},
|
| 235 |
+
'bar': {'color': "#4ECDC4"},
|
| 236 |
+
'steps': [
|
| 237 |
+
{'range': [0, 2], 'color': "lightgray"},
|
| 238 |
+
{'range': [2, 4], 'color': "gray"},
|
| 239 |
+
{'range': [4, 6], 'color': "lightgreen"},
|
| 240 |
+
{'range': [6, 10], 'color': "green"}
|
| 241 |
+
]
|
| 242 |
+
}
|
| 243 |
+
),
|
| 244 |
+
row=2, col=2
|
| 245 |
+
)
|
| 246 |
+
|
| 247 |
+
fig.update_layout(
|
| 248 |
+
height=700,
|
| 249 |
+
showlegend=True,
|
| 250 |
+
paper_bgcolor='rgba(0,0,0,0)',
|
| 251 |
+
plot_bgcolor='rgba(0,0,0,0)',
|
| 252 |
+
title_text="<b>Executive Business Dashboard</b>"
|
| 253 |
+
)
|
| 254 |
+
|
| 255 |
+
return fig
|
| 256 |
|
| 257 |
# ===========================================
|
| 258 |
+
# BUSINESS LOGIC
|
| 259 |
# ===========================================
|
| 260 |
|
| 261 |
+
def run_oss_analysis(scenario_name: str):
|
| 262 |
+
"""Run OSS analysis"""
|
| 263 |
+
scenario = INCIDENT_SCENARIOS.get(scenario_name, {})
|
| 264 |
+
analysis = scenario.get("oss_analysis", {})
|
| 265 |
|
| 266 |
+
if not analysis:
|
| 267 |
+
analysis = {
|
| 268 |
+
"status": "✅ Analysis Complete",
|
| 269 |
+
"recommendations": [
|
| 270 |
+
"Increase resource allocation",
|
| 271 |
+
"Implement monitoring",
|
| 272 |
+
"Add circuit breakers",
|
| 273 |
+
"Optimize configuration"
|
| 274 |
+
],
|
| 275 |
+
"estimated_time": "45-60 minutes",
|
| 276 |
+
"engineers_needed": "2-3",
|
| 277 |
+
"manual_effort": "Required",
|
| 278 |
+
"arf_oss": ARF_OSS_AVAILABLE
|
| 279 |
+
}
|
| 280 |
|
| 281 |
+
# Add ARF context
|
| 282 |
+
analysis["arf_context"] = {
|
| 283 |
+
"oss_available": ARF_OSS_AVAILABLE,
|
| 284 |
+
"version": "3.3.6",
|
| 285 |
+
"mode": "advisory_only",
|
| 286 |
+
"healing_intent": "created" if ARF_OSS_AVAILABLE else "simulated"
|
| 287 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 288 |
|
| 289 |
+
return analysis
|
| 290 |
+
|
| 291 |
+
def execute_enterprise_healing(scenario_name: str, approval_required: bool):
|
| 292 |
+
"""Execute enterprise healing"""
|
| 293 |
+
scenario = INCIDENT_SCENARIOS.get(scenario_name, {})
|
| 294 |
+
results = scenario.get("enterprise_results", {})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 295 |
|
| 296 |
+
if not results:
|
| 297 |
+
results = {
|
| 298 |
+
"status": "✅ Auto-Executed" if not approval_required else "✅ Approved and Executed",
|
| 299 |
+
"actions_completed": [
|
| 300 |
+
"✅ Auto-scaled resources",
|
| 301 |
+
"✅ Implemented optimization",
|
| 302 |
+
"✅ Deployed monitoring",
|
| 303 |
+
"✅ Validated recovery"
|
| 304 |
+
],
|
| 305 |
+
"metrics_improvement": {
|
| 306 |
+
"Performance": "Improved",
|
| 307 |
+
"Recovery": "Complete"
|
| 308 |
+
},
|
| 309 |
+
"business_impact": {
|
| 310 |
+
"Cost Saved": f"${random.randint(2000, 8000):,}",
|
| 311 |
+
"Time Saved": f"{random.randint(30, 60)} min → {random.randint(5, 15)} min"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 312 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 313 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 314 |
|
| 315 |
+
# Add approval info
|
| 316 |
+
if approval_required:
|
| 317 |
+
approval_html = f"""
|
| 318 |
+
<div style='padding: 15px; background: #f8f9fa; border-radius: 8px; border-left: 4px solid #007bff; margin: 10px 0;'>
|
| 319 |
+
<h4 style='margin: 0 0 10px 0;'>🛡️ Approval Required</h4>
|
| 320 |
+
<p><b>Action:</b> Scale resources for {scenario_name}</p>
|
| 321 |
+
<p><b>Risk:</b> Low (auto-rollback available)</p>
|
| 322 |
+
<p><b>Status:</b> ✅ <span style='color: green;'>Approved & Executed</span></p>
|
| 323 |
+
</div>
|
| 324 |
+
"""
|
| 325 |
+
else:
|
| 326 |
+
approval_html = f"""
|
| 327 |
+
<div style='padding: 15px; background: #e8f5e8; border-radius: 8px; border-left: 4px solid #28a745; margin: 10px 0;'>
|
| 328 |
+
<h4 style='margin: 0 0 10px 0;'>⚡ Auto-Executed</h4>
|
| 329 |
+
<p><b>Action:</b> Autonomous healing for {scenario_name}</p>
|
| 330 |
+
<p><b>Mode:</b> Fully autonomous (guardrails active)</p>
|
| 331 |
+
<p><b>Status:</b> ✅ <span style='color: green;'>Successfully completed</span></p>
|
| 332 |
+
</div>
|
| 333 |
+
"""
|
| 334 |
+
|
| 335 |
+
# Add enterprise context
|
| 336 |
+
results["enterprise_context"] = {
|
| 337 |
+
"approval_required": approval_required,
|
| 338 |
+
"compliance_mode": "strict",
|
| 339 |
+
"audit_trail": "created",
|
| 340 |
+
"learning_applied": True,
|
| 341 |
+
"roi_measured": True
|
| 342 |
+
}
|
| 343 |
+
|
| 344 |
+
return approval_html, {"approval_required": approval_required, "compliance_mode": "strict"}, results
|
| 345 |
+
|
| 346 |
+
def calculate_roi(monthly_incidents: int, avg_impact: int, team_size: int):
|
| 347 |
+
"""Calculate ROI"""
|
| 348 |
+
try:
|
| 349 |
+
annual_impact = monthly_incidents * 12 * avg_impact
|
| 350 |
+
team_cost = team_size * 150000
|
| 351 |
+
savings = annual_impact * 0.82
|
| 352 |
+
|
| 353 |
+
roi_multiplier = savings / team_cost if team_cost > 0 else 0
|
| 354 |
+
|
| 355 |
+
if roi_multiplier >= 5.0:
|
| 356 |
+
recommendation = "🚀 Excellent fit for ARF Enterprise"
|
| 357 |
+
elif roi_multiplier >= 2.0:
|
| 358 |
+
recommendation = "✅ Good ROI with ARF Enterprise"
|
| 359 |
+
elif roi_multiplier >= 1.0:
|
| 360 |
+
recommendation = "⚠️ Consider ARF OSS edition first"
|
| 361 |
+
else:
|
| 362 |
+
recommendation = "🆓 Start with ARF OSS (free)"
|
| 363 |
|
| 364 |
return {
|
| 365 |
+
"analysis": {
|
| 366 |
+
"your_annual_impact": f"${annual_impact:,.0f}",
|
| 367 |
+
"your_team_cost": f"${team_cost:,.0f}",
|
| 368 |
+
"potential_savings": f"${savings:,.0f}",
|
| 369 |
+
"your_roi_multiplier": f"{roi_multiplier:.1f}×",
|
| 370 |
+
"vs_industry_average": "5.2× average ROI",
|
| 371 |
+
"recommendation": recommendation,
|
| 372 |
+
"payback_period": f"{(team_cost / (savings / 12)):.1f} months" if savings > 0 else "N/A"
|
| 373 |
}
|
| 374 |
}
|
| 375 |
+
except Exception as e:
|
| 376 |
+
return {"error": f"Calculation error: {str(e)}"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 377 |
|
| 378 |
# ===========================================
|
| 379 |
# MAIN INTERFACE
|
| 380 |
# ===========================================
|
| 381 |
|
| 382 |
+
def create_interface():
|
| 383 |
+
"""Create the Gradio interface"""
|
| 384 |
|
| 385 |
+
custom_css = """
|
| 386 |
+
.gradio-container { max-width: 1200px; margin: auto; }
|
| 387 |
+
h1, h2, h3 { color: #1a365d !important; }
|
| 388 |
+
"""
|
| 389 |
|
| 390 |
with gr.Blocks(
|
| 391 |
title="🚀 ARF Investor Demo v3.6.0",
|
| 392 |
+
theme=gr.themes.Soft(),
|
| 393 |
+
css=custom_css
|
| 394 |
) as demo:
|
| 395 |
|
| 396 |
+
# ============ HEADER ============
|
| 397 |
+
arf_status = "✅ ARF OSS v3.3.6" if ARF_OSS_AVAILABLE else "⚠️ Simulation Mode"
|
| 398 |
|
| 399 |
gr.Markdown(f"""
|
| 400 |
# 🚀 Agentic Reliability Framework - Investor Demo v3.6.0
|
|
|
|
| 405 |
</div>
|
| 406 |
""")
|
| 407 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 408 |
# ============ MAIN TABS ============
|
| 409 |
with gr.Tabs():
|
| 410 |
|
| 411 |
# TAB 1: LIVE INCIDENT DEMO
|
| 412 |
+
with gr.TabItem("🔥 Live Incident Demo"):
|
| 413 |
with gr.Row():
|
| 414 |
+
# Left Panel
|
| 415 |
with gr.Column(scale=1):
|
| 416 |
gr.Markdown("### 🎬 Incident Scenario")
|
| 417 |
scenario_dropdown = gr.Dropdown(
|
| 418 |
+
choices=list(INCIDENT_SCENARIOS.keys()),
|
| 419 |
value="Cache Miss Storm",
|
| 420 |
+
label="Select critical incident:"
|
|
|
|
| 421 |
)
|
| 422 |
|
| 423 |
gr.Markdown("### 📊 Current Crisis Metrics")
|
| 424 |
metrics_display = gr.JSON(
|
| 425 |
+
value=INCIDENT_SCENARIOS["Cache Miss Storm"]["metrics"]
|
|
|
|
| 426 |
)
|
| 427 |
|
| 428 |
gr.Markdown("### 💰 Business Impact")
|
| 429 |
impact_display = gr.JSON(
|
| 430 |
+
value=INCIDENT_SCENARIOS["Cache Miss Storm"]["impact"]
|
|
|
|
| 431 |
)
|
| 432 |
|
| 433 |
+
# Right Panel
|
| 434 |
with gr.Column(scale=2):
|
| 435 |
+
# Visualization
|
| 436 |
+
gr.Markdown("### 📈 Incident Timeline")
|
| 437 |
+
timeline_output = gr.Plot()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 438 |
|
| 439 |
+
# Action Buttons
|
|
|
|
| 440 |
with gr.Row():
|
| 441 |
+
oss_btn = gr.Button("🆓 Run OSS Analysis", variant="secondary")
|
| 442 |
enterprise_btn = gr.Button("🚀 Execute Enterprise Healing", variant="primary")
|
| 443 |
|
| 444 |
+
# Approval Toggle
|
| 445 |
+
approval_toggle = gr.Checkbox(
|
| 446 |
+
label="🔐 Require Manual Approval",
|
| 447 |
+
value=True,
|
| 448 |
+
info="Toggle to show approval workflow vs auto-execution"
|
| 449 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 450 |
|
| 451 |
+
# Approval Display
|
| 452 |
+
approval_display = gr.HTML(
|
| 453 |
+
value="<div style='padding: 10px; background: #f8f9fa; border-radius: 5px;'>Approval status will appear here</div>"
|
| 454 |
+
)
|
| 455 |
|
| 456 |
# Configuration
|
| 457 |
config_display = gr.JSON(
|
| 458 |
label="⚙️ Enterprise Configuration",
|
| 459 |
+
value={"approval_required": True, "compliance_mode": "strict"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 460 |
)
|
| 461 |
|
| 462 |
# Results
|
| 463 |
results_display = gr.JSON(
|
| 464 |
label="🎯 Execution Results",
|
| 465 |
+
value={"status": "Ready for execution..."}
|
| 466 |
)
|
| 467 |
|
| 468 |
# TAB 2: BUSINESS IMPACT & ROI
|
| 469 |
+
with gr.TabItem("💰 Business Impact & ROI"):
|
| 470 |
with gr.Column():
|
| 471 |
# Business Dashboard
|
| 472 |
+
gr.Markdown("### 📊 Business Health Dashboard")
|
| 473 |
dashboard_output = gr.Plot()
|
| 474 |
|
| 475 |
# ROI Calculator
|
|
|
|
| 482 |
)
|
| 483 |
impact_slider = gr.Slider(
|
| 484 |
1000, 50000, value=8500, step=500,
|
| 485 |
+
label="Avg incident impact ($)"
|
| 486 |
)
|
| 487 |
team_slider = gr.Slider(
|
| 488 |
1, 20, value=5, step=1,
|
|
|
|
| 493 |
with gr.Column(scale=2):
|
| 494 |
roi_output = gr.JSON(
|
| 495 |
label="Your ROI Analysis",
|
| 496 |
+
value={"analysis": "Adjust sliders and click 'Calculate My ROI'"}
|
| 497 |
)
|
| 498 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 499 |
# Capability Comparison
|
| 500 |
+
gr.Markdown("### 📋 Capability Comparison")
|
| 501 |
+
with gr.Row():
|
| 502 |
+
with gr.Column():
|
| 503 |
+
gr.Markdown("""
|
| 504 |
+
**OSS Edition (Free)**
|
| 505 |
+
- Advisory recommendations only
|
| 506 |
+
- Manual implementation required
|
| 507 |
+
- No auto-healing
|
| 508 |
+
- Community support
|
| 509 |
+
- No ROI measurement
|
| 510 |
+
""")
|
| 511 |
+
with gr.Column():
|
| 512 |
+
gr.Markdown("""
|
| 513 |
+
**Enterprise Edition**
|
| 514 |
+
- Autonomous execution
|
| 515 |
+
- 81.7% auto-heal rate
|
| 516 |
+
- Full audit trails & compliance
|
| 517 |
+
- 24/7 enterprise support
|
| 518 |
+
- 5.2× average ROI
|
| 519 |
+
- 2-3 month payback
|
| 520 |
+
""")
|
| 521 |
|
| 522 |
# ============ FOOTER ============
|
| 523 |
gr.Markdown("---")
|
| 524 |
with gr.Row():
|
| 525 |
with gr.Column(scale=2):
|
| 526 |
+
gr.Markdown("""
|
| 527 |
+
**📞 Contact & Demo**
|
| 528 |
+
📧 petter2025us@outlook.com
|
| 529 |
+
🌐 [https://arf.dev](https://arf.dev)
|
| 530 |
+
📚 [Documentation](https://docs.arf.dev)
|
| 531 |
+
💻 [GitHub](https://github.com/petterjuan/agentic-reliability-framework)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 532 |
""")
|
|
|
|
| 533 |
with gr.Column(scale=1):
|
| 534 |
gr.Markdown("""
|
| 535 |
+
**🎯 Schedule a Demo**
|
| 536 |
+
(https://calendly.com/petter2025us/30min)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 537 |
""")
|
| 538 |
|
| 539 |
# ============ EVENT HANDLERS ============
|
| 540 |
|
| 541 |
+
def update_scenario(scenario_name: str):
|
| 542 |
+
"""Update when scenario changes"""
|
| 543 |
+
scenario = INCIDENT_SCENARIOS.get(scenario_name, {})
|
| 544 |
+
return (
|
| 545 |
+
scenario.get("metrics", {}),
|
| 546 |
+
scenario.get("impact", {}),
|
| 547 |
+
create_timeline_visualization()
|
| 548 |
+
)
|
| 549 |
|
| 550 |
+
# Scenario change
|
| 551 |
+
scenario_dropdown.change(
|
| 552 |
+
update_scenario,
|
| 553 |
+
inputs=[scenario_dropdown],
|
| 554 |
outputs=[metrics_display, impact_display, timeline_output]
|
| 555 |
)
|
| 556 |
|
| 557 |
+
# OSS Analysis
|
| 558 |
oss_btn.click(
|
| 559 |
+
run_oss_analysis,
|
| 560 |
inputs=[scenario_dropdown],
|
| 561 |
outputs=[results_display]
|
| 562 |
)
|
| 563 |
|
| 564 |
# Enterprise Execution
|
| 565 |
enterprise_btn.click(
|
| 566 |
+
execute_enterprise_healing,
|
| 567 |
inputs=[scenario_dropdown, approval_toggle],
|
| 568 |
outputs=[approval_display, config_display, results_display]
|
| 569 |
)
|
| 570 |
|
| 571 |
# Approval toggle updates config
|
| 572 |
approval_toggle.change(
|
| 573 |
+
lambda approval: {"approval_required": approval, "compliance_mode": "strict"},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 574 |
inputs=[approval_toggle],
|
| 575 |
outputs=[config_display]
|
| 576 |
)
|
| 577 |
|
| 578 |
# ROI Calculation
|
| 579 |
calculate_btn.click(
|
| 580 |
+
calculate_roi,
|
| 581 |
inputs=[monthly_slider, impact_slider, team_slider],
|
| 582 |
outputs=[roi_output]
|
| 583 |
)
|
| 584 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 585 |
# ============ INITIAL LOAD ============
|
| 586 |
+
def load_initial():
|
| 587 |
+
"""Load initial state"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 588 |
return (
|
| 589 |
+
INCIDENT_SCENARIOS["Cache Miss Storm"]["metrics"],
|
| 590 |
+
INCIDENT_SCENARIOS["Cache Miss Storm"]["impact"],
|
| 591 |
+
create_timeline_visualization(),
|
| 592 |
+
create_business_dashboard()
|
|
|
|
| 593 |
)
|
| 594 |
|
| 595 |
demo.load(
|
| 596 |
+
load_initial,
|
| 597 |
+
outputs=[metrics_display, impact_display, timeline_output, dashboard_output]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 598 |
)
|
| 599 |
|
| 600 |
# ============ INSTRUCTIONS ============
|
| 601 |
gr.Markdown(f"""
|
| 602 |
+
<div style='margin-top: 40px; padding-top: 20px; border-top: 1px solid #e2e8f0; color: #718096; font-size: 14px;'>
|
| 603 |
🚀 <b>ARF Ultimate Investor Demo v3.6.0</b> | {'✅ Integrated with ARF OSS v3.3.6' if ARF_OSS_AVAILABLE else '⚠️ Running in simulation mode'}
|
| 604 |
<i>From Cost Center to Profit Engine: 5.2× ROI with Autonomous Reliability</i>
|
| 605 |
</div>
|
|
|
|
| 608 |
return demo
|
| 609 |
|
| 610 |
# ===========================================
|
| 611 |
+
# MAIN
|
| 612 |
# ===========================================
|
| 613 |
|
| 614 |
+
if __name__ == "__main__":
|
|
|
|
| 615 |
logger.info("=" * 80)
|
| 616 |
logger.info("🚀 Launching ARF Investor Demo v3.6.0")
|
| 617 |
logger.info(f"✅ ARF OSS Available: {ARF_OSS_AVAILABLE}")
|
| 618 |
+
logger.info("✅ Standalone version - No module dependencies")
|
|
|
|
|
|
|
| 619 |
logger.info("=" * 80)
|
| 620 |
|
| 621 |
+
demo = create_interface()
|
| 622 |
demo.launch(
|
| 623 |
server_name="0.0.0.0",
|
| 624 |
server_port=7860,
|
| 625 |
share=False,
|
| 626 |
debug=False,
|
| 627 |
show_error=True
|
| 628 |
+
)
|
|
|
|
|
|
|
|
|