File size: 1,404 Bytes
56e46b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
SRE Agent — Gradio Web Interface

A production-grade SRE (Site Reliability Engineering) Agent system
powered by smolagents with multi-agent orchestration.

Features:
- 16 specialized SRE tools across 6 categories
- Multi-agent architecture (Manager + 4 specialist agents)
- Time-series anomaly detection (Z-score, Isolation Forest)
- Root cause analysis with multi-signal correlation
- Log analysis with pattern extraction
- SLO checking, alert management, runbook search
- Full incident report generation
"""

import os
import gradio as gr
from smolagents import GradioUI
from sre_agent import create_sre_agent


def main():
    model_id = os.environ.get("MODEL_ID", "Qwen/Qwen2.5-Coder-32B-Instruct")
    verbose = int(os.environ.get("VERBOSE", "1"))
    
    print(f"🚀 Initializing SRE Agent with model: {model_id}")
    print("📦 Creating multi-agent system...")
    
    agent = create_sre_agent(model_id=model_id, verbose=verbose)
    
    print("✅ SRE Agent ready!")
    print(f"   - Manager: CodeAgent (planning_interval=3, max_steps=20)")
    print(f"   - Sub-agents: metrics_analysis, log_analysis, rca, infrastructure")
    print(f"   - Tools: 16 specialized SRE tools")
    
    # Use smolagents' built-in GradioUI
    ui = GradioUI(agent)
    ui.launch(
        server_name="0.0.0.0",
        server_port=7860,
        share=False,
    )


if __name__ == "__main__":
    main()