[Paper Review] Can AI Agents Generate Microservices? How Far are We?
AI agents can generate functional microservices with maintainable code, achieving high integration correctness in clean-state scenarios, but fully autonomous generation remains imperfect and requires human oversight.
LLMs have advanced code generation, but their use for generating microservices with explicit dependencies and API contracts remains understudied. We examine whether AI agents can generate functional microservices and how different forms of contextual information influence their performance. We assess 144 generated microservices across 3 agents, 4 projects, 2 prompting strategies, and 2 scenarios. Incremental generation operates within existing systems and is evaluated with unit tests. Clean state generation starts from requirements alone and is evaluated with integration tests. We analyze functional correctness, code quality, and efficiency. Minimal prompts outperformed detailed ones in incremental generation, with 50-76% unit test pass rates. Clean state generation produced higher integration test pass rates (81-98%), indicating strong API contract adherence. Generated code showed lower complexity than human baselines. Generation times varied widely across agents, averaging 6-16 minutes per service. AI agents can produce microservices with maintainable code, yet inconsistent correctness and reliance on human oversight show that fully autonomous microservice generation is not yet achievable.
Motivation & Objective
- Assess whether AI agents can generate functional microservices with explicit API contracts under different contextual information levels.
- Evaluate functional correctness via automated tests in incremental and clean-state generation settings.
- Compare code quality and software metrics of AI-generated microservices against human baselines.
- Assess efficiency of different AI agents in terms of time, tokens, and cost across scenarios.
Proposed method
- Evaluate 144 microservice generations across 3 agents, 4 projects, 2 prompting strategies, and 2 scenarios.
- Use incremental generation to validate within existing systems via unit tests; use clean-state generation to validate from requirements via integration tests.
- Measure functional correctness (test pass rates), code quality (SLOC, Cyclomatic Complexity, Cognitive Complexity via SonarQube), and efficiency (tokens, time, cost).
- Apply two prompting strategies (P1: minimal context; P2: including an implementation summary) across four conditions.
- Perform non-parametric statistical analysis (Anderson-Darling, Wilcoxon signed-rank, Dunn-All) with alpha = 0.01 to compare scenarios and prompts.

Experimental results
Research questions
- RQ1RQ 1: Can AI agents generate microservices with acceptable functional correctness and code quality under different contextual scenarios?
- RQ2RQ 1.1: How do AI agents perform in incremental generation (with existing system context) for microservices?
- RQ3RQ 1.2: How do AI agents perform in clean-state generation (from requirements only) for microservices?
- RQ4RQ 2: How do AI agents compare in efficiency (time, tokens, cost) when generating microservices?
Key findings
- In incremental generation, average unit test pass rates range around 50–76% depending on agent and prompt strategy.
- In clean-state generation, integration test pass rates are higher, averaging 81–98%, indicating strong API contract adherence.
- Generated code generally shows lower complexity than human baselines (lower Cyclomatic and Cognitive Complexity).
- Time to generate a microservice averages 6–16 minutes depending on the agent; Codex can be notably slower with outlier runs up to 1.74 hours.
- Cost per microservice varies by agent, with Code Qwen being most cost-efficient (around $2.98 per service) and Claude Code most expensive (around $13.28 per service).
- P1 prompts (minimal context) outperform P2 prompts in incremental generation, whereas clean-state generation benefits from guidance in some agents; overall, human oversight remains necessary for API contract compliance.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.