Skip to content
Book Open access

Complexity-Ranked Iterative Refactoring from Microservices to LLM-based Multi-Agent Systems

Jul 2026 · SIGSOFT FSE Companion · 0 citations · 17 references
Computer Science

Abstract

Retail supply chain management is increasingly reliant on complex SaaS-based microservice systems (MS). While integrating LLM-powered agents offers a significant opportunity for intent-based orchestration, the transition from deterministic microservices to non-deterministic Multi-Agent Systems (MAS) lacks a structured migration path and risks severe system instability. In this paper, we propose a systematic refactoring methodology that prioritizes service migration based on quantified complexity criteria. As the architecture evolves, we embed Quality Assurance (QA)-based regression analysis inline to ensure functional parity between legacy service logic and probabilistic agentic reasoning. To safeguard against logic failures, our framework incorporates a Human-in-the-loop (HITL) mechanism that resolves decision-making gaps when agent outputs violate predefined QA invariants. We evaluated our approach on a supply chain benchmark of 9 microservices with 13 APIs. Our results reveal that complexity-ranked refactoring improves consistency, latency, and cost by 2%, 21%, and 23% over random migration, and by 6%, 25%, and 31% over reverse-ranked order migration, respectively. Furthermore, this ranked approach minimizes rollbacks and human interventions. This work contributes a robust process for containing agentic non-determinism within microservice boundaries through continuous QA alignment and strategic human intervention.

Read PDF