Saneil Suri
← Project highlights

DOCX Agent Harness Quickstart

An open-source Python starter kit for building LLM agents that draft and edit Microsoft Word documents, built to be cloned and extended by coding agents.

Context
Personal project
Date
Subject
Agents, Document generation, Open source

Overview

A .docx file is a zip archive of XML, which makes it awkward for a language model to edit directly. This starter kit gives you a working Word-editing agent you can clone and adapt: ask it to "draft a one-page proposal with a budget table" or "shorten the payment terms to 30 days" and it produces a real .docx you can open in Word. It's MIT licensed, and the repo includes an AGENTS.md so a coding agent can pick it up and extend it.

How it works

It has three layers, and each one works without the others:

  • Document abstraction. The file is unzipped into memory and the body is shown as an ordered list of paragraph and table blocks with stable ids. Parts that weren't changed are written back byte for byte. Text replacement works across differently formatted runs, and tables are addressed on their column grid, so merged and nested cells behave predictably.
  • Tools. Read, insert, update, delete, style and review operations are exposed to the model as function-calling tools. Errors go back to the model as text so it can correct itself, and you can add your own tool with a @tool decorator.
  • Harness. A small async tool-calling loop that works with any model through OpenRouter. Read-only tool calls run concurrently and edits run in order. In plan mode, the agent inspects the document and proposes a plan, and the registry blocks every editing tool until you approve it.

It can also save edits as tracked changes for review in Word, and it includes a local chat UI that shows a live preview of the document. The test suite runs offline in about three seconds, with no API key.

esc

↑↓ to move ↵ to open