AI for Developers

Your Agent Can Do Everything Except Finish the Paperwork

It reads the ticket, queries the CRM, and drafts a perfect summary. Then it hands you markdown, and a human opens Word. Here is why the last step is a different kind of problem, and what actually closes it.

Yacine Kahlerras
Yacine KahlerrasSoftware Engineer, Platform & UX at TurboDocx
August 24, 20269 min read

Last updated August 2026

I watched an agent do something genuinely impressive a few weeks ago. It read a support thread, pulled the account record, worked out which contract terms applied, and wrote a clear, accurate summary of what we owed the customer and by when. Start to finish, maybe forty seconds.

Then it printed the summary into the chat, and a person copied it into Word, fixed the heading styles, dropped in the logo, fought with a table, saved it as a PDF, and emailed it. That part took eleven minutes.

We keep calling this an AI problem. It is not. Everything the model was asked to think about, it did. The failure is in the last step, and the last step has never been a language problem.

Five steps, and only one of them is stuck

Break any “have the agent produce the document” task into its real steps and the picture gets clearer. Four of the five are in good shape. One is not, and it happens to be the one the reader actually receives.

01

Understand the request

Handled

Read the thread, the ticket, the CRM record, and work out what document is actually being asked for.

02

Gather the inputs

Handled

Call the tools. Pull the account, the line items, the dates, the owner, the terms. This is what tool use and connection protocols are for.

03

Draft the content

Handled

Write the summary, the scope, the recommendation. Models are genuinely good at this now.

04

Produce the artifact

The gap

Emit a real file: the company template, the right fonts, the logo in the header, the table that does not break across pages.

05

Deliver it

Partly

Store it, route it for approval, send it for signature, write the result back to the system of record.

MCP solved the wiring, not the output

The Model Context Protocol, introduced by Anthropic in November 2024, fixed something that badly needed fixing. Before it, every agent-to-tool integration was bespoke. After it, there is a standard way for a host application and its servers to exchange context and expose capabilities, and the ecosystem converged on it quickly.

It is worth being precise about what that buys you, though. MCP is a connection standard. It tells an agent how to reach your systems and call your tools. It says nothing about what a finished contract should look like, and it does not turn tokens into a valid Word file. Plugging an agent into twelve MCP servers gives it twelve new ways to gather input and exactly zero new ways to hand you a signed-looking PDF.

You can see the same instinct in how the platforms handled output reliability. OpenAI added function calling in June 2023 and schema-guaranteed structured outputs in August 2024. Anthropic made tool use generally available in May 2024 and shipped structured outputs in public beta in November 2025. The pattern is consistent: when the industry needed dependable machine-readable output, it did not write a better prompt. It constrained the model to a schema and let code take it from there.

Connection protocols answer “how does the agent reach the thing?” They do not answer “what does the thing produce?” Those are separate problems, and the second one is still mostly yours to solve.

Why asking the model to emit the file does not work

The file formats are archives, not text

A .docx or .pptx is a zip container full of XML parts, relationships, and content types that must agree with each other. A language model emits tokens. It can describe the document perfectly and still not be able to hand you valid bytes.

Brand fidelity is not a style suggestion

Your template already encodes the fonts, the margins, the numbering, the cover page, and the legal footer that someone signed off on. Asking a model to recreate that from scratch every run means it drifts every run.

Layout has to be deterministic

The same input should produce the same document. Generation that reinvents the structure each time turns every output into something a human has to re-check before it can leave the building.

Prose is the easy half

The hard half is everything around the prose: the header, the totals that must add up, the version, the approval block. That part is plumbing, and plumbing wants code, not creativity.

If you want the strongest evidence for this, look at how the model vendors handle it themselves. Anthropic publishes source-available document skills for Word and PowerPoint, and neither one asks the model to emit the file. They instruct it to write a script against a generation library, run the script, and then run a validator on the result. The guidance is blunt about why: round-tripping the packed XML through a generic parser corrupts the document, and a single malformed value is enough for the app to reject the whole file. The fix they prescribe is to fix your generator, not to hand-edit the output.

None of this is a knock on the models. It is the same reason you do not ask a very smart colleague to hand-write the PDF bytes. The task wants a deterministic renderer, and we already know how to build those.

The shape that actually works

Split the job along the line where the difficulty changes. The agent handles judgment: what is being asked, which record matters, what the summary should say. Code handles production: take that content and fill a template that was approved once and never has to be re-derived.

That is the whole trick. You build the branded file once in Word or PowerPoint, mark the variables, and expose a generator the agent can call with structured data. With TurboDocx templating the template is a document your team already knows how to edit, and the REST API and SDKs return DOCX, PDF, or PPTX from JSON. The agent never has to know what a content type override is.

If you want to hand this to your coding agent rather than wire it yourself, the TurboDocx Quickstart Skill installs the integration in one prompt and works with Claude Code, Cursor, GitHub Copilot, OpenCode, OpenAI Codex CLI, and Gemini CLI. There is a full walkthrough of that install if you want to see what it generates. And if you just need HTML turned into a Word file inside your own service, the open-source html-to-docx converter is MIT licensed and does that one job well.

The rule: let the model decide what goes in the document. Never let it decide what a document is. The first is judgment and it is why you hired an agent. The second is a solved engineering problem, and solving it again on every run is how you get drift.

Where this shows up first

The gap hurts most wherever the document is a recurring output rather than a one-off. If your team produces the same artifact over and over with different data, you are paying the eleven-minute tax every single time.

  • Product and platform teams embedding generation into their own app, where a document API is just another service the backend calls.
  • Automation builders stitching workflows together, who need the final step to emit a real file instead of a message. That is the automator’s version of the same problem.
  • Anyone whose agent already drafts well. If the writing is good and the output is still a copy-paste, the missing piece is a generator, not a better prompt.

Frequently asked questions

Why can an AI agent write a great draft but not produce a finished document?

Because those are two different problems. Drafting is a language problem, and models are good at it. Producing a finished document is a file-format and brand-fidelity problem: a .docx or .pptx is a zip archive of interdependent XML parts, and your company template already encodes fonts, margins, numbering, and legal footers that someone approved. A model emits tokens, not valid archive bytes, so the reliable pattern is to let the agent decide the content and let code fill a real template with it.

What is the Model Context Protocol, and does it generate documents?

The Model Context Protocol (MCP) is an open protocol introduced by Anthropic in November 2024 that standardizes how AI applications connect to external tools and data. It defines how a host application, its clients, and servers exchange context and invoke capabilities. It is a connection standard, not an output-format standard: MCP can let an agent reach the system that generates a document, but it does not itself produce DOCX, PPTX, or PDF files.

Should the agent write the file, or call something that writes the file?

Call something that writes the file. Let the agent do what it is good at: understanding the request, gathering inputs, and drafting content. Then hand that content to a deterministic generator that fills an approved template and returns the artifact. You get repeatable output, brand compliance, and a much smaller surface area to review, and you stop paying tokens to re-derive layout that never changes.

How do I give an AI agent the ability to generate real documents?

Give it a tool that produces the artifact. In practice that means a document generation API the agent can call with structured data: you build the branded template once in Word or PowerPoint, mark the variables, and the API fills it and returns DOCX, PDF, or PPTX. The TurboDocx Quickstart Skill installs that integration into a project in one prompt and works with Claude Code, Cursor, GitHub Copilot, OpenCode, OpenAI Codex CLI, and Gemini CLI.

Is this just the old mail merge with an AI label on it?

The template-plus-data mechanism is genuinely old, and that is the point: it is the part that already works. What is new is who fills in the data. Instead of a human exporting a spreadsheet and running a merge, an agent reads the systems, decides what belongs in the document, and calls the generator. The deterministic half stays deterministic, and the judgment half moves to the model.

Related Resources

Give your agent a way to finish the job

Build the branded template once, then let an agent fill it through a REST API and get back DOCX, PDF, or PPTX. No copy-paste at the end.