The pattern
Most agents that make documents never see them. They write markup that should produce a tidy slide or page, then hand it over, and the first one to notice a heading wrapping onto three lines or a logo sitting on a chart is you, or your customer.
LangChain's internal sales agent closes that gap with a short loop. In a post published on 10 November, Nick Bray describes how the agent builds customised account plans, proof-of-value documents, proposal decks and onboarding plans for sales reps. It fills a template, converts the file to PDF, turns each page into an image, and then reads the images back to check the layout. If it finds a problem, it fixes it and renders again.
The part worth copying is the exit. LangChain says self-review raised quality but also raised waiting time, so it added a rule: ship once one review finds no real defect. On a one-pager, the company says, that rule took a run from 18 minutes down to 7. The same company's design agent inspects its own renders when it makes video, which suggests the idea travels well beyond slides. Call the pattern render, look, stop: render the output the way a person will see it, have a model look at the picture, and stop at the first clean check.
Why it matters to you: if you deliver anything visual, the defects that cost you credibility are layout defects, and a text-only agent cannot see them. A render step lets it see them, and the stop rule keeps that from doubling your run time and model bill.
When to use it, and when not to
Use it when the output is judged by how it looks. Slides, PDFs, invoices, one-page reports, email templates, social cards and landing pages all qualify. It pays most when you produce the same kind of artefact often. LangChain's agent generated 1,540 sales artefacts in 12 weeks, which is the kind of volume where a few minutes saved per run adds up.
Skip it when the output is plain text or data that nobody sees formatted, such as a CSV export or an API payload. A schema check is cheaper and stricter there. Skip it, too, when the main risk is wrong facts. A vision model will tell you the chart overlaps the footer, but not that the revenue figure on it is wrong. That needs a check against the source, like the read-back loop we covered last month.
How it works
Input: the content and a template. Step: build the file, render it to images, review the images against a short defect list, then either fix and repeat or stop. Output: the file, plus a note listing anything the agent could not fix and a human should look at.
LangChain adds one step before any of this. If the agent needs a fact the account record doesn't hold, such as the customer's success criteria, it asks the rep first. An agent that guesses a missing fact produces a well-laid-out slide with a wrong claim on it, which visual review will never catch.
Components
A fixed template. The agent fills a layout; it does not design one. LangChain's templates are owned by its leadership, and its brand kit (logos, colours, fonts) is built into the agent's sandbox, so brand changes go through a reviewed pull request instead of a prompt edit.
A renderer. Something that turns the file into the pixels a reader sees. LangChain uses python-pptx to fill the deck and LibreOffice to make a PDF, then converts pages to images. For web pages, a headless browser (a browser with no window, driven by code) does the job.
A reviewer. A vision-capable model given the images and a checklist. It returns pass, or a list of defects with the page number and a suggested fix.
A stop rule and a cap. Stop on the first review with no real defect. Also stop after a fixed number of loops, whatever happens, and flag the result for a person.
A log. Record each loop's defects and result. This becomes your eval data.
Minimal implementation
Here is a version you can run with Python, a headless browser and any vision model API. It assumes HTML output (a landing page, email or one-page report); for slides or Word files, render with LibreOffice's headless PDF export and a PDF-to-image tool.
MAX_LOOPS = 3
CHECKLIST = """Review these page images. Report only real defects:
1. Text cut off, overflowing its box, or overlapping other elements
2. Headings that wrap badly (one word alone on a line)
3. Images or logos missing, stretched or blurry
4. Anything outside the page edge or a large empty gap
5. Text too small to read or too low in contrast
Return JSON: {"pass": true/false, "defects": [{"page": n, "issue": "...", "fix": "..."}]}
Do not report style preferences."""
def run(content):
html = fill_template(content) # your template + data
for loop in range(1, MAX_LOOPS + 1):
pngs = render(html) # headless browser, full-page PNG
review = vision_model(CHECKLIST, pngs)
log(loop, review)
if review["pass"]:
return html, "clean" # stop on first clean pass
html = apply_fixes(html, review["defects"]) # LLM edits the HTML
return html, "needs human: " + summarise(review["defects"])The render step is a few lines with Playwright: open the page, set a fixed viewport such as 1280 pixels wide, and call page.screenshot with full_page=True. Render at the size your reader will use; if customers read on phones, add a 390-pixel-wide render too.
In n8n or a similar no-code tool, the same loop is five nodes: a template node that builds the HTML, an HTTP node that calls a screenshot service or a small render script, an AI node with the image and checklist, an IF node on pass, and a loop counter that exits at three.
Three details decide whether the loop helps. First, keep the checklist short and visual: five items a person could check in ten seconds. Second, tell the reviewer to report real defects only. LangChain's rule says "no real defect" for a reason: a model asked for feedback will always find something, and a stop rule that waits for zero suggestions never fires. Third, give the fixer the defect list and the original source, so it edits the HTML rather than regenerating the whole page and introducing new problems.
Failure modes and evals
The reviewer never says pass. Your checklist invites taste. Remove anything subjective ("looks modern") and keep only things that are broken; then check the log for the item that fires most.
The reviewer passes broken pages. Build a small test set: ten rendered pages where you know the answer, five clean and five with one planted defect each (cropped heading, overlapping logo, missing image). Run the reviewer on them. If it misses more than one planted defect, tighten the checklist wording or try a stronger vision model before trusting the loop. Our post on tuning prompts against a held-out test set walks through that process.
Fixes create new defects. If loop two often finds something loop one did not, the fixer is rewriting too much. Limit it to the elements named in the defect list.
A word on LangChain's results. The company reports that deals where a rep sent one of these artefacts moved to a later stage 47% of the time, against 16% for matched deals without one. The post does not say how deals were matched or how many were in each group, and it does not claim the artefacts caused the difference. Reps may simply send documents to deals that were already moving. LangChain says it will cover outcome measurement in a later post. Treat the 47% as a prompt to measure your own results.
Build it this weekend
Pick one document you produce at least weekly: a client report, a proposal, a social card. Then work through this list.
Turn it into an HTML template with placeholders for the content that changes.
Write the five-item defect checklist above, edited for your document.
Render last week's real version with Playwright and run the reviewer on it. Note what it flags.
Plant five defects by hand and confirm the reviewer catches at least four.
Wire up the loop with a cap of three and the stop-on-first-pass rule. Enforce the cap in code, for the reasons in our order in code, judgment in prompt post.
Run it on the next five real documents and record loops per run and time per run.
If most runs pass within two loops and you stop fixing layouts by hand, keep it. If the loop rarely passes, fix the template before you touch the prompt.
Sources
LangChain, "How our GTM Agent builds consistent, high-quality sales artifacts" (Nick Bray, 10 Nov 2026): https://www.langchain.com/blog/gtm-agent-high-quality-sales-artifacts
LangChain, design agent post on self-reviewing renders (27 Oct 2026): https://www.langchain.com/blog/design-agent
Playwright for Python, Screenshots: https://playwright.dev/python/docs/screenshots

