With the growing size and complexity of software systems, manual code review and refactoring have become increasingly difficult and time-consuming. Traditional static code analysis tools can identify code quality problems, but they do not possess the ability to reason and fix code on their own, whereas large language models (LLMs) often alter code without understanding its structure. In this study, an autonomous multi-agent system for code review and refactoring is proposed that combines static code analysis, knowledge graphs, LLM-based reasoning, automated testing, and stateful orchestration through LangGraph. The system uses six domain-specific agents for code processing, analysis, planning, refactoring, validation, and reporting, and a self-healing feedback loop for functional accuracy. The proposed system was evaluated using case studies on various programming languages, and improvements in cyclomatic complexity, maintainability, and lines of code were achieved without affecting the semantic correctness. The results indicate that the proposed framework provides a structured and reliable approach to autonomously refactor software. These results show the effectiveness of multi-agent collaboration in reliable autonomous refactoring and highlight the potential of the proposed approach to move forward with scalable, evaluation-aware software maintenance.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Autonomous Multi-agent Code Review and Refactoring Framework Using Large Language Models and LangGraph

  • Savarapu Chandra Sekhar,
  • Leela Venkata Sai Gubbala,
  • Charitha Sri Mulagada,
  • Korampalli Yashwanth Krishna Kishore,
  • Mallampalli Rama Naga Siva Nandu

摘要

With the growing size and complexity of software systems, manual code review and refactoring have become increasingly difficult and time-consuming. Traditional static code analysis tools can identify code quality problems, but they do not possess the ability to reason and fix code on their own, whereas large language models (LLMs) often alter code without understanding its structure. In this study, an autonomous multi-agent system for code review and refactoring is proposed that combines static code analysis, knowledge graphs, LLM-based reasoning, automated testing, and stateful orchestration through LangGraph. The system uses six domain-specific agents for code processing, analysis, planning, refactoring, validation, and reporting, and a self-healing feedback loop for functional accuracy. The proposed system was evaluated using case studies on various programming languages, and improvements in cyclomatic complexity, maintainability, and lines of code were achieved without affecting the semantic correctness. The results indicate that the proposed framework provides a structured and reliable approach to autonomously refactor software. These results show the effectiveness of multi-agent collaboration in reliable autonomous refactoring and highlight the potential of the proposed approach to move forward with scalable, evaluation-aware software maintenance.