Content
# Tool List
[](LICENSE)
[](https://www.python.org/)
[](https://vuejs.org/)
[](https://fastapi.tiangolo.com/)
[](https://langchain-ai.github.io/langgraph/)
Enterprise-level RAG knowledge base question answering system, and an AIOps operation and maintenance diagnosis Agent built on top of it. The former supports multi-format document parsing, segmentation, vectorized storage, intelligent Q&A, and automated evaluation; the latter demonstrates autonomous fault diagnosis through the **Plan-Execute-Replan** workflow + **MCP protocol** tools.
## 🌟 Core Features
### 1. 📚 Multi-modal Knowledge Base Management
- **Multi-format support**: Supports various file formats such as PDF, Word (.docx), Excel (.xlsx), PPT (.pptx), Markdown (.md), TXT, etc.
- **Intelligent parsing**: Built-in OCR and document structure analysis, accurately extracting text, tables, and metadata (page numbers, chapters).
- **Automated processing**: Files are automatically triggered to perform Celery asynchronous tasks for chunking and vectorization after upload.
- **MinIO integration**: Native support for MinIO object storage, providing file preview, download, and version management.
### 2. 🤖 Intelligent Dialogue Assistant
- **Customizable roles**: Supports creating multiple assistants, configuring different system prompts, temperature coefficients, and model parameters.
- **Memory mechanism**:
- **Short-term memory**: Based on the sliding window's historical dialogue retention.
- **Long-term memory**: (Planned) Based on semantic retrieval of historical information recall.
- **Hybrid retrieval**: Combines keyword retrieval (BM25) and vector retrieval (Dense Retrieval), supporting reranking optimization.
- **Source document tracing**: Each answer can be precisely traced back to the specific paragraph and page number of the cited document.
### 4. 🔧 AIOps Operation and Maintenance Diagnosis Agent
Autonomous fault diagnosis Agent built on top of RAG, based on **LangGraph StateGraph** to achieve the classic **Plan-Execute-Replan** workflow:
- **Planner**: Decomposes fault phenomena into executable diagnostic steps and retrieves historical troubleshooting experience (runbook) injection into the context.
- **Executor**: Performs step-by-step execution, calling monitoring indicators / log query tools through **MCP protocol** to obtain real data; if the tool is unavailable, it degrades to analysis based on LLM knowledge.
- **Replanner**: Evaluates the battlefield situation every round, making a three-choice decision of `continue` / `replan` / `respond`, and uses hard constraints (maximum steps / forbidden replan threshold) to prevent infinite loops.
- **MCP tool decoupling**: Monitoring (`monitor`) and log (`cls`) services as independent processes are exposed through HTTP + MCP, and the Agent only recognizes the URL — Mock → Real Prometheus only needs to change the configuration without modifying the Agent code.
- **Elegant degradation**: When Milvus is unavailable, it automatically degrades to local file retrieval (runbook / JSONL / Kaggle / HuggingFace dataset); when MCP service is unreachable, it does not block the diagnosis link.
- **SSE streaming**: The diagnosis process (plan → step-by-step execution → report) is pushed to the front-end in real-time through Server-Sent Events.
### 5. 📊 RAG Automated Evaluation
- **Dataset generation**: Automatically generates QA question-answer pairs based on knowledge base documents, including single-hop and multi-hop problems.
- **Multi-dimensional indicators**: Combines RAGAS framework ideas, providing faithfulness, relevance, recall, and other multi-dimensional automatic scoring.
- **Customizable evaluation**: Supports uploading JSON/Excel format custom evaluation sets.
- **Visualized report**: Automatically generates Markdown format evaluation reports, including detailed error analysis and improvement suggestions.
### 6. 🛡️ Enterprise-level Permissions and Architecture
- **RBAC permissions**: Role-based access control, supporting multi-user isolation.
- **High-availability architecture**:
- **API**: FastAPI high-performance asynchronous framework.
- **Task Queue**: RabbitMQ + Celery distributed task queue.
- **Vector DB**: Milvus high-performance vector database.
- **Storage**: MinIO distributed object storage.
- **Cache**: Redis cache and session management.
## 🏗️ System Architecture
```
┌─────────────┐
Vue3 Frontend ──HTTP──► │ FastAPI │
└──────┬──────┘
┌──────────────────┼──────────────────┐
▼ ▼ ▼
RAG Question-Answering AIOps Agent Asynchronous Tasks
(retrieval+rerank) (LangGraph graph) (Celery)
│ planner→executor │
│ →replanner │
▼ │ ▼
┌────────────────┐ │ Document Parsing→Segmentation→Vectorization
│ Milvus / Redis │◄────────┤ │
│ MinIO / SQLite │ ▼ ▼
└────────────────┘ MCP Tool Services Write to Milvus + SQLite
(monitor / cls)
```
RAG and AIOps share the same foundation (Milvus/Redis/MinIO/SQLite + DashScope LLM), but their orchestration is independent — RAG follows synchronous retrieval generation, and AIOps follows LangGraph asynchronous streaming.
## 🚀 Quick Start
### Prerequisites
- Docker & Docker Compose
- Python 3.10+
- Node.js 16+
- DashScope API Key (Tongyi Qianwen)
### 1. Start Basic Services (Docker)
```bash
cd docker
docker-compose up -d
# Start Milvus, MinIO, Redis, RabbitMQ
```
### 2. Backend Deployment
```bash
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Configure environment variables
cp .env.example .env
# Edit .env and fill in DASHSCOPE_API_KEY and other information
# Initialize database
python create_tables.py
# Start API service
python -m src.main
# Start Celery Worker (open another terminal)
celery -A src.worker.celery_app worker --loglevel=info -P solo
```
### 3. Frontend Deployment
```bash
cd frontend
npm install
npm run dev
```
### 4. AIOps Diagnosis Agent (optional)
```bash
# One-click start MCP indicator service + log service + FastAPI backend
bash scripts/demo.sh
# Or start manually:
python mcp_servers/monitor_server.py # Indicator service (127.0.0.1:8004)
python mcp_servers/cls_server.py # Log service (127.0.0.1:8003)
# Diagnosis endpoint (SSE): POST /api/v1/aiops
```
Access addresses:
- Frontend page: http://localhost:5173
- API documentation: http://localhost:8000/docs
- MinIO console: http://localhost:9001
- Flower monitoring: http://localhost:5555
## 📂 Directory Structure
```
rag-aiops-platform/
├── docker/ # Docker deployment files
├── frontend/ # Vue3 frontend source code
│ ├── src/views/ # Page components (Assistant, Evaluation, KnowledgeBase...)
│ └── src/api/ # Axios interface encapsulation
├── mcp_servers/ # MCP tool services (monitor indicator / cls log, Mock version)
├── scripts/ # Verification and maintenance scripts (demo.sh one-click start / try_aiops.py verification)
├── src/
│ ├── agent/ # AIOps Agent
│ │ └── aiops/ # Plan-Execute-Replan graph (planner/executor/replanner/graph)
│ ├── api/ # API routes (Endpoints)
│ ├── database/ # ORM models and database connections (including Milvus encapsulation)
│ ├── embedding/ # Vectorization service encapsulation
│ ├── llm/ # Large model client
│ ├── processors/ # Document parsing and segmentation core logic
│ ├── retrieval/ # Retrieval and reranking logic
│ ├── services/ # Business logic layer (RAG, Evaluation, Storage, Memory)
│ └── worker/ # Celery asynchronous tasks
└── data/ # Local data storage (SQLite db / runbooks, not included in version management)
```
## 🧭 Technical Selection Explanation
- **LangGraph StateGraph (instead of ReAct free loop)**: Diagnostic tasks need to converge out of the report, `StateGraph` + hard constraints guarantee termination; Plan-Execute-Replan's explicit nodes also facilitate expansion of decision logic.
- **MCP protocol (instead of `@tool` write death)**: Tools as independent services, clients only recognize URL, Mock → real backend zero modification Agent.
- **ChatOpenAI compatible-mode (Agent) + ChatTongyi (RAG)**: Two LLM paths separation — Agent side needs function calling to walk compatible mode, RAG side walks DashScope native SDK.
- **Elegant degradation**: Milvus / MCP either unavailable does not block the main process, respectively degrades to local file retrieval / LLM knowledge analysis.
## 🤝 Contribution
Welcome to submit issues and pull requests. Please read [CONTRIBUTING.md](CONTRIBUTING.md) before submitting.
## 📄 License
This project is open-sourced under [Apache License 2.0](LICENSE).