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

Dayu Yang, Antoine Simoulin, Xin Qian, Xiaoyi Liu, Yuwei Cao +2 more
4/11/2025
cs.SEcs.AIcs.CL

No official code found. Best implementation: facebookresearch/DocAgent (455 stars, MIT, last commit 2025-04-23).

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.

View on arXivView PDF

Code Implementations(1)

MIT

DocAgent is a system designed to generate high-quality, context-aware code documentation for Python codebases using a multi-agent approach and hierarchical processing.

45541CSS, HTMLApr 17, 20251 years agoMIT

Similar Papers

Cite this paper

@article{yang2025docagent,
  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},
  year   = {2025},
  eprint = {2504.08725},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2504.08725v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2504.08725.svg)](https://codeofpaper.com/paper/2504.08725)

Discussion