RAG-Powered Multi-Agent Architecture for Autonomous Software Defect Triage, Duplicate Detection, Root Cause Diagnosis & Remediation
Modern software development teams receive hundreds of bug reports, stack traces, and crash logs daily across repositories and issue trackers. Manual triage, duplicate identification, root cause investigation, and remediation planning are slow, expensive, and heavily reliant on tribal knowledge.
The AI Defect Analysis System is an enterprise-grade, autonomous software defect analysis platform powered by Retrieval-Augmented Generation (RAG) and a 5-Agent Sequential LLM Orchestrator.
By indexing 4,125 real-world historical defect vectors across major open-source ecosystems (Apache Bugzilla, Eclipse Issue Tracker, Mozilla Bugzilla), the system correlates live bug reports with historical evidence and technical stack traces to produce an executive-ready defect diagnosis in seconds.
- Vector Collection:
historical_defects_balancedstored in persistent ChromaDB. - Dataset Corpora: 2,000 Apache chunks, 2,000 Eclipse chunks, 125 Mozilla chunks (4,125 total vectors).
- Dense Vector Space: 384-Dimensional embeddings generated via
sentence-transformers/all-MiniLM-L6-v2. - Distance Metric: Normalized Cosine Similarity.
- Chunking Strategy: 2,000-character sliding windows with 300-character overlap preserving context integrity.
- 🏷️ Triage Agent: Categorizes defect type (Application Crash, UI Freeze, Data Corruption), evaluates severity (CRITICAL, HIGH, MEDIUM, LOW), assigns priority (P1, P2, P3), assesses reproducibility, and outlines business impact.
- 🔎 Duplicate Detection Agent: Queries ChromaDB vector space for top-k candidates, cross-references multi-attribute metadata (Title, Product, Component, Status, Resolution), and determines duplicate status (DUPLICATE, RELATED DEFECT, NEW ISSUE), avoiding false-positive matches.
- 🧾 Log Analysis Agent: Parses raw unformatted stack traces, exceptions, class paths, and line numbers (e.g.,
java.lang.NullPointerExceptionatAuthenticationService.java:142). Strictly separates observed evidence from hypotheses with zero hallucination. - 🎯 Root Cause Agent: Correlates evidence from Triage, Log Analysis, Duplicate Candidates, and RAG retrieval using an evidence priority hierarchy (Log Traces > Bug Description > RAG Similarity) to output a confirmed or likely technical root cause.
- 🛠️ Remediation Agent: Formulates defensive code safeguards (obeying strict Source Code Limitation rules without inventing synthetic exception classes), multi-level testing strategies (unit, integration, regression), CI/CD static analysis guardrails, and logging/monitoring rules.
- Glassmorphism UI: Styled with modern Google Fonts (
Outfit+Inter), ambient glow headers, and KPI metric cards. - 1-Click Presets: Pre-loaded demonstration presets (NullPointerException, UI Freeze, Connection Pool Timeout) for 1-click recruiter/reviewer evaluation.
- Visual Architecture Flowchart: Embedded pipeline execution flowchart.
- Dedicated RAG Explorer:
🔬 RAG Evidencetab displaying candidate metadata tables and raw vector text snippets. - Executive Summary Banner:
🎯 DEFECT ANALYSIS EXECUTIVE SUMMARYtop card with color-coded status pill badges. - Report Exporter: 1-click JSON report exporter for CI/CD or ticket system integration.
┌─────────────────────────────┐
│ User Defect Submission │
│ (Bug Text + Error Logs) │
└──────────────┬──────────────┘
│
▼
┌─────────────────────────────┐
│ RAG Knowledge Retrieval │
│ (ChromaDB: 4,125 Vectors) │
└──────────────┬──────────────┘
│
▼
┌─────────────────────────────┐
│ 1. TRIAGE AGENT │
│ Category, Severity, Scope │
└──────────────┬──────────────┘
│
▼
┌─────────────────────────────┐
│ 2. DUPLICATE DETECTION AGENT│
│ Cosine Match & Metadata │
└──────────────┬──────────────┘
│
▼
┌─────────────────────────────┐
│ 3. LOG ANALYSIS AGENT │
│ Stack Trace & Exception Line│
└──────────────┬──────────────┘
│
▼
┌─────────────────────────────┐
│ 4. ROOT CAUSE AGENT │
│ Multi-Evidence Correlation │
└──────────────┬──────────────┘
│
▼
┌─────────────────────────────┐
│ 5. REMEDIATION AGENT │
│ Action Plan & Test Strategy │
└──────────────┬──────────────┘
│
▼
┌─────────────────────────────┐
│ Executive Report Dashboard │
│ (Streamlit / JSON Export) │
└─────────────────────────────┘
AI-Defect-Analysis-System/
├── .env # Environment configuration (GEMINI_API_KEY)
├── LICENSE # MIT Software License
├── README.md # Project documentation & execution guide
├── requirements.txt # Python dependencies
├── sample_bug.log # Sample stack trace log file
│
├── agents/ # Specialized Multi-Agent System Modules
│ ├── __init__.py
│ ├── agent_orchestrator.py # 5-Agent Sequential Orchestrator Engine
│ ├── triage_agent.py # Triage & Severity Classification Agent
│ ├── duplicate_detection_agent.py # Duplicate Candidate & Similarity Agent
│ ├── log_analysis_agent.py # Log Parser & Stack Trace Analysis Agent
│ ├── root_cause_agent.py # Multi-Source Root Cause Correlation Agent
│ └── remediation_agent.py # Remediation & Action Plan Agent
│
├── app/ # Streamlit Enterprise Web Dashboard
│ ├── __init__.py
│ ├── main.py # CLI / Entry point module
│ └── streamlit_app.py # Full Streamlit Web UI Implementation
│
├── llm/ # Gemini LLM Integration Layer
│ ├── __init__.py
│ ├── gemini_utils.py # Rate-Limit (429) Retry & Backoff Helper
│ ├── defect_analyzer.py # Standalone LLM Analyzer
│ └── test_gemini.py # Gemini API Connection Verification
│
├── knowledge_base/ # RAG Pipeline & Vector DB Generation
│ ├── rag/
│ │ ├── __init__.py
│ │ ├── retriever.py # ChromaDB Vector Retriever Module
│ │ └── context_builder.py # RAG Context Formatter
│ ├── standardize_apache.py # Apache Bugzilla Dataset Normalizer
│ ├── standardize_eclipse.py # Eclipse Issue Tracker Normalizer
│ ├── standardize_mozilla.py # Mozilla Bugzilla Normalizer
│ ├── combine_datasets.py # Unified Dataset Combiner
│ ├── clean_dataset.py # Data Cleaning & Deduplication Script
│ ├── create_balanced_dataset.py # Balanced Dataset Sampler (Apache, Eclipse, Mozilla)
│ ├── create_balanced_chunks.py # 2000-char Sliding Window Chunking Script
│ ├── generate_balanced_embeddings.py # SentenceTransformer Vector Embedder
│ ├── build_balanced_vector_database.py # ChromaDB Vector Store Builder Script
│ └── balanced_semantic_search.py # Vector DB Retrieval Test Script
│
├── data/ # Datasets & Vector Storage
│ ├── historical/ # Standardized Raw Defect Datasets
│ ├── processed/
│ │ ├── chunks/ # JSONL Chunks (balanced_bug_chunks.jsonl)
│ │ └── embeddings/ # JSONL Embeddings (balanced_bug_embeddings.jsonl)
│ └── vector_db/ # ChromaDB Store (historical_defects_balanced)
│
├── docs/ # Documentation & Specifications
│ ├── AI-DEFECT-ANALYSIS-SYSTEM.docx # Complete Technical & System Architecture Document
│ └── dataset_sources.md # Dataset Provenance & Data Schema Guide
│
└── tests/ # Comprehensive Test Suite
├── test_agent_orchestrator.py # 5-Agent End-to-End Orchestration Test
├── test_triage_agent.py # Triage Agent Test
├── test_duplicate_detection.py # Duplicate Detection Agent Test
├── test_log_analysis_no_logs.py # Log Analysis (No-Logs Scenario Test)
├── test_log_analysis_stacktrace.py # Log Analysis (Stack-Trace Test)
├── test_root_cause_agent.py # Root Cause Agent Test
├── test_remediation_agent.py # Remediation Agent Test
├── test_defect_analyzer.py # Standalone LLM Analyzer Test
└── test_rag_retrieval.py # RAG Retrieval Integration Test
- Python 3.10+ (Tested on Python 3.13)
- Google Gemini API Key (Free Tier or Pay-as-you-go key from Google AI Studio)
Clone the repository and set up a Python virtual environment:
# Clone repository
git clone https://github.com/RakeshBabuGajula/AI-Defect-Analysis-System.git
cd AI-Defect-Analysis-System
# Create virtual environment
python -m venv venv
# Activate environment (Windows PowerShell)
.\venv\Scripts\Activate.ps1
# Activate environment (Linux/macOS)
source venv/bin/activate
# Install dependencies
pip install -r requirements.txtCreate a .env file in the root directory and add your Gemini API Key:
GEMINI_API_KEY=YOUR_GEMINI_API_KEY_HEREIf rebuilding the ChromaDB vector database from raw datasets:
# Set PYTHONPATH and execute vector database build
$env:PYTHONPATH="."
python knowledge_base/build_balanced_vector_database.pyRun the Streamlit web dashboard locally:
python -m streamlit run app/streamlit_app.pyOpen your browser at http://localhost:8501.
Run the automated test suite to verify agent functionality:
# Set PYTHONPATH for local module resolution (Windows PowerShell)
$env:PYTHONPATH="."
# Linux / macOS:
# export PYTHONPATH="."
# Run complete 5-Agent Orchestrator Test
python tests/test_agent_orchestrator.py
# Run individual agent & system tests
python tests/test_triage_agent.py
python tests/test_duplicate_detection.py
python tests/test_log_analysis_stacktrace.py
python tests/test_log_analysis_no_logs.py
python tests/test_root_cause_agent.py
python tests/test_remediation_agent.py
python tests/test_defect_analyzer.py
python tests/test_rag_retrieval.py| Component | Technology / Library | Purpose |
|---|---|---|
| Language | Python 3.10+ | Core Backend Logic & Agent Framework |
| LLM Core | Google Gemini 2.5 Flash | Autonomous Agent Reasoning Engine |
| Vector DB | ChromaDB (Persistent) | Vector Store for Defect Embeddings |
| Embedding Model | all-MiniLM-L6-v2 |
384D Dense Vector Space Embeddings |
| Web UI | Streamlit | Executive Glassmorphic Web Dashboard |
| Data Processing | Pandas, NumPy | Dataset Formatting & Metric Aggregation |
| Environment | Python-Dotenv | Secure Secret Management |
Distributed under the MIT License. See LICENSE for more information.