Agent Workflow

Getting a diagram from an agent into your README

By the engineer who builds Datadef, from client work on data platforms · Reviewed August 21, 2026

The last step of a good agent diagram session is usually "put it in the README", and it is the step that most often produces a broken image three days later. The reason is that an export returns two different artifacts with two different lifetimes, and the one that looks most like a URL is the one that expires. One of the two is signed and expires in fifteen minutes; the other is permanent and only exists once the diagram is published.

6 min readFor engineers wiring an agent diagram into repository documentation

See it as a diagram

Everything below, as a diagram you can edit. Describe yours and see it in seconds.

127/20003 credits left
Try:

No account needed · Editable canvas, not a picture

Two artifacts come back from one export

export_diagram renders a diagram and returns the image inline, so the client can show it in the conversation, plus a short-lived signed download URL that serves the file directly with an attachment header and needs no API key. The inline image is content in the chat, not a file on disk. The URL is how "save this" works for a client that holds no credentials.

The knobs are deliberately few: format is PNG or JPEG, viewport width runs from 600 to 4000 pixels and defaults to 1600, height runs from 400 to 4000 and defaults to 1000. A wide architecture diagram usually wants a wider viewport rather than a taller one, because the export follows the canvas rather than reflowing it.

There is no PDF and no SVG. For documentation that is fine, since every wiki, README renderer and chat client displays PNG, and PNG is the right choice for a diagram with icons and text.

Alongside the prose the call returns a structured payload: the diagram name, the rendered width and height, the mime type, the download URL, and, when the project is published, an embed image URL and a ready-made markdown line. An agent that reads the structured half never has to parse a sentence to find the link it needs, which is the difference between a reliable documentation step and one that breaks when the wording changes.

The line that keeps working

A published Datadef diagram exposes a stable embed URL, and one markdown image line renders the current diagram wherever markdown renders. The image follows the canvas, so an edit or a repository sync updates the README without a commit, and readers need no account to see it.

One check before promising that line: the permanent URL exists only for a published project. Export a diagram that is still invite-only and the tool says so in as many words, telling you to share the project publicly first and then ask again. An agent that writes the embed line without checking produces a README image that renders for the person who exported it and for nobody else.

For wikis that accept an iframe rather than an image, the same public slug serves an interactive embed. Confluence, Notion and most documentation platforms take one or the other, which is the whole configuration.

The practical division is simple. The signed export URL is for the moment: attach it, drop it into a message, save the file. The embed line is for the artifact that outlives the session.

<!-- README.md: renders the current diagram, no commit needed -->
![Architecture](https://datadef.io/api/embed/acme-platform)

<!-- a wiki that prefers an interactive frame -->
<iframe src="https://datadef.io/embed/acme-platform"
        width="100%" height="600"></iframe>

When a committed image is still the right answer

Three cases justify a file in the repository. A renderer that will not fetch the image, whether it strips remote sources, proxies them, or refuses anything off its own domain. An environment with no outbound network, where an embedded image resolves to nothing. And a document that has to be reproducible at a past commit, such as an architecture snapshot attached to a release tag. Test the first case rather than assuming it: paste the line, look at the rendered page, and only commit a file once you have seen the embed fail.

In those cases the agent downloads the export through the signed URL, writes the PNG into the repository, and you accept the maintenance: the file is now a copy that ages, and somebody has to regenerate it. Keeping it honest costs one line under the image saying which commit and which date it came from, so a reader can tell how much to trust it.

For everything else, the embed line wins because it removes the regeneration step entirely. The README stops being a place where diagrams go stale and becomes a window onto one that does not.

Sync plus embed is the whole loop

A repository-linked diagram regenerates from the branch, and the README embed shows the result the moment it lands. See live embeds and repo to diagram.

FAQ

What formats can an agent export a diagram to?

PNG or JPEG. The export tool renders the canvas at a viewport you choose, from 600 to 4000 pixels wide and 400 to 4000 tall, defaulting to 1600 by 1000, and returns the image inline in the conversation along with a signed download link.

Why does the export link stop working after a while?

The download URL is signed and valid for 15 minutes, so a leaked link is not a permanent grant on the diagram. It is meant for saving or attaching a file in the moment. For documentation that must keep rendering, use the stable embed URL of a published diagram instead.

How do I put an architecture diagram in a README so it stays current?

Publish the diagram and add one markdown image line pointing at its embed URL. The image follows the canvas, so edits and repository syncs are reflected without a commit, and readers need no account. GitHub, GitLab and Azure DevOps all render it.

Should the agent commit the exported PNG to the repository?

Only when a remote image will not render: an offline environment, a registry that blocks external images, or a snapshot that has to stay fixed to a release tag. A committed image is a copy that ages, so it needs a line saying which commit it was generated from.

Can a diagram be exported as PDF or SVG?

No. Export is PNG and JPEG. Both render everywhere documentation is read, and PNG keeps icons and text crisp at the default 1600 pixel viewport. For a document that has to keep rendering the current picture, an embed line beats any exported file regardless of format.

What does the export call return besides the image?

A structured payload with the diagram name, the rendered width and height, the mime type and the signed download URL, plus an embed image URL and a ready-made markdown line when the project has been published. An agent should read those fields rather than parsing the human-readable sentence that accompanies them.