FormAct: Agentic Source Editing for Rich-Format Document Generation
Abstract
Rich-format documents are essential for everyday operations yet costly to author, motivating the need for automated generation to enhance productivity. To this end, we present FormAct, an agentic system that generates professional rich-format documents from scratch. FormAct operates on an HTML source representation and performs iterative source refinement with an editing agent that invokes a suite of tools, including a syntax-aware source editor and a template retriever, and a review agent that critiques rendered pages to guide refinement. Additionally, we incorporate edit-triggered context compression to maintain a bounded working context and keep multi-round editing efficient. To support development and evaluation, we introduce RichDocBench for end-to-end generation, and RichDocFuzz to evaluate formatting-error recognition for reviewer agents. Through extensive automated evaluation and blind human-preference studies, we show that FormAct consistently outperforms strong baselines, including Codex-CLI, with particularly strong improvements in generating error-free, professional rich-format documents.
Lay Summary
Creating professional documents such as reports, slides, and structured business files is a daily necessity but a time-consuming task, even for skilled users. Existing AI tools can generate text, but they often struggle to produce documents that are visually polished, structurally correct, and error-free. We built FormAct, an AI system that automatically generates rich-format documents from scratch by treating a document as editable source code and repeatedly improving it through two collaborating AI agents: one that makes targeted edits using a set of specialized tools, and another that examines the rendered document like a human reviewer and identifies problems to fix. To keep the process efficient across many editing rounds, FormAct also compresses past context so the agents remain focused. We tested FormAct against strong baselines and found it consistently produces more professional, error-free documents, validated by both automated metrics and human preference studies.