Harvey

Building an Agent for Complex Document Drafting and Editing

Mar 24, 2026
Building an Agent for Complex Document Drafting and Editing
SummaryAI, from the source post

This post details the architectural shift from a one-shot sub-agent system to an in-memory agent that iteratively builds and edits Word documents. Key technical contributions include: a proprietary OOXML library for full feature support and active maintenance, an agent that prioritizes legal text while exposing minimal OOXML for markup preservation, an in-memory document representation for iterative editing with optimized tools, a get_diff tool for agent self-review, and a reconciliation step for merging edits from parallel sub-agents. The system now dynamically gathers context and supports advanced multi-step operations on lists, tables, and styles, leading to significant improvements in edit quality and user engagement.

More from the Document Processing Scalability trail