Agentic AI for Code Quality: A Four-Agent Machine Learning System for Repository Refactoring, Public RAG, Groq Reasoning, and Reinforcement Learning
Abstract
Abstract Background: Software repositories continuously accumulate technical debt in the form of code smells, duplicated logic, high complexity, and poor maintainability. Although static analysis tools can identify these issues, they typically stop at diagnosis and do not autonomously perform behavior-preserving repairs or compare multiple repair strategies. Objective: This work presents an Agentic AI framework for autonomous code quality improvement that integrates multiple artificial intelligence approaches to detect, analyze, refactor, and validate software repositories while preserving functional correctness. Methods: The proposed system implements four complementary agents: (i) a deterministic Rule-Based Agent, (ii) a Retrieval-Augmented Generation (RAG) Agent using public software engineering knowledge and Tavily search, (iii) a Groq-powered Large Language Model Agent for semantic reasoning, and (iv) a Q-Learning Agent for adaptive refactoring policy selection. Python repositories are analyzed using Abstract Syntax Tree (AST)-based static analysis to extract maintainability metrics, detect code smells and clone patterns, and compute repository-level quality indicators. Each agent independently performs refactoring on isolated repository copies, followed by automated syntax checking, test validation, and metric-based evaluation. A Supervisor Agent compares all candidate solutions and selects the best validated outcome. Results: The framework was evaluated on four…
How strong is the evidence?
Evidence Hub reads this as a experimental / empirical study, done in computer models (in silico), not in people. Its evidence level is 5 of 5 (Very low · case / narrative / animal / in vitro / in silico). Case reports, narrative reviews, and animal, cell or computer-model studies give the weakest evidence for human health.
Read the paper
Related studies
- Knowledge Management Perspective of Generative Artificial Intelligence
- Navigating Generative Artificial Intelligence Promises and Perils for Knowledge and Creative Work
- Characterizing the evolving research on enterprise content management
- Large language models and multimodal foundation models for precision oncology
- From Generative AI to Extended Reality: Multidisciplinary Perspectives on the Challenges, Opportunities, and Future of Educational Computing
- Generative Artificial Intelligence: A New Engine for Advancing Environmental Science and Engineering
Go deeper in Evidence Hub
Evidence Hub adds a study data sheet (design, sample size, evidence level, key numbers), an AI summary and a chat grounded in the paper's text.