Abstract
Code generation agents powered by large language models (LLMs) are revolutionizing the software development paradigm. Distinct from previous code generation techniques, code generation agents are characterized by three core features: autonomy, expanded task scope, and enhancement of engineering practicality. This paper presents a systematic survey of the field, tracing the technology's developmental trajectory, categorizing core techniques, and detailing applications across the software development lifecycle (SDLC). Finally, by analyzing the primary challenges, we identify foundational research directions for the future of the field.
Introduction: The Rise of Autonomous Code Agents
While Large Language Models (LLMs) like GPT-4 excel at generating standalone code snippets, they often struggle with the complexities of real-world software engineering, such as navigating cross-file dependencies and iterative debugging. Traditional LLMs are passive; they provide a single response and stop. To achieve true automation, the field has shifted toward agents—systems that wrap LLMs in a loop of autonomy, allowing them to interact with compilers, search engines, and other agents.
As shown in the timeline above, the domain has witnessed an explosion in research since 2023, moving from simple self-planning models to complex multi-agent frameworks like MetaGPT and SWE-agent. This shift marks a transition from "Code Completion" (assisting a human) to "Autonomous Teams" (where humans act as high-level supervisors).
Core Architectures
1. Single-Agent Methods
Single-agent architectures focus on enhancing a centralized "brain" through three primary pillars:
- Planning and Reasoning: Moving beyond linear generation to structures like Monte Carlo Tree Search (MCTS) and Tree-of-Thought, enabling agents to explore multiple paths and backtrack when they hit a dead end.
- Tool Integration & RAG: Equipping agents with external tools (compilers, debuggers, static analyzers) and Retrieval-Augmented Generation (RAG) to access context from large, private codebases.
- Reflection and Self-Improvement: Implementing loops where the agent reviews its own output based on execution feedback or failure diagnosis to perform autonomous refinement.
2. Multi-Agent Systems (MAS)
To manage larger, more complex projects, researchers have developed "AI Software Companies" where multiple agents collaborate. Common patterns include:
- Pipeline-based: Mimicking the Waterfall model with specialized roles (e.g., a Product Manager defines requirements, a Coder writes code, and a Tester verifies it).
- Hierarchical: A high-level "Manager" agent decomposes tasks for specialized "Worker" agents.
- Blackboard Models: A shared memory space ensuring all agents remain synchronized on the project state.
Benchmarking the Evolution
The survey tracks the evolution of benchmarks from simple logic puzzles to real-world engineering hurdles. While classic benchmarks like HumanEval and MBPP focus on basic Python functions, SWE-bench has emerged as the current "gold standard." It consists of thousands of real GitHub issues requiring agents to navigate entire repositories to find and fix bugs. Other specialized benchmarks like CodeAgentBench focus on tool usage, while SEC-bench evaluates security vulnerabilities.
Key Insights and Practical Results
Autonomy is the primary differentiator in this new paradigm. An agent's ability to observe a compiler error and act to fix it is what enables engineering practicality. Furthermore, "Context Engineering" is becoming more critical than "Prompt Engineering" in large-scale projects to avoid "context poisoning" from massive codebases.
Empirical results show significant gains across state-of-the-art (SOTA) tools:
- Efficiency: Tools like DARS achieved a 47% Pass@1 on SWE-bench Lite, significantly outperforming standard "one-shot" LLM generation.
- Bug Fixing: RepairAgent successfully repaired 164 defects on the Defects4J benchmark by autonomously navigating state machines.
- Issue Resolution: MAGIS demonstrated a landmark 13.94% resolution rate for GitHub issues—a significant step for fully autonomous AI agents.
Future Directions and Challenges
Despite rapid progress, several frontier challenges remain:
- Domain-Specific Knowledge: Agents still struggle with niche industries, proprietary APIs, and unwritten team conventions.
- Intent Understanding: Improving "clarification loops" to better understand ambiguous human specifications before coding begins.
- Operational Costs: Reducing the high cost and latency of running iterative multi-agent loops.
- Multimodal Integration: Enabling agents to interpret UI sketches, architecture diagrams, and flowcharts.
- Trust and Security: Mitigating the risks of autonomous agents generating malicious code or accidentally deleting production data.
Summary updated