HyperAgent: Generalist Software Engineering Agents to Solve Coding Tasks at Scale

Nghi D. Q. Bui, Phan Nhật Huy, Phong Xuan Nguyen · DOI · OpenReview

TL;DR

This paper introduces HyperAgent, a novel generalist multi-agent system that mimics human developer workflows to tackle a broad spectrum of software engineering tasks across multiple programming languages. By integrating specialized agents for planning, navigation, editing, and execution, HyperAgent achieves state-of-the-art results on challenging benchmarks like GitHub issue resolution, code generation, and bug fixing, paving the way for more versatile AI-assisted software development.

What Problem Does This Paper Address?

The field of software engineering (SE) has seen a revolution with Large Language Models (LLMs), which excel at various coding tasks. While many AI systems have been developed to automate SE tasks, they are often specialized for a single purpose, like resolving GitHub issues or generating code snippets. This specialization limits their applicability to the complex, multi-faceted nature of real-world software development, which requires adaptability across different tasks, languages, and scenarios. The paper addresses this gap by proposing a generalist multi-agent system that can handle a wide range of SE tasks by emulating the holistic workflow of human developers.

Methods

HyperAgent is built around a centralized multi-agent system that mimics a human developer's workflow. It comprises four specialized agents:

  • Planner: The central decision-maker, responsible for understanding task prompts, devising strategies, and coordinating the other agents.
  • Navigator: Specializes in efficiently exploring codebases, using IDE-like tools (e.g., code_search, go_to_definition) to locate relevant code components.
  • Code Editor: Handles code modification and generation, using tools like repair_editor to apply patches and ensure code quality.
  • Executor: Validates solutions by running tests and reproducing issues, using an interactive shell for environment setup and execution.

These agents communicate asynchronously via a Message Queue, enabling parallel processing and scalability. The system is designed for minimal configuration, allowing it to adapt to various SE tasks by simply using task templates.

Datasets

HyperAgent was evaluated on several established benchmarks:

  • SWE-bench: Used for GitHub issue resolution, comprising 2,294 task instances from popular Python repositories. The paper utilized refined subsets: SWE-bench-Lite (300 instances) and SWE-bench-Verified (500 instances).
  • RepoExec: A benchmark for repository-level Python code generation, emphasizing executability and correctness with 355 samples.
  • Defects4J: A standard benchmark for fault localization and program repair, including 353 active bugs from version 1.0 and additional bugs from version 2.0 for repair.

Key Insights and Ideas

  • Generalization is Key: The paper strongly advocates for generalist AI agents in software engineering. By mimicking human workflows, HyperAgent demonstrates that a single system can effectively handle diverse tasks, outperforming specialized agents in many cases. This suggests a paradigm shift from narrow AI tools to broader, more adaptable AI assistants.
  • Modular Agent Design: The four-agent architecture (Planner, Navigator, Editor, Executor) effectively decomposes complex SE tasks into manageable sub-problems. This modularity allows for specialized LLMs to be used for each agent, optimizing for reasoning power, efficiency, and cost.
  • Workflow Emulation: The success of HyperAgent hinges on its ability to closely emulate human developer workflows. This insight is crucial for building AI systems that can seamlessly integrate into existing development processes and provide meaningful assistance.
  • Tool Integration is Crucial: The effectiveness of each agent is significantly enhanced by its suite of specialized tools. The paper highlights how tools like code_search, go_to_definition, and repair_editor are essential for enabling LLMs to interact with codebases and perform complex operations.

Key Results

HyperAgent achieved impressive results across various benchmarks:

  • GitHub Issue Resolution (SWE-bench):
    • SWE-bench-Lite: 26.00% success rate (HYPERAGENT-Lite-1).
  • SWE-bench-Verified: 33.00% success rate (HYPERAGENT-Full-1), matching or exceeding top baselines like SWE-Agent and Agentless.
  • Demonstrated significantly faster processing times and better cost-efficiency compared to some baselines.
  • Repository-Level Code Generation (RepoExec):
    • Achieved a Pass@5 rate of 53.33% (HYPERAGENT-Lite-3), outperforming models provided with full context in some cases, showcasing its ability to navigate codebases independently.
  • Fault Localization and Program Repair (Defects4J):
    • Fault Localization: Achieved an Acc@1 of 59.70%, significantly outperforming traditional and deep learning-based methods.
  • Program Repair: Achieved the best performance with 249 plausible fixes and 192 correct fixes on Defects4J v1.2 and v2, surpassing state-of-the-art repair tools.

Limitations and Future Work

  • Hallucination and Timeout: The paper acknowledges that hallucination and exit timeouts can occur due to the communication between agents potentially losing details of real execution results or context locations, making it difficult for the Planner to stay grounded.
  • Future Work: The authors suggest several promising directions:
  • Integrating HyperAgent with existing development environments and version control systems.
  • Exploring its application in more specialized domains like security-focused code review or performance optimization.
  • Enhancing the system's explainability and providing more detailed insights into its decision-making process.
  • Continuously updating the system's knowledge base with new programming paradigms and best practices.

Summary updated

BibTeX
@misc{bui2024hyperagent,
  author = {Nghi D. Q. Bui and Phan Nhật Huy and Phong Xuan Nguyen},
  title = {{HyperAgent: Generalist Software Engineering Agents to Solve Coding Tasks at Scale}},
  year = {2024},
  eprint = {2409.16299},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.16299},
}
Figure