If an AI agent can only return an MP4, you have very little to inspect, correct, or reuse. A better target is a structured video document that your app can validate before anyone spends time rendering.

This guide shows how to build that pipeline with VideoFlow Core: accept a constrained brief, create portable VideoJSON, preview and review it, then choose the right renderer for delivery. You need a TypeScript project and a clear template or scene contract before you start.

1. Define the input contract before asking the agent for video

Start with data that describes a job, not an open-ended request such as “make a launch video.” For example, a product-video job can contain a product name, three approved benefits, image URLs, target duration, locale, and one CTA. Keep the allowed media and copy limits in the same contract.

Your expected result is a brief your application can check deterministically. It also gives the agent a smaller, safer problem: produce structured scene data rather than improvising a timeline. For a product team generating many variations, that is the difference between a one-off demo and an automation system.

2. Generate VideoJSON as the source of truth

Use a TypeScript template or agent-produced scene plan to create the project, then compile it to VideoJSON. VideoFlow’s fluent API supports text, image, video, audio, captions, shapes, groups, keyframes, effects, and transitions, while the compiled JSON can be stored, versioned, and rendered later.

ts\nimport VideoFlow from "@videoflow/core";\n\nconst $ = new VideoFlow({\n name: "Weekly product update",\n width: 1920,\n height: 1080,\n fps: 30,\n});\n\n$.addText({ text: brief.headline, fontSize: 7, fontWeight: 800 });\n// Add only media and fields that your validator approved.\nconst videoJSON = await $.compile();\n

Store that videoJSON with the job ID, the template version, and the original input. The expected result is an inspectable artifact you can diff when a user asks why two exports differ. It is also portable: the same document can power a live preview, an editor, or a renderer.

Structured video document passing a validation gate before preview

3. Add a review gate before rendering

Validate the document before it reaches a renderer. Check required layers, maximum duration, asset domains, caption presence, safe copy length, and any brand rules your workflow needs. Reject or repair the JSON when a required value is missing; do not hide a bad result behind a successful-looking export.

Then show a preview. VideoFlow’s DOM renderer is designed for live, scrubbable playback and frame-accurate seeking, which makes it a practical review surface in an internal dashboard. If your users need to make controlled changes, embed the React Video Editor. Its multi-track timeline, inspector, keyframes, transitions, effects, uploads, and onChange callback let you persist the revised document rather than creating a disconnected manual edit.

The expected result is a clear decision: approved JSON advances; a rejected job returns to the input or template stage; an edited job replaces the stored source of truth. This is the same discipline that makes a product video review rubric useful, but here the review operates on the actual reusable project data.

4. Pick browser or server rendering deliberately

Use the browser renderer when a user is exporting a small video directly from your app and you want to avoid sending the source project to a rendering service. It can report progress and supports cancellation through AbortController, which is useful for an interactive export button.

Use the server renderer for queued, scheduled, or API-driven jobs. It renders headlessly from Node.js to an MP4 file or Buffer, so it fits catalog-wide product clips, localized campaign batches, and event-triggered videos. Pair it with a queue when you need concurrency limits, retry policy, and job status. Review the Renderers documentation when you set that boundary.

Portable video source branching between browser and server rendering

The expected result is not that one renderer wins everywhere. It is that both paths consume the same approved VideoJSON, so changing the delivery environment does not force you to rewrite the scene.

5. Save evidence with every export

For each render, keep the VideoJSON version, template version, render target, asset manifest, output URL, timestamps, and error details. That record turns a vague support request into a reproducible job. It also lets you rerender an old campaign without asking an agent to recreate it from memory.

For teams turning catalog or CRM data into clips, make the final step explicit: validate delivery URLs, mark the job complete only after the output is reachable, and surface the source document beside the finished video. The VideoFlow examples are a useful place to explore composition patterns before you lock down your own templates.

Rendered video flowing from a preserved source document to delivery channels

Common pitfalls

  • Letting the agent invent the schema: define accepted fields and validation rules first.
  • Rendering before review: preview the same JSON you will export, then persist approved edits.
  • Mixing template and output versions: record both with every job.
  • Treating every export as server work: browser rendering may be simpler for a user-initiated, privacy-sensitive export.
  • Treating JSON as a temporary intermediate: keeping it is what makes the workflow editable and auditable.

Build the smallest useful pipeline first

Start with one template, one structured input, a preview, and one renderer. Once that path is reliable, add editing, queues, locale variants, and event triggers without changing the format at the center of the system.

The next action is to read the VideoFlow Core guide, define a narrow input schema for one video job, and make VideoJSON—not an opaque MP4—the handoff between your AI agent, reviewers, and renderer.