Agent-Driven Video Generation Pipeline Design
This article explains how to design an agent-driven video generation pipeline that turns the costly "random draw" nature of text-to-video and image-to-video models into an orchestrated, measurable, and reproducible workflow. It covers a "one brain, four executors" architecture, compiling prompts into structured objects, budgeted parameter-grid search, multi-dimensional automated scoring, structured failure attribution with prompt self-evolution, and artifact archiving for reproducibility, along with a four-week rollout plan and common pitfalls.
1. The Problem: Why Video Generation Feels Like Endless “Random Draws”
Today’s mainstream text-to-video and image-to-video models are essentially high-dimensional random mappings. With the same prompt and the same weights, changing only the sampling seed can produce noticeable differences in composition, motion amplitude, and temporal consistency. Developers call this uncertainty the “random draw”: generate ten clips and pick the one that is usable.
The random draw is expensive for three reasons:
- High unit cost: Video inference operates on three-dimensional spatiotemporal tensors, consuming far more GPU memory and time than a single image. Every failure is a real waste of compute.
- Subjective evaluation: Unlike classification tasks with accuracy, whether a video is “good” mixes aesthetics, semantic alignment, and physical plausibility, making it hard to judge with a single scalar.
- Fragmented workflow: Prompts, parameters, post-processing, and editing are scattered across different stages and stitched together manually, so nothing accumulates into reusable assets.
The value of agents is not that they “write better prompts,” but that they converge these three layers of uncertainty into an engineering workflow that is orchestrable, measurable, and rollback-capable.
2. Overall Architecture: One Orchestration Layer, Four Executors
A practical design splits the system into “one brain, four hands”:
- Orchestrator agent: Handles task decomposition, state-machine progression, and budget control.
- Prompt executor: Compiles natural-language requirements into structured prompts and negative constraints.
- Generation executor: Connects to model inference services and submits jobs in batches across a parameter grid.
- Evaluation executor: Scores candidate outputs across multiple dimensions and decides whether they pass the threshold.
- Archiving executor: Persists artifacts, metadata, and scores together into searchable assets.
The executors are decoupled through a message queue, task state is written to persistent storage, and the orchestration layer is kept stateless for horizontal scaling. This is a common industry pattern and does not depend on any vendor-specific proprietary interface.
3. Key Design One: Turn Prompts into a “Compilable Structure”
Do not let the agent emit free-form text directly. Instead, it should produce a structured object that a template then compiles into the final prompt:
{"subject": "An engineer in a dark jacket inspecting a server room","camera": {"shot": "medium", "move": "slow_push_in"},"motion": {"amplitude": 0.4, "duration_sec": 5},"style": ["realistic", "cool tones", "shallow depth of field"],"negative": ["camera shake", "text watermark", "limb distortion"],"seed_policy": "grid"}
The benefits are concrete: fields become validatable, enumerable, and fuzzable. Once style and motion are decoupled, the search space of the parameter grid shrinks from “text permutations” to a “finite-dimensional Cartesian product,” which finally makes evaluation comparable.
4. Key Design Two: Parameter Grid and Budget Tiers
The random draw should not be unlimited randomness but a budgeted grid search:
- Tier 1 (coarse filtering): Fix a low resolution and few frames, run 8–12 seeds, and evaluate only semantic alignment.
- Tier 2 (shortlisting): Re-run the 2–3 parameter sets that pass coarse filtering at higher resolution and frame counts.
- Tier 3 (finalization): Add post-processing such as frame interpolation, super-resolution, and color unification.
Budget control should be arbitrated centrally by the orchestration layer, using a token bucket to cap inference quota per unit time and prevent the agent from retrying indefinitely on failing branches:
if attempt >= max_retry and best_score < pass_threshold:return degrade_and_notify(reason="budget_exhausted")
5. Key Design Three: Multi-Dimensional Evaluation and Automated Scoring
Breaking “looks good” into computable approximate metrics is the dividing line for whether the whole pipeline can be automated:
| Dimension | Approximate Metric | Purpose |
|---|---|---|
| Semantic consistency | Vector similarity between text and keyframes | Prevent off-topic output |
| Temporal stability | Variance of feature distance between adjacent frames | Suppress flicker and abrupt changes |
| Motion plausibility | Optical-flow amplitude distribution | Avoid static or wildly shaking footage |
| Aesthetic quality | General image-quality scoring model | Rough ranking of candidates |
| Safety compliance | Policy-violation classifier | Hard blocking |
It is worth stressing that these scores are only ranking signals, not absolute truth. A more robust engineering practice is a dual track of “threshold + human spot checks”: automated scoring compresses 100 clips down to 5, and humans make only the final call.
6. Key Design Four: Failure Attribution and Prompt Self-Evolution
Every failure should leave behind a structured attribution rather than being simply discarded:
failure:code: MOTION_OVERSHOOTevidence: "Optical-flow P95 exceeds threshold by 2.3x"hypothesis: "motion.amplitude too high"action: "Lower to 0.25 and reduce duration"
The orchestration layer maintains an experience table of “prompt–parameter–score,” and the next task automatically inherits historically high-scoring configurations. This effectively turns human tuning intuition into a versionable policy file that new team members can reuse directly.
7. Key Design Five: Artifact Archiving and Reproducibility
The most common operational disaster in video generation is “the one usable clip has gone missing.” Metadata should include at least the structured prompt, all parameters, the random seed, the model version identifier, the score breakdown, and the post-processing chain. Store the artifact bodies in object storage, metadata in a database, and connect logs and metrics to logging services and monitoring/alerting. Track output success rate, average retry count, and cost per clip on a dashboard.
The minimum bar for reproducibility: given the same metadata, a re-run should produce results with similar scores.
8. Rollout Roadmap and Common Pitfalls
A recommended four-week pace: week one connects structured prompts with single-model invocation; week two adds the grid and automated scoring; week three completes archiving, dashboards, and alerting; week four runs load testing and cost optimization.
Common pitfalls include: negative constraints written too broadly, leaving the frame empty; raising resolution and frame count at the same time and causing GPU memory overflow; setting evaluation thresholds so strict that the pipeline never passes; and neglecting upfront content-safety checks, leading to rework. To lower the barrier of building in-house, you can also evaluate general-purpose capabilities offered by cloud vendors such as Baidu AI Cloud, including container platforms, object storage, and message queues, and focus your effort on orchestration and evaluation, the two stages that truly determine quality.
In the end, the point of agents is not to “draw” a good card for you, but to make the drawing strategic, budgeted, recorded, and reusable.
