Skip to content

MicroAgent: Context-Augmented Multi-Agent Framework for Automatic Microservice Decomposition

๐Ÿ•’ Published (v1): 2026-06-29 03:36 UTC ยท Source: Arxiv ยท link

Why this paper was selected

Multi-agent orchestration for software decomposition; relevant harness pattern

Ask a follow-up

Open an assistant pre-loaded with this paper's context.

๐Ÿ’ฌ Ask ChatGPTโœฆ Ask Claude

TL;DR

MicroAgent is a multi-agent framework that decomposes monolithic Java applications into microservices using five specialized LLM agents with tailored context and analytical tools. It achieves 89.2% decomposition accuracy (24.6% above SOTA) and 93.4% F1 on common class identification, evaluated on 10 Java web applications.

Problem

Manual microservice decomposition is time-consuming and labor-intensive. Existing automated methods fall into two categories โ€” program analysis-based (static/dynamic) and semantic analysis-based โ€” both of which fail to capture deep business logic and global understanding, leading to incomplete dependency extraction and suboptimal decomposition. Directly applying LLMs faces three specific challenges: (1) overlong repository-level context degrades LLM performance and causes hallucination (e.g., mistaking database table names for class names); (2) LLMs lack deep contextual insight into class dependencies and usage patterns, causing incorrect boundaries; (3) LLMs overlook core microservice design principles (e.g., misassigning shared utilities, producing highly coupled partitions).

Method

MicroAgent decomposes the monolithic application through a five-stage multi-agent workflow aligned with Domain-Driven Design (DDD):

  1. Domain Agent โ€” analyzes the entire monolith at a high level (class summaries + basic info) to identify \(\geq n\) core business domains and generate descriptions for each.
  2. Clustering Agents โ€” dynamically instantiated per domain; each agent receives its domain's description plus descriptions of all other domains for boundary awareness, then clusters domain-specific classes using semantic dependency tools.
  3. Merging Agent โ€” merges closely related domains to meet the desired number of microservices \(n\), completing the DDD strategic phase.
  4. Common Class Agent โ€” identifies classes shared across domains and assigns them appropriately, using specialized tools that rank dependency entropy and ratio to detect shared functionality.
  5. Review Agent โ€” examines remaining unassigned classes and decides whether to incorporate them into existing partitions, producing the final microservice candidates.

Context management uses two-level compression: application-level (monolith hierarchy extracted from source packages, database summary LLM-generated from SQL/non-SQL schemas) and class-level (LLM-generated class summaries, JSON-formatted basic info and method signatures, dependency graph built via JavaParser AST + Class Hierarchy Analysis). Each agent receives only the granularity appropriate to its subtask โ€” the Domain Agent gets class-level sketches, while subsequent agents access full dependency graphs and source code.

Toolkit includes retrieval tools (get_class_hierarchy, get_database_summary, get_class_relation_and_code, search_file, codebase_semantic_search) and specialized analytical tools (get_related_class_list, rank_dependency_entropy_and_ratio, get_more_potential_common_classes, assign_common_class_list) that encode microservice design principles.

Key Contributions

  • First LLM-based agentic framework for microservice decomposition, decomposing the monolithic task into five subtasks each handled by a specialized agent
  • Dual strategy for contextual understanding: customized multi-granularity context tailored per subtask + decomposition-oriented analytical tools aligned with DDD principles
  • Empirical evaluation on 10 Java Web applications showing 89.2% decomposition accuracy (24.6% above SOTA) and 93.4% F1 on common class identification (41.1% above SOTA)

Results

  • Average decomposition accuracy of 89.2%, outperforming the best baseline (LLM base model) by 24.6%
  • Common class identification and assignment achieves 93.4% F1 score, improving the best baseline by 41.1%
  • Evaluation conducted on a benchmark of 10 Java Web applications with ground-truth microservice versions
  • Case study demonstrates practical decomposition quality (e.g., correctly placing OrderItemVo based on actual call dependencies rather than surface-name similarity)

Limitations

  • Evaluated only on Java Web applications; generalizability to other languages and application types (e.g., Python, C++, desktop apps) is unconfirmed
  • Requires the desired number of target microservices \(n\) as input
  • Relies on LLM-generated class summaries and database summaries, which may introduce compression errors or hallucinations into downstream agents
  • Static analysis (JavaParser AST + CHA) may miss runtime-reflective or dynamically-resolved dependencies
  • No ablation isolating the contribution of each agent or tool against the full pipeline
  • Cost overhead from multiple LLM calls per application is not characterized

Relevance to Harnesses / Meta-Harnesses

MicroAgent exemplifies a meta-harness that orchestrates multiple LLM agents, each with role-specific context windows and tool access, to solve a complex software engineering task that no single LLM call handles well. The architecture โ€” task decomposition into subtasks โ†’ per-agent context selection โ†’ specialized analytical tools โ†’ sequential refinement โ€” mirrors the core pattern of agentic harnesses for multi-step reasoning. For researchers tracking this topic, MicroAgent demonstrates concretely how controlled context management (granularity gating per subtask) and domain-specific tool augmentation reduce LLM hallucination and improve adherence to design principles, a key design consideration for meta-harness builders.