Dev.to WebDev 🛠 Dev 👁 0 📖 5 min read

Your AI agent built PDF export but who owns the next change

Imagine asking your coding agent to add a client report export. It creates a route, adds a button, connects the data, and produces a tidy PDF. The agent says done. Then another team sends a message: "Looks great. Cou

Your AI agent built PDF export but who owns the next change

Imagine asking your coding agent to add a client report export.

It creates a route, adds a button, connects the data, and produces a tidy PDF.

The agent says done.

Then another team sends a message:

"Looks great. Could we add a column, use the new font, and make six client versions?"

Your agent can write another patch. You can ask it again next week.

But there is a question hiding behind all that generated code:

Who owns the report after the agent finishes the feature?

I'm building Bitavu, a visual template editor with a JSON-to-PDF API. This is one of the boundaries I care about: letting a coding agent build the integration while giving the team a clear place to maintain the document.

The first export is only one part of the job

A task called "add PDF export" leaves plenty open to interpretation.

Which data belongs in the report? What happens when it spans several pages? Who approves a layout change? Does saving a new design immediately affect production?

An agent can produce a working implementation without those questions being settled.

If the acceptance test only checks that a response starts with a PDF signature, a report with missing headings may pass.

Congratulations. You have successfully tested the existence of a file.

That check is useful. It just covers much less than the person reading the report will expect.

Give the agent a document contract

"Make it professional" leaves the agent to make choices about both presentation and integration.

A more useful starting point is a reviewed template and an explicit input shape.

Here is an illustrative request:

{
  "templateId": "client-report",
  "revision": 4,
  "data": {
    "report": {
      "title": "Delivery summary",
      "period": "2026-Q3"
    },
    "client": {
      "name": "Harbor Studio"
    },
    "sections": [
      {
        "heading": "This quarter",
        "body": "The implementation and review are complete."
      }
    ]
  }
}

Those IDs, revision numbers, and fields are examples. The real request must match a template saved in your workspace.

That gives the coding agent a bounded integration task: gather authorized application data, construct the expected payload, request the selected template revision, and handle the response.

At runtime, your application sends the JSON. The agent's work lives in the integration code.

The contract also makes future changes easier to discuss. A wider column is a layout change. A new required field changes what the application needs to supply.

Both deserve review, but they involve different work.

A brief you can give your coding agent

For a Bitavu integration, I would start with something like this:

Implement server-side report export using our existing application
authorization and the provided template ID, tested revision,
JSON field contract, and synthetic example data.

Use POST https://api.bitavu.com/v1/render.

Read the scoped API key from server configuration. Keep it out
of browser code, generated examples, and application logs.

Resolve report data through the authorized application user.
Keep the selected template ID and revision in server configuration.

Generate one idempotency key per logical export operation.
For retries of that operation, preserve the key, body, and revision.

Handle errors explicitly. A schema mismatch needs review;
do not invent a field mapping or switch to a different revision.

Return a successful PDF response as a download. Preserve useful
failure information without exposing credentials or report data.

Add checks for authorization, the expected document content,
multi-page data, schema mismatch, and retry behavior.

This is an ordinary HTTP integration. The valuable part of the brief is deciding what the agent may change and what should remain an explicit review decision.

If a field disappears, "keep trying until a PDF downloads" is a poor acceptance criterion.

A useful implementation tells you which contract stopped matching.

Give layout work a place to happen

In Bitavu Studio, document blocks bind to JSON fields. You maintain the layout visually and save template revisions; the application can request a tested revision through the API.

That creates a practical split:

The application team owns data selection, authorization, and the integration.

The people responsible for the document own its layout and review.

A colleague can work on the next template revision while production continues requesting its selected one. When the new layout is approved and tested, you adopt that revision deliberately.

If the change adds a required data field, the application team still needs to participate.

A visual editor gives the layout work a home. It does not erase the data contract.

A proposed fix still needs an owner

Suppose a generated report has a missing section.

A tempting fix is to make the section optional, substitute a blank value, or remove the failing check.

Any of those might make a test green. Whether it makes the report correct depends on why the section was required.

Give the agent that context before asking it to repair the output.

The same principle applies when AI helps with template changes. Bitavu's Studio assistant produces structured proposals that are validated and presented for review; applying a proposal is an explicit action.

Conceptual workflow illustration, not a Studio screenshot.

Review the effect on the document and its expected fields. A plausible proposal is a starting point for that review.

For API input that no longer matches the template, Bitavu reports detected schema drift as 422 SCHEMA_DRIFT. A reviewed, saved mapping can be referenced with mappingId. That is a deliberate adaptation to a particular template revision.

Test the handoff as well as the happy path

The most useful checks challenge the boundaries the agent was asked to preserve:

Situation What to verify
A user requests another customer's report Application authorization rejects the request
Realistic data spans multiple pages Required content remains readable and pagination behaves as intended
An upstream field is renamed The mismatch is visible rather than silently replaced with a blank
A render operation is retried Its key, body, and selected revision stay consistent
A colleague edits the next template draft The production request still selects its tested revision

Use synthetic fixtures with names, sections, and row lengths that vary. Inspect the generated pages as well as the response status.

For a fixed report that rarely changes, an agent-written renderer in your codebase may be enough. A separate template workflow becomes more useful when document changes keep arriving from several teams.

The next font change is coming either way.

When you ask an agent to build an export, what goes into your brief beyond "return a PDF"?

Disclosure: I'm building Bitavu. The three illustrations are AI-generated conceptual scenes using synthetic examples.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.