deniz.in

Markets

Weather

Loading weather

· via Hacker News – Front Page (hnrss.org)

Paper Office Forks python-docx, python-pptx and openpyxl for Safer Agent Document Editing

Paper Instruments has forked python-docx, python-pptx and openpyxl into agent-focused packages that passed 92.5% of 61 document-editing tasks, ahead of upstream libraries and Anthropic's Office skills.

Paper Office Forks python-docx, python-pptx and openpyxl for Safer Agent Document Editing

What Paper Office is

Paper Instruments has released Paper Office, a suite of Python packages — paper-docx, paper-pptx and paper-xlsx — designed to let AI agents manipulate Word, PowerPoint and Excel files with greater safety, correctness and breadth. Rather than starting from scratch, the company forked, patched and reworked the APIs of the three established Python Office libraries: python-docx, python-pptx and openpyxl. Familiar import paths such as import docx, from pptx import Presentation and import openpyxl continue to work, which keeps existing model knowledge of the older libraries useful.

Why the standard libraries fall short for agents

According to the announcement, which reached the Hacker News front page, DOCX, PPTX and XLSX files are Office Open XML packages: ZIP archives holding XML files, images and other linked resources rather than a single text document. Editing one means keeping those parts and their relationships consistent, so even a small visible change can require updates in several places.

Paper Instruments argues that agent adoption among consultants, lawyers, bankers and operators has stalled on fidelity: agents do not revise existing documents the way humans do, and the resulting decks, spreadsheets and documents look nearly right but are not fit for client use.

The upstream libraries are described as mature construction tools with years of accumulated edge cases, but they have not been updated in several years and lack the feature breadth and correctness contracts many workflows need. When a library cannot express an operation — locating the object a user means when its text is split across elements or inherited from a template, applying a change while keeping formatting and relationships intact, preserving everything outside the requested scope, or confirming the edit survived saving — the model falls back to wrapper scripts and raw OOXML. That fills its context with package mechanics and frequently causes silent regressions in comment anchors, chart workbooks, fields, custom XML and formula dependencies.

What the forks add

The shared approach across the suite: expose hidden structure as typed, machine-readable data, validate targets before supported edits, offer package-preserving save paths, report bounded changes, and refuse explicitly when an operation cannot be handled safely.

paper-docx extends python-docx with document-wide search that matches text across Word's run fragmentation and returns live spans for replacement, tracked edits or comment anchoring; numbering restarts; native Word redlines emitted as tracked changes with verified accept and reject outcomes; atomic revision resolution and comment-thread management; content controls; bookmarks and fields; cross-document composition that reconciles styles, numbering, media, hyperlinks and bookmarks; package diffs and patch saves that restore original bytes for semantically unchanged parts; and protection checks that respect a document's restriction mode. A docx.story API traverses body text, headers, footers, footnotes, endnotes, comments, tracked insertions, content controls and text boxes, and reports counts of regions it cannot read.

paper-pptx extends python-pptx with formatting inspection that resolves fonts, paragraphs and shapes through the placeholder, layout, master and theme chain; text replacement that preserves unaffected runs and refuses stale anchors; relationship-safe slide cloning, deletion, reordering and moving, with cloned charts receiving independent embedded workbooks; shape editing that flags ambiguous names; merged-cell-aware table row and column operations; native bullets and speaker-notes handling; and image and chart updates that keep position and crop intact. paper-xlsx rounds out the suite for Excel files on the same forked foundation.

Benchmark results

Across five models and 61 tasks, Paper packages plus guidance passed 92.5% of trials, versus 80.7% for the upstream packages without skills and 69.5% with Anthropic's comparable Office skills. The share of runs in which agents wrote code to edit Office file internals directly fell to 1.6% with Paper, compared with 78.7% without skills and 50.5% with Anthropic skills. For Paper Instruments, the takeaway is that basic software — not just prompts, skills and tools — remains a significant lever for improving agent performance.

Why it matters

Most enterprise knowledge work lives in Word, PowerPoint and Excel files that already exist: contracts, decks and models that must be revised, not regenerated. If agents cannot edit those files without breaking tracked changes, comment threads, chart data or formatting inheritance, they stay at the margins of professional workflows. Paper Office's results suggest that upgrading the library layer — rather than only layering on prompts or skills — can simultaneously cut failure rates and the raw-OOXML fallback behaviour behind silent corruption. For teams building document agents, the packages also model a reusable pattern for making legacy libraries agent-safe: explicit refusals, verified changes and preservation of parts the tool does not understand. And the head-to-head comparison against Anthropic's own Office skills signals that document manipulation is becoming an active front in agent tooling.

  • #python
  • #ai-agents
  • #office-automation
  • #open-source
  • #developer-tools

Related posts