CodeAgent: Enhancing Code Generation with Tool-Integrated Agent Systems for Real-World Repo-level Coding Challenges

Kechi Zhang, Jia Li, Ge Li, Xianjie Shi, Zhi Jin

arXiv:2401.07339 · 2026-07-27 공개 · arXiv · PDF

code-generation human-eval llm-framework tool-integrated-agents repo-level-coding codeagentbench software-artifacts github-copilot

Abstract

Large Language Models (LLMs) have shown promise in automated code generation but typically excel only in simpler tasks such as generating standalone code units. Real-world software development, however, often involves complex code repositories (named repo) with complex dependencies and extensive documentation. To fill this gap, our research pivots towards evaluating LLMs in a more realistic setting -- real-world repo-level code generation. We introduce CodeAgentBench, a manually curated benchmark for repo-level code generation. This benchmark comprises five high-quality Python projects, encompassing a total of 101 samples. We assess nine leading LLMs on repo-level tasks and observe a decline in their performance. To tackle this, we present CodeAgent, a novel LLM-based agent framework that employs external tools for effective repo-level code generation. CodeAgent integrates five programming tools, enabling interaction with software artifacts for information retrieval, code symbol navigation, and code testing. We implement four agent strategies to optimize these tools' usage. Our experiments on CodeAgentBench show that CodeAgent enhances LLM performance significantly, with improvements ranging from 18.1\% to 250\%. Further tests on the HumanEval benchmark confirm CodeAgent's adaptability and efficacy across various code generation tasks. Notably, CodeAgent outperforms commercial products like Github Copilot, showcasing superior accuracy and efficiency. These results demonstrate CodeAgent's robust capabilities in code generation, highlighting its potential for real-world repo-level coding challenges.

한국어 요약

한 줄 요약

CodeAgent는 외부 도구를 통합한 LLM 기반 에이전트 프레임워크로, 실무 레포지토리 수준의 코드 생성 성능을 최대 250%까지 향상시킨다.

핵심 기여도

핵심 아이디어

기존 LLM은 단일 함수 또는 문장 수준의 코드 생성에 강하지만, 레포지토리 수준의 복잡한 의존성과 문서화된 환경에서는 한계가 있다. CodeAgent는 개발자가 실제로 사용하는 도구(예: 정보 검색, 코드 심볼 탐색, 테스트 도구)를 LLM에 통합함으로써, 레포지토리 내부의 맥락을 이해하고 코드를 생성하도록 돕는다. 핵심 아이디어는 LLM이 단순히 코드를 생성하는 것이 아니라, 도구와 상호작용하며 정보를 수집하고, 기존 코드를 탐색하며, 테스트를 수행함으로써 더 정확하고 완전한 코드를 생성하도록 유도하는 것이다.

기술적 접근법

주요 결과

의의 및 한계

CodeAgent는 레포지토리 수준의 코드 생성이라는 새로운 범주를 정식화하고, LLM의 실무 적용 가능성을 확장한다. 특히, 외부 도구와의 상호작용을 통해 LLM이 복잡한 맥락을 이해하고, 기존 코드와 문서를 활용하는 방식은 기존 연구와 차별화된다. 그러나 CodeAgent는 Python 레포지토리에만 적용되었으며, 다른 언어나 더 큰 규모의 프로젝트에서의 성능은 명시되지 않음. 또한, 도구 통합 방식이 복잡하여 실무 개발자에게 즉각적인 도입이 어려울 수 있다.

실용적 활용

CodeAgent는 복잡한 레포지토리 내에서 코드 생성이 필요한 소프트웨어 개발, 유지보수, 테스트 자동화 등에 활용 가능하다. 특히, 개발자가 기존 코드베이스를 이해하고, 새로운 기능을 구현할 때 도움이 될 수 있다. 또한, 코드 리뷰, 문서 생성, 버그 수정 등 다양한 실무 시나리오에 적용 가능하다.