Skip to content

Ch3nYe/AutoCompiler

Repository files navigation

🤖CompileAgent: Automated Real-World Repo-Level Compilation with Tool-Integrated LLM-based Agent System

arXiv

📙About

CompileAgent is a LLM-driven framework designed to automatically compile projects directly from their source code repositories. In our post, we go beyond the scope of the paper by presenting extended experiments that highlight the application of CompileAgent across various downstream tasks.

✒️Workflow

workflow

  • Step1: Specify the URL of the project to be compiled.
  • Step2: Extracting Compilation Instructions. Specifically, the MasterAgent calls the CompileNavigator module to obtain the project's compilation instructions. It first uses the Shell and File Navigator tools to locate relevant files, and then extracts the instructions using the Instruction Extractor tool.
  • Step3: Execute the Compilation Commands. If the compilation succeeds, proceed directly to Step5; if it fails, the ErrorSovler module will be invoked to perform error correction.
  • Step4: Resolving Compilation Errors. For simple compilation errors, the MasterAgent handles them directly. For more complex or challenging issues, the MasterAgent invokes Multi-Agent Discussion to find solutions. During the process, if new errors are encountered, Google Search may be used to retrieve potential solutions.
  • Step5: Display the result of the compilation: success or failure.

More details can be found in our paper.

🚀Environment Setup

conda create -n CompileAgent python=3.9.0
conda activate CompileAgent
pip install -r requirements.txt

Building the compilation environment:

docker build -t autocompiler:gcc13 .

NOTE: The Dockerfile can be modified to build a compilation environment tailored to your needs.

🔥Quick Start

The Dataset directory includes three publicly compilable repositories that you can use for testing compilation.

python CompileAgent.py --help

Usage: CompileAgent.py [OPTIONS]

Compile the projects from source code with the help of AI assistant

Options:
  -j, --json_path TEXT the path to the project file to be compiled [required]
  -p, --dataset_base_path TEXT the base path to store the projects need to compile [required]
  -l, --log_path TEXT the path to store the logs of compilation [required]
  -c, --clean_copied_project BOOLEAN whether to clear the new project path after the compilation, set to True when debugging [required]
  -r, --retry INTEGER the times to retry when fail to pass checker
  -s, --strict_checker BOOLEAN if True, only return True when all target files are in the file list, otherwise return True when any target file is in the file list
  --download_proxy TEXT pass to git --config http.proxy=${}, e.g., socks5://127.0.0.1:29999, if do not set: do not use proxy
  --multi_process BOOLEAN whether to enable the multi-process to compile the projects
  --help Show this message and exit.

NOTE: Please configure the required LLMs api in Config.py before execting the CompileAgent.py file.

📜Citation

@misc{hu2025compileagentautomatedrealworldrepolevel,
  title={CompileAgent: Automated Real-World Repo-Level Compilation with Tool-Integrated LLM-based Agent System}, 
  author={Li Hu and Guoqiang Chen and Xiuwei Shang and Shaoyin Cheng and Benlong Wu and Gangyang Li and Xu Zhu and Weiming Zhang and Nenghai Yu},
  year={2025},
  eprint={2505.04254},
  archivePrefix={arXiv},
  primaryClass={cs.SE},
  url={https://arxiv.org/abs/2505.04254}, 
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •