Update ui/components.py
Browse files- ui/components.py +490 -55
ui/components.py
CHANGED
|
@@ -12,98 +12,522 @@ from demo.scenarios import INCIDENT_SCENARIOS
|
|
| 12 |
# -----------------------------
|
| 13 |
def create_header(version="3.3.6", mock_mode=False) -> gr.HTML:
|
| 14 |
mock_text = " · MOCK MODE" if mock_mode else ""
|
| 15 |
-
return gr.HTML(f"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
def create_status_bar() -> gr.HTML:
|
| 18 |
-
return gr.HTML(
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
# -----------------------------
|
| 23 |
-
# Tab 1: Incident Demo
|
| 24 |
# -----------------------------
|
| 25 |
def create_tab1_incident_demo(scenarios=INCIDENT_SCENARIOS, default_scenario="Cache Miss Storm") -> tuple:
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
return (
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
)
|
| 46 |
|
| 47 |
# -----------------------------
|
| 48 |
-
# Tab 2: Business ROI
|
| 49 |
# -----------------------------
|
| 50 |
def create_tab2_business_roi(scenarios=INCIDENT_SCENARIOS) -> tuple:
|
| 51 |
-
dashboard_output = gr.
|
| 52 |
-
roi_scenario_dropdown = gr.Dropdown(
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
return (dashboard_output, roi_scenario_dropdown, monthly_slider, team_slider,
|
| 60 |
calculate_btn, roi_output, roi_chart)
|
| 61 |
|
| 62 |
# -----------------------------
|
| 63 |
-
# Tab 3: Enterprise Features
|
| 64 |
# -----------------------------
|
| 65 |
def create_tab3_enterprise_features() -> tuple:
|
| 66 |
-
license_display = gr.
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
return (license_display, validate_btn, trial_btn, upgrade_btn,
|
| 77 |
mcp_mode, mcp_mode_info, features_table, integrations_table)
|
| 78 |
|
| 79 |
# -----------------------------
|
| 80 |
-
# Tab 4: Audit Trail
|
| 81 |
# -----------------------------
|
| 82 |
def create_tab4_audit_trail() -> tuple:
|
| 83 |
-
refresh_btn = gr.Button("Refresh")
|
| 84 |
-
clear_btn = gr.Button("Clear History")
|
| 85 |
-
export_btn = gr.Button("Export")
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
-
execution_table = gr.Dataframe(
|
| 88 |
-
|
| 89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
return (refresh_btn, clear_btn, export_btn, execution_table, incident_table, export_text)
|
| 92 |
|
| 93 |
# -----------------------------
|
| 94 |
-
# Tab 5: Learning Engine
|
| 95 |
# -----------------------------
|
| 96 |
def create_tab5_learning_engine() -> tuple:
|
| 97 |
-
learning_graph = gr.Plot()
|
| 98 |
-
graph_type = gr.Dropdown(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
show_labels = gr.Checkbox(label="Show Labels", value=True)
|
| 100 |
-
search_query = gr.Textbox(label="Search Patterns")
|
| 101 |
-
search_btn = gr.Button("Search")
|
| 102 |
-
clear_btn_search = gr.Button("Clear Search")
|
| 103 |
-
search_results = gr.
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
return (learning_graph, graph_type, show_labels, search_query, search_btn,
|
| 109 |
clear_btn_search, search_results, stats_display, patterns_display, performance_display)
|
|
@@ -112,4 +536,15 @@ def create_tab5_learning_engine() -> tuple:
|
|
| 112 |
# Footer
|
| 113 |
# -----------------------------
|
| 114 |
def create_footer() -> gr.HTML:
|
| 115 |
-
return gr.HTML("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
# -----------------------------
|
| 13 |
def create_header(version="3.3.6", mock_mode=False) -> gr.HTML:
|
| 14 |
mock_text = " · MOCK MODE" if mock_mode else ""
|
| 15 |
+
return gr.HTML(f"""
|
| 16 |
+
<div class="header-section">
|
| 17 |
+
<h1 style="margin: 0 0 10px 0; font-size: 32px;">🚀 Agentic Reliability Framework</h1>
|
| 18 |
+
<h2 style="margin: 0; font-size: 24px; opacity: 0.9;">v{version} (OSS Edition){mock_text}</h2>
|
| 19 |
+
<p style="margin: 15px 0 0 0; font-size: 16px; opacity: 0.8;">
|
| 20 |
+
Production-grade multi-agent AI for autonomous system reliability intelligence
|
| 21 |
+
</p>
|
| 22 |
+
</div>
|
| 23 |
+
""")
|
| 24 |
|
| 25 |
def create_status_bar() -> gr.HTML:
|
| 26 |
+
return gr.HTML("""
|
| 27 |
+
<div class="status-bar">
|
| 28 |
+
<span class="status-item active">✅ System Online</span>
|
| 29 |
+
<span class="status-item active">🧠 Agentic Core Active</span>
|
| 30 |
+
<span class="status-item active">📦 OSS Mode (Advisory Only)</span>
|
| 31 |
+
<span class="status-item active">🔒 MCP Safety Enabled</span>
|
| 32 |
+
<span class="status-item">💰 <a href="#tab2" style="color: #10b981; text-decoration: underline;">Enterprise ROI: 5.2×</a></span>
|
| 33 |
+
</div>
|
| 34 |
+
""")
|
| 35 |
|
| 36 |
# -----------------------------
|
| 37 |
+
# Tab 1: Live Incident Demo - ENHANCED VERSION
|
| 38 |
# -----------------------------
|
| 39 |
def create_tab1_incident_demo(scenarios=INCIDENT_SCENARIOS, default_scenario="Cache Miss Storm") -> tuple:
|
| 40 |
+
"""
|
| 41 |
+
Create an expressive, comprehensive incident demo tab for ARF.
|
| 42 |
+
Shows the complete OSS analysis → Enterprise execution workflow.
|
| 43 |
+
"""
|
| 44 |
+
|
| 45 |
+
# Left Column: Scenario Selection & Live Visualization
|
| 46 |
+
with gr.Column(scale=1, variant="panel") as left_col:
|
| 47 |
+
# Scenario Selection with rich preview
|
| 48 |
+
scenario_dropdown = gr.Dropdown(
|
| 49 |
+
choices=list(scenarios.keys()),
|
| 50 |
+
value=default_scenario,
|
| 51 |
+
label="🎯 Select Incident Scenario",
|
| 52 |
+
info="Choose a production incident to analyze",
|
| 53 |
+
interactive=True,
|
| 54 |
+
container=False
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
# Scenario Card with rich information
|
| 58 |
+
scenario_card = gr.HTML("""
|
| 59 |
+
<div class="scenario-card">
|
| 60 |
+
<div class="scenario-header">
|
| 61 |
+
<h3>🚨 Cache Miss Storm</h3>
|
| 62 |
+
<span class="severity-badge high">HIGH</span>
|
| 63 |
+
</div>
|
| 64 |
+
<div class="scenario-details">
|
| 65 |
+
<div class="scenario-detail-row">
|
| 66 |
+
<span class="detail-label">Component:</span>
|
| 67 |
+
<span class="detail-value">Redis Cache Cluster</span>
|
| 68 |
+
</div>
|
| 69 |
+
<div class="scenario-detail-row">
|
| 70 |
+
<span class="detail-label">Impact Radius:</span>
|
| 71 |
+
<span class="detail-value">85% of users</span>
|
| 72 |
+
</div>
|
| 73 |
+
<div class="scenario-detail-row">
|
| 74 |
+
<span class="detail-label">Revenue Risk:</span>
|
| 75 |
+
<span class="detail-value revenue-risk">$8,500/hour</span>
|
| 76 |
+
</div>
|
| 77 |
+
<div class="scenario-detail-row">
|
| 78 |
+
<span class="detail-label">Detection Time:</span>
|
| 79 |
+
<span class="detail-value">45 seconds</span>
|
| 80 |
+
</div>
|
| 81 |
+
<div class="scenario-tags">
|
| 82 |
+
<span class="scenario-tag">cache</span>
|
| 83 |
+
<span class="scenario-tag">redis</span>
|
| 84 |
+
<span class="scenario-tag">latency</span>
|
| 85 |
+
<span class="scenario-tag">scaling</span>
|
| 86 |
+
</div>
|
| 87 |
+
</div>
|
| 88 |
+
</div>
|
| 89 |
+
""")
|
| 90 |
+
|
| 91 |
+
# Live Telemetry Visualization
|
| 92 |
+
telemetry_header = gr.Markdown("### 📈 Live Telemetry")
|
| 93 |
+
telemetry_viz = gr.Plot(label="", show_label=False)
|
| 94 |
+
|
| 95 |
+
# Business Impact Visualization
|
| 96 |
+
impact_header = gr.Markdown("### 💰 Business Impact")
|
| 97 |
+
impact_viz = gr.Plot(label="", show_label=False)
|
| 98 |
|
| 99 |
+
# Middle Column: Agent Workflow
|
| 100 |
+
with gr.Column(scale=2, variant="panel") as middle_col:
|
| 101 |
+
# Agent Workflow Header
|
| 102 |
+
workflow_header = gr.Markdown("## 🔄 ARF Agent Workflow")
|
| 103 |
+
workflow_subheader = gr.Markdown("### How ARF transforms incidents into autonomous healing")
|
| 104 |
+
|
| 105 |
+
# Agent Status Cards
|
| 106 |
+
with gr.Row():
|
| 107 |
+
detection_agent = gr.HTML("""
|
| 108 |
+
<div class="agent-card detection">
|
| 109 |
+
<div class="agent-icon">🕵️♂️</div>
|
| 110 |
+
<div class="agent-content">
|
| 111 |
+
<h4>Detection Agent</h4>
|
| 112 |
+
<p class="agent-status-text">Anomaly detected: <strong>99.8% confidence</strong></p>
|
| 113 |
+
<div class="agent-metrics">
|
| 114 |
+
<span class="agent-metric">Response: 45s</span>
|
| 115 |
+
<span class="agent-metric">Accuracy: 98.7%</span>
|
| 116 |
+
</div>
|
| 117 |
+
<div class="agent-status active">ACTIVE</div>
|
| 118 |
+
</div>
|
| 119 |
+
</div>
|
| 120 |
+
""")
|
| 121 |
+
|
| 122 |
+
recall_agent = gr.HTML("""
|
| 123 |
+
<div class="agent-card recall">
|
| 124 |
+
<div class="agent-icon">🧠</div>
|
| 125 |
+
<div class="agent-content">
|
| 126 |
+
<h4>Recall Agent</h4>
|
| 127 |
+
<p class="agent-status-text"><strong>3 similar incidents</strong> found in RAG memory</p>
|
| 128 |
+
<div class="agent-metrics">
|
| 129 |
+
<span class="agent-metric">Recall: 92%</span>
|
| 130 |
+
<span class="agent-metric">Context: 5 patterns</span>
|
| 131 |
+
</div>
|
| 132 |
+
<div class="agent-status active">ACTIVE</div>
|
| 133 |
+
</div>
|
| 134 |
+
</div>
|
| 135 |
+
""")
|
| 136 |
+
|
| 137 |
+
decision_agent = gr.HTML("""
|
| 138 |
+
<div class="agent-card decision">
|
| 139 |
+
<div class="agent-icon">🎯</div>
|
| 140 |
+
<div class="agent-content">
|
| 141 |
+
<h4>Decision Agent</h4>
|
| 142 |
+
<p class="agent-status-text">Generating healing intent with <strong>94% confidence</strong></p>
|
| 143 |
+
<div class="agent-metrics">
|
| 144 |
+
<span class="agent-metric">Success Rate: 87%</span>
|
| 145 |
+
<span class="agent-metric">Safety: 100%</span>
|
| 146 |
+
</div>
|
| 147 |
+
<div class="agent-status active">ACTIVE</div>
|
| 148 |
+
</div>
|
| 149 |
+
</div>
|
| 150 |
+
""")
|
| 151 |
+
|
| 152 |
+
# OSS vs Enterprise Boundary Visualization
|
| 153 |
+
boundary_header = gr.Markdown("### 🎭 OSS vs Enterprise: The Safety Boundary")
|
| 154 |
+
|
| 155 |
+
with gr.Row():
|
| 156 |
+
oss_section = gr.HTML("""
|
| 157 |
+
<div class="oss-section">
|
| 158 |
+
<div class="edition-header">
|
| 159 |
+
<div class="edition-icon">🆓</div>
|
| 160 |
+
<h3>OSS Edition</h3>
|
| 161 |
+
<span class="edition-badge">Apache 2.0</span>
|
| 162 |
+
</div>
|
| 163 |
+
<div class="edition-description">
|
| 164 |
+
<p><strong>Analysis & Advisory Only</strong> - No execution, permanently safe</p>
|
| 165 |
+
</div>
|
| 166 |
+
<div class="boundary-content">
|
| 167 |
+
<div class="intent-card">
|
| 168 |
+
<div class="intent-header">
|
| 169 |
+
<h4>📝 Healing Intent Created</h4>
|
| 170 |
+
<span class="intent-confidence">94% confidence</span>
|
| 171 |
+
</div>
|
| 172 |
+
<div class="intent-details">
|
| 173 |
+
<p><strong>Action:</strong> Scale Redis cluster from 3 to 5 nodes</p>
|
| 174 |
+
<p><strong>Pattern Match:</strong> Similar incident resolved with scaling (87% success rate)</p>
|
| 175 |
+
<p><strong>Safety Check:</strong> ✅ Passed (blast radius: 2 services)</p>
|
| 176 |
+
<p><strong>Estimated Impact:</strong> Reduce MTTR from 45min to 12min</p>
|
| 177 |
+
</div>
|
| 178 |
+
<div class="boundary-stop">
|
| 179 |
+
<div class="stop-line"></div>
|
| 180 |
+
<div class="stop-text">🚫 OSS STOPS HERE - No execution</div>
|
| 181 |
+
<div class="stop-line"></div>
|
| 182 |
+
</div>
|
| 183 |
+
</div>
|
| 184 |
+
</div>
|
| 185 |
+
</div>
|
| 186 |
+
""")
|
| 187 |
+
|
| 188 |
+
enterprise_section = gr.HTML("""
|
| 189 |
+
<div class="enterprise-section">
|
| 190 |
+
<div class="edition-header">
|
| 191 |
+
<div class="edition-icon">💰</div>
|
| 192 |
+
<h3>Enterprise Edition</h3>
|
| 193 |
+
<span class="edition-badge">Commercial</span>
|
| 194 |
+
</div>
|
| 195 |
+
<div class="edition-description">
|
| 196 |
+
<p><strong>Full Execution & Learning</strong> - Autonomous healing with safety guarantees</p>
|
| 197 |
+
</div>
|
| 198 |
+
<div class="boundary-content">
|
| 199 |
+
<div class="execution-card">
|
| 200 |
+
<div class="execution-header">
|
| 201 |
+
<h4>⚡ Ready to Execute</h4>
|
| 202 |
+
<span class="execution-mode autonomous">AUTONOMOUS</span>
|
| 203 |
+
</div>
|
| 204 |
+
<div class="execution-details">
|
| 205 |
+
<p><strong>Mode:</strong> Autonomous (Requires Enterprise license)</p>
|
| 206 |
+
<p><strong>Expected Recovery:</strong> 12 minutes (vs 45 min manual)</p>
|
| 207 |
+
<p><strong>Cost Saved:</strong> <span class="savings-highlight">$6,375</span></p>
|
| 208 |
+
<p><strong>Users Protected:</strong> 45,000 → 0 impacted</p>
|
| 209 |
+
</div>
|
| 210 |
+
<div class="boundary-start">
|
| 211 |
+
<div class="start-line"></div>
|
| 212 |
+
<div class="start-text">✅ Enterprise executes with MCP safety</div>
|
| 213 |
+
<div class="start-line"></div>
|
| 214 |
+
</div>
|
| 215 |
+
</div>
|
| 216 |
+
</div>
|
| 217 |
+
</div>
|
| 218 |
+
""")
|
| 219 |
+
|
| 220 |
+
# Execution Controls
|
| 221 |
+
with gr.Row():
|
| 222 |
+
with gr.Column(scale=1):
|
| 223 |
+
oss_btn = gr.Button(
|
| 224 |
+
"🆓 Run OSS Analysis",
|
| 225 |
+
variant="secondary",
|
| 226 |
+
size="lg",
|
| 227 |
+
elem_classes="oss-btn"
|
| 228 |
+
)
|
| 229 |
+
oss_info = gr.Markdown("*Free, open-source analysis*", elem_classes="button-info")
|
| 230 |
+
|
| 231 |
+
with gr.Column(scale=1):
|
| 232 |
+
enterprise_btn = gr.Button(
|
| 233 |
+
"💰 Execute Enterprise Healing",
|
| 234 |
+
variant="primary",
|
| 235 |
+
size="lg",
|
| 236 |
+
elem_classes="enterprise-btn"
|
| 237 |
+
)
|
| 238 |
+
enterprise_info = gr.Markdown("*Requires Enterprise license*", elem_classes="button-info")
|
| 239 |
+
|
| 240 |
+
# Mode Selection & Safety Controls
|
| 241 |
+
with gr.Row():
|
| 242 |
+
with gr.Column(scale=1):
|
| 243 |
+
approval_toggle = gr.CheckboxGroup(
|
| 244 |
+
choices=["👤 Require Human Approval"],
|
| 245 |
+
label="Safety Controls",
|
| 246 |
+
value=[],
|
| 247 |
+
info="Toggle human oversight"
|
| 248 |
+
)
|
| 249 |
+
|
| 250 |
+
with gr.Column(scale=2):
|
| 251 |
+
mcp_mode = gr.Radio(
|
| 252 |
+
choices=["🛡️ Advisory (OSS Only)", "👥 Approval", "⚡ Autonomous"],
|
| 253 |
+
value="🛡️ Advisory (OSS Only)",
|
| 254 |
+
label="MCP Safety Mode",
|
| 255 |
+
info="Control execution safety level",
|
| 256 |
+
interactive=True
|
| 257 |
+
)
|
| 258 |
+
|
| 259 |
+
# Timeline Visualization
|
| 260 |
+
timeline_header = gr.Markdown("### ⏰ Incident Timeline")
|
| 261 |
+
timeline_viz = gr.Plot(label="", show_label=False)
|
| 262 |
|
| 263 |
+
# Right Column: Results & Metrics
|
| 264 |
+
with gr.Column(scale=1, variant="panel") as right_col:
|
| 265 |
+
# Real-time Metrics Dashboard
|
| 266 |
+
metrics_header = gr.Markdown("## 📊 Performance Metrics")
|
| 267 |
+
|
| 268 |
+
# Metric Cards Grid
|
| 269 |
+
with gr.Row():
|
| 270 |
+
detection_time = gr.HTML("""
|
| 271 |
+
<div class="metric-card detection">
|
| 272 |
+
<div class="metric-icon">⏱️</div>
|
| 273 |
+
<div class="metric-content">
|
| 274 |
+
<h4>Detection Time</h4>
|
| 275 |
+
<p class="metric-value">45s</p>
|
| 276 |
+
<p class="metric-comparison">↓ 89% faster than average</p>
|
| 277 |
+
</div>
|
| 278 |
+
</div>
|
| 279 |
+
""")
|
| 280 |
+
|
| 281 |
+
mttr = gr.HTML("""
|
| 282 |
+
<div class="metric-card mttr">
|
| 283 |
+
<div class="metric-icon">⚡</div>
|
| 284 |
+
<div class="metric-content">
|
| 285 |
+
<h4>Mean Time to Resolve</h4>
|
| 286 |
+
<p class="metric-value">12m</p>
|
| 287 |
+
<p class="metric-comparison">↓ 73% faster than manual</p>
|
| 288 |
+
</div>
|
| 289 |
+
</div>
|
| 290 |
+
""")
|
| 291 |
+
|
| 292 |
+
with gr.Row():
|
| 293 |
+
auto_heal = gr.HTML("""
|
| 294 |
+
<div class="metric-card auto-heal">
|
| 295 |
+
<div class="metric-icon">🤖</div>
|
| 296 |
+
<div class="metric-content">
|
| 297 |
+
<h4>Auto-Heal Rate</h4>
|
| 298 |
+
<p class="metric-value">81.7%</p>
|
| 299 |
+
<p class="metric-comparison">↑ 5.4× industry average</p>
|
| 300 |
+
</div>
|
| 301 |
+
</div>
|
| 302 |
+
""")
|
| 303 |
+
|
| 304 |
+
savings = gr.HTML("""
|
| 305 |
+
<div class="metric-card savings">
|
| 306 |
+
<div class="metric-icon">💰</div>
|
| 307 |
+
<div class="metric-content">
|
| 308 |
+
<h4>Cost Saved</h4>
|
| 309 |
+
<p class="metric-value">$6.3K</p>
|
| 310 |
+
<p class="metric-comparison">Per incident avoided</p>
|
| 311 |
+
</div>
|
| 312 |
+
</div>
|
| 313 |
+
""")
|
| 314 |
+
|
| 315 |
+
# Results Display Areas
|
| 316 |
+
oss_results_header = gr.Markdown("### 🆓 OSS Analysis Results")
|
| 317 |
+
oss_results_display = gr.JSON(
|
| 318 |
+
label="",
|
| 319 |
+
value={
|
| 320 |
+
"status": "Analysis Pending",
|
| 321 |
+
"agents": ["Detection", "Recall", "Decision"],
|
| 322 |
+
"mode": "Advisory Only",
|
| 323 |
+
"action": "Generate HealingIntent"
|
| 324 |
+
},
|
| 325 |
+
height=200
|
| 326 |
+
)
|
| 327 |
+
|
| 328 |
+
enterprise_results_header = gr.Markdown("### 💰 Enterprise Results")
|
| 329 |
+
enterprise_results_display = gr.JSON(
|
| 330 |
+
label="",
|
| 331 |
+
value={
|
| 332 |
+
"status": "Execution Pending",
|
| 333 |
+
"requires_license": True,
|
| 334 |
+
"available_modes": ["Approval", "Autonomous"],
|
| 335 |
+
"expected_outcome": "12m MTTR, $6.3K saved"
|
| 336 |
+
},
|
| 337 |
+
height=200
|
| 338 |
+
)
|
| 339 |
+
|
| 340 |
+
# Approval Status
|
| 341 |
+
approval_display = gr.HTML("""
|
| 342 |
+
<div class="approval-status">
|
| 343 |
+
<div class="approval-header">
|
| 344 |
+
<h4>👤 Human Approval Status</h4>
|
| 345 |
+
<span class="approval-badge not-required">Not Required</span>
|
| 346 |
+
</div>
|
| 347 |
+
<div class="approval-content">
|
| 348 |
+
<p><strong>Current Mode:</strong> Advisory (OSS Only)</p>
|
| 349 |
+
<p><em>Switch to "Approval" mode to enable human-in-the-loop workflows</em></p>
|
| 350 |
+
<div class="approval-workflow">
|
| 351 |
+
<div class="workflow-step">1. ARF generates intent</div>
|
| 352 |
+
<div class="workflow-step">2. Human reviews & approves</div>
|
| 353 |
+
<div class="workflow-step">3. ARF executes safely</div>
|
| 354 |
+
</div>
|
| 355 |
+
</div>
|
| 356 |
+
</div>
|
| 357 |
+
""")
|
| 358 |
+
|
| 359 |
+
# Demo Actions
|
| 360 |
+
demo_btn = gr.Button(
|
| 361 |
+
"▶️ Run Complete Demo Walkthrough",
|
| 362 |
+
variant="secondary",
|
| 363 |
+
size="lg",
|
| 364 |
+
full_width=True
|
| 365 |
+
)
|
| 366 |
+
demo_info = gr.Markdown("*Experience the full ARF workflow from detection to resolution*",
|
| 367 |
+
elem_classes="demo-info")
|
| 368 |
|
| 369 |
return (
|
| 370 |
+
# Left column returns
|
| 371 |
+
scenario_dropdown, scenario_card, telemetry_viz, impact_viz,
|
| 372 |
+
# Middle column returns
|
| 373 |
+
workflow_header, detection_agent, recall_agent, decision_agent,
|
| 374 |
+
oss_section, enterprise_section, oss_btn, enterprise_btn,
|
| 375 |
+
approval_toggle, mcp_mode, timeline_viz,
|
| 376 |
+
# Right column returns
|
| 377 |
+
detection_time, mttr, auto_heal, savings,
|
| 378 |
+
oss_results_display, enterprise_results_display, approval_display, demo_btn
|
| 379 |
)
|
| 380 |
|
| 381 |
# -----------------------------
|
| 382 |
+
# Tab 2: Business ROI - Updated to match new return signature
|
| 383 |
# -----------------------------
|
| 384 |
def create_tab2_business_roi(scenarios=INCIDENT_SCENARIOS) -> tuple:
|
| 385 |
+
dashboard_output = gr.Plot(label="Executive Dashboard", show_label=True)
|
| 386 |
+
roi_scenario_dropdown = gr.Dropdown(
|
| 387 |
+
choices=list(scenarios.keys()),
|
| 388 |
+
value="Cache Miss Storm",
|
| 389 |
+
label="Scenario for ROI Analysis",
|
| 390 |
+
info="Select the primary incident type for ROI calculation"
|
| 391 |
+
)
|
| 392 |
+
monthly_slider = gr.Slider(
|
| 393 |
+
minimum=1,
|
| 394 |
+
maximum=50,
|
| 395 |
+
value=15,
|
| 396 |
+
step=1,
|
| 397 |
+
label="Monthly Incidents",
|
| 398 |
+
info="Average number of incidents per month"
|
| 399 |
+
)
|
| 400 |
+
team_slider = gr.Slider(
|
| 401 |
+
minimum=1,
|
| 402 |
+
maximum=50,
|
| 403 |
+
value=5,
|
| 404 |
+
step=1,
|
| 405 |
+
label="Team Size",
|
| 406 |
+
info="Number of engineers on reliability team"
|
| 407 |
+
)
|
| 408 |
+
calculate_btn = gr.Button("📊 Calculate Comprehensive ROI", variant="primary", size="lg")
|
| 409 |
+
roi_output = gr.JSON(label="ROI Analysis Results", value={})
|
| 410 |
+
roi_chart = gr.Plot(label="ROI Visualization")
|
| 411 |
|
| 412 |
return (dashboard_output, roi_scenario_dropdown, monthly_slider, team_slider,
|
| 413 |
calculate_btn, roi_output, roi_chart)
|
| 414 |
|
| 415 |
# -----------------------------
|
| 416 |
+
# Tab 3: Enterprise Features - Updated
|
| 417 |
# -----------------------------
|
| 418 |
def create_tab3_enterprise_features() -> tuple:
|
| 419 |
+
license_display = gr.JSON(
|
| 420 |
+
value={"status": "🆓 OSS Mode Active", "features": ["Advisory Analysis", "RAG Memory", "HealingIntent"]},
|
| 421 |
+
label="License Status"
|
| 422 |
+
)
|
| 423 |
+
validate_btn = gr.Button("🔍 Validate License", variant="secondary")
|
| 424 |
+
trial_btn = gr.Button("🆓 Start 30-Day Trial", variant="secondary")
|
| 425 |
+
upgrade_btn = gr.Button("🚀 Upgrade to Enterprise", variant="primary")
|
| 426 |
+
|
| 427 |
+
mcp_mode = gr.Dropdown(
|
| 428 |
+
choices=["advisory", "approval", "autonomous"],
|
| 429 |
+
value="advisory",
|
| 430 |
+
label="MCP Safety Mode"
|
| 431 |
+
)
|
| 432 |
+
mcp_mode_info = gr.JSON(
|
| 433 |
+
value={
|
| 434 |
+
"current_mode": "advisory",
|
| 435 |
+
"description": "OSS Edition - Analysis only, no execution",
|
| 436 |
+
"features": ["Incident analysis", "RAG similarity", "HealingIntent creation"]
|
| 437 |
+
},
|
| 438 |
+
label="Mode Details"
|
| 439 |
+
)
|
| 440 |
+
|
| 441 |
+
features_data = [
|
| 442 |
+
["Self-Healing Core", "✅ Active", "Enterprise"],
|
| 443 |
+
["RAG Graph Memory", "✅ Active", "Both"],
|
| 444 |
+
["Predictive Analytics", "🔒 Enterprise", "Enterprise"],
|
| 445 |
+
["Audit Trail", "🔒 Enterprise", "Enterprise"],
|
| 446 |
+
["Compliance (SOC2)", "🔒 Enterprise", "Enterprise"],
|
| 447 |
+
["Multi-Cloud", "🔒 Enterprise", "Enterprise"]
|
| 448 |
+
]
|
| 449 |
+
|
| 450 |
+
integrations_data = [
|
| 451 |
+
["Prometheus", "✅ Connected", "Monitoring"],
|
| 452 |
+
["Grafana", "✅ Connected", "Visualization"],
|
| 453 |
+
["Slack", "🔒 Enterprise", "Notifications"],
|
| 454 |
+
["PagerDuty", "🔒 Enterprise", "Alerting"],
|
| 455 |
+
["Jira", "🔒 Enterprise", "Ticketing"],
|
| 456 |
+
["Datadog", "🔒 Enterprise", "Monitoring"]
|
| 457 |
+
]
|
| 458 |
|
| 459 |
+
features_table = gr.Dataframe(
|
| 460 |
+
headers=["Feature", "Status", "Edition"],
|
| 461 |
+
value=features_data,
|
| 462 |
+
label="Feature Comparison"
|
| 463 |
+
)
|
| 464 |
+
integrations_table = gr.Dataframe(
|
| 465 |
+
headers=["Integration", "Status", "Type"],
|
| 466 |
+
value=integrations_data,
|
| 467 |
+
label="Integration Status"
|
| 468 |
+
)
|
| 469 |
|
| 470 |
return (license_display, validate_btn, trial_btn, upgrade_btn,
|
| 471 |
mcp_mode, mcp_mode_info, features_table, integrations_table)
|
| 472 |
|
| 473 |
# -----------------------------
|
| 474 |
+
# Tab 4: Audit Trail - Updated
|
| 475 |
# -----------------------------
|
| 476 |
def create_tab4_audit_trail() -> tuple:
|
| 477 |
+
refresh_btn = gr.Button("🔄 Refresh Audit Trail", variant="secondary")
|
| 478 |
+
clear_btn = gr.Button("🗑️ Clear History", variant="secondary")
|
| 479 |
+
export_btn = gr.Button("📥 Export as JSON", variant="primary")
|
| 480 |
+
|
| 481 |
+
execution_headers = ["Time", "Scenario", "Mode", "Status", "Savings", "Details"]
|
| 482 |
+
incident_headers = ["Time", "Component", "Scenario", "Severity", "Status"]
|
| 483 |
|
| 484 |
+
execution_table = gr.Dataframe(
|
| 485 |
+
headers=execution_headers,
|
| 486 |
+
value=[],
|
| 487 |
+
label="Execution History"
|
| 488 |
+
)
|
| 489 |
+
incident_table = gr.Dataframe(
|
| 490 |
+
headers=incident_headers,
|
| 491 |
+
value=[],
|
| 492 |
+
label="Incident History"
|
| 493 |
+
)
|
| 494 |
+
export_text = gr.JSON(
|
| 495 |
+
value={"status": "Export ready"},
|
| 496 |
+
label="Export Data"
|
| 497 |
+
)
|
| 498 |
|
| 499 |
return (refresh_btn, clear_btn, export_btn, execution_table, incident_table, export_text)
|
| 500 |
|
| 501 |
# -----------------------------
|
| 502 |
+
# Tab 5: Learning Engine - Updated
|
| 503 |
# -----------------------------
|
| 504 |
def create_tab5_learning_engine() -> tuple:
|
| 505 |
+
learning_graph = gr.Plot(label="RAG Memory Graph")
|
| 506 |
+
graph_type = gr.Dropdown(
|
| 507 |
+
choices=["Incident Patterns", "Action-Outcome Chains", "System Dependencies"],
|
| 508 |
+
value="Incident Patterns",
|
| 509 |
+
label="Graph Type"
|
| 510 |
+
)
|
| 511 |
show_labels = gr.Checkbox(label="Show Labels", value=True)
|
| 512 |
+
search_query = gr.Textbox(label="Search Patterns", placeholder="Enter pattern to search...")
|
| 513 |
+
search_btn = gr.Button("🔍 Search Patterns", variant="secondary")
|
| 514 |
+
clear_btn_search = gr.Button("🗑️ Clear Search", variant="secondary")
|
| 515 |
+
search_results = gr.JSON(
|
| 516 |
+
value={"status": "Ready for search"},
|
| 517 |
+
label="Search Results"
|
| 518 |
+
)
|
| 519 |
+
stats_display = gr.JSON(
|
| 520 |
+
value={"patterns": 42, "incidents": 156, "success_rate": "87.3%"},
|
| 521 |
+
label="Learning Statistics"
|
| 522 |
+
)
|
| 523 |
+
patterns_display = gr.JSON(
|
| 524 |
+
value={"common_patterns": ["cache_storm", "db_pool", "memory_leak"]},
|
| 525 |
+
label="Pattern Library"
|
| 526 |
+
)
|
| 527 |
+
performance_display = gr.JSON(
|
| 528 |
+
value={"accuracy": "94.2%", "recall": "89.7%", "precision": "92.1%"},
|
| 529 |
+
label="Agent Performance"
|
| 530 |
+
)
|
| 531 |
|
| 532 |
return (learning_graph, graph_type, show_labels, search_query, search_btn,
|
| 533 |
clear_btn_search, search_results, stats_display, patterns_display, performance_display)
|
|
|
|
| 536 |
# Footer
|
| 537 |
# -----------------------------
|
| 538 |
def create_footer() -> gr.HTML:
|
| 539 |
+
return gr.HTML("""
|
| 540 |
+
<div class="footer">
|
| 541 |
+
<p><strong>Agentic Reliability Framework</strong> © 2025</p>
|
| 542 |
+
<p>Production-grade multi-agent AI for autonomous system reliability intelligence</p>
|
| 543 |
+
<div class="footer-links">
|
| 544 |
+
<a href="https://github.com/petterjuan/agentic-reliability-framework" target="_blank">GitHub</a> •
|
| 545 |
+
<a href="https://huggingface.co/spaces/petter2025/agentic-reliability-framework" target="_blank">Demo</a> •
|
| 546 |
+
<a href="https://pypi.org/project/agentic-reliability-framework" target="_blank">PyPI</a> •
|
| 547 |
+
<a href="mailto:sales@arf.dev">Enterprise Inquiries</a>
|
| 548 |
+
</div>
|
| 549 |
+
</div>
|
| 550 |
+
""")
|