Grupo Alarcos · Conference paper · 2026

Orchestrating AI-Driven Code Refactoring Based on Energy Measurements in CI Pipelines

Carlos Pulido Hernández, María Ángeles Moraga de la Rubia, Félix Óscar García Rubio

SANER Companion · 2026

As modern software systems grow in complexity and scale, their energy consumption becomes a critical concern, highlighting the need for automated mechanisms capable of monitoring, managing, and optimizing energy usage while balancing potential trade-offs with other software quality attributes. To address this challenge, this work proposes an automated agentoriented orchestration workflow that integrates a multi-agent, LLM-driven refactoring process into the software development lifecycle. In the proposed approach, one agent recommends code optimizations aimed at improving energy efficiency, while a second agent verifies the correctness of the proposed changes. The workflow is integrated into existing CI pipelines, which define and execute performance tests-tests specifically designed to exercise the software under realistic workloads-to measure applicationlevel energy consumption. This approach allows developers to identify inefficient algorithms, redundant operations, or resourceintensive functions. The execution results of the automatically refactored code are then compared with those of the original version to assess improvements in energy efficiency and other relevant software quality attributes. The approach is evaluated through controlled executions to analyze both its effectiveness and the impact of AI-driven code optimizations. The results indicate that the proposed workflow effectively supports energyaware software development by automating the coordination of energy measurements and agent-based code improvements, while requiring minimal developer intervention.

View on the group website DOI: 10.1109/SANER-C67878.2026.00029