Sanjeev12588/ai-sre-copilot

GitHub: Sanjeev12588/ai-sre-copilot

基于多 Agent 架构的 AI 事件响应助手,自动化完成告警分诊、日志分析、根因诊断与恢复方案推荐,帮助 SRE 团队缩短故障处理时间。

Stars: 0 | Forks: 0

# AI SRE Copilot AI SRE Copilot 是一个自主的事件响应助手,能够分析告警、对事件进行分诊、调查日志、诊断根本原因、推荐模拟修复方案,并评估处理结果。 本仓库代表**第一阶段:项目基础**,旨在建立完整的生产级文件夹结构、配置文件和构建环境。 ## 文件夹结构 ``` ai-sre-copilot/ ├── README.md ├── pyproject.toml ├── requirements.txt ├── Dockerfile ├── docker-compose.yml ├── PROJECT_LOG.md ├── .pre-commit-config.yaml ├── .env.example ├── .gitignore ├── .dockerignore │ ├── backend/ # Python FastAPI + ADK Core │ ├── __init__.py │ │ │ ├── agents/ # ADK Agents (State/Lifecycle logic) │ │ ├── __init__.py │ │ ├── agent.py # Exports root_agent │ │ ├── intake.py # Parses alert input │ │ ├── coordinator.py # Orchestrates & updates Case File │ │ ├── triage.py # Severity & scope analyzer │ │ ├── log_analyzer.py # Log anomaly scraper │ │ ├── root_cause.py # RCA generator │ │ ├── evaluator.py # Reviews RCA, assigns trust scores │ │ ├── recovery_planner.py # Recommends runbooks (Simulation) │ │ ├── escalation.py # Pagers / Notifications │ │ └── report_generator.py # Post-mortem & comms drafter │ │ │ ├── mcp_servers/ # MCP Server Implementations │ │ ├── __init__.py │ │ ├── monitoring_server.py # Exposes topology, metrics, logs │ │ └── incident_server.py # Exposes runbooks, simulated actions │ │ │ ├── memory/ # Session & Case File management │ │ ├── __init__.py │ │ └── case_file.py # Incident Case File structure & utils │ │ │ ├── security/ # Input & action guardrails │ │ ├── __init__.py │ │ ├── input_validator.py # Prompt injection validation │ │ └── pii_redactor.py # Sanitizes logs before agents see them │ │ │ └── api/ # FastAPI Router & Websockets │ ├── __init__.py │ ├── main.py # Entry point for FastAPI & Web App │ └── websocket.py # Streaming agent trace updates to React │ ├── frontend/ # React/Vite/TS dashboard │ ├── package.json │ ├── vite.config.ts │ ├── index.html │ ├── src/ │ │ ├── main.tsx │ │ ├── App.tsx │ │ ├── css/ │ │ │ └── styles.css # Curated premium SRE styling │ │ └── components/ │ │ ├── IncidentFeed.tsx # Active/historical incidents list │ │ ├── ReasoningTimeline.tsx # AI Reasoning trace visualization │ │ ├── WhatIfSimulator.tsx # Impact analyzer panel │ │ └── ActionConsole.tsx # Runbook confirmation panel │ └── dist/ # Compiled assets (served by FastAPI) │ ├── docs/ # Project Documentation │ ├── architecture/ │ ├── diagrams/ │ ├── api/ │ ├── screenshots/ │ ├── demo/ │ └── kaggle/ │ └── tests/ # Test Suite ├── __init__.py ├── test_agents.py ├── test_mcp.py └── test_security.py ``` ## 前置条件 请确保您的主机系统上已安装以下内容: 1. **Python 3.11 或更高版本** 2. **uv** (Python 包管理器) 3. **Node.js v18+** 和 **npm** 4. 来自 [Google AI Studio](https://aistudio.google.com/apikey) 的 **Gemini API Key** ## 设置与安装 1. 克隆仓库并进入根目录: cd ai-sre-copilot 2. 复制环境模板并配置您的 API key: cp .env.example .env # 打开 .env 并添加您的 GOOGLE_API_KEY 3. 设置 Python 虚拟环境并同步依赖项: uv sync 4. 为 React 前端安装 Node 依赖项: cd frontend npm install cd .. ## 本地运行应用程序 ### 运行 Python 后端(开发模式) 在本地启动 FastAPI Web 服务器: ``` uv run uvicorn backend.api.main:app --reload --port 8000 ``` API 端点将可以通过 `http://127.0.0.1:8000` 访问。 ### 运行 React 前端(开发模式) 启动支持热重载的 Vite 开发服务器: ``` cd frontend npm run dev ``` React 开发界面将可以通过 `http://localhost:5173` 访问。 ### 使用 Docker 运行 构建并运行整个容器化的技术栈: ``` docker build -t ai-sre-copilot . docker run -p 8000:8000 --env-file .env ai-sre-copilot ``` ## Lint 与格式化 验证 Python 代码语法、导入、格式化和样式指南: ``` # Lint check uv run ruff check backend tests # Format check uv run ruff format --check backend tests ``` 自动修复格式/lint 问题: ``` uv run ruff check backend tests --fix uv run ruff format backend tests ```
标签:AIOps, AV绕过, FastAPI, LLM代理, React, SRE, Syscalls, 偏差过滤, 智能运维, 根因分析, 请求拦截, 逆向工具