English

DocAgent: A Multi-Agent System for Automated Code Documentation Generation

Software Engineering 2025-05-27 v3 Artificial Intelligence Computation and Language Machine Learning

Abstract

High-quality code documentation is crucial for software development especially in the era of AI. However, generating it automatically using Large Language Models (LLMs) remains challenging, as existing approaches often produce incomplete, unhelpful, or factually incorrect outputs. We introduce DocAgent, a novel multi-agent collaborative system using topological code processing for incremental context building. Specialized agents (Reader, Searcher, Writer, Verifier, Orchestrator) then collaboratively generate documentation. We also propose a multi-faceted evaluation framework assessing Completeness, Helpfulness, and Truthfulness. Comprehensive experiments show DocAgent significantly outperforms baselines consistently. Our ablation study confirms the vital role of the topological processing order. DocAgent offers a robust approach for reliable code documentation generation in complex and proprietary repositories.

Keywords

Cite

@article{arxiv.2504.08725,
  title  = {DocAgent: A Multi-Agent System for Automated Code Documentation Generation},
  author = {Dayu Yang and Antoine Simoulin and Xin Qian and Xiaoyi Liu and Yuwei Cao and Zhaopu Teng and Grey Yang},
  journal= {arXiv preprint arXiv:2504.08725},
  year   = {2025}
}

Comments

Accepted by ACL 2025. Code: github.com/facebookresearch/DocAgent

R2 v1 2026-06-28T22:55:09.705Z