LLM Based Code Generation and Code Integration with Multi-Agent Systems
Contemporary large language models can generate syntactically correct code from natural language specifications. However, integrating the generated code into existing software projects remains a largely manual, error-prone process that severely limits practical utility. This paper proposes a novel four-agent multi-agent system architecture to bridge the gap between code generation and code integration. The system comprises a Context Retrieval Agent, Code Generation Agent, Code Integration Agent, and Orchestration Agent. Evaluated through 270 experiments across three software projects of varying complexity, six language models, and three code generation styles, the AST-based integration architecture achieved a 100% success rate. Syntax validity averaged 69.2%, and the best model configuration reached a normalized score of 0.795.