Video Workflows

glove-video turns video generation into an inspectable production loop. The agent develops the concept, builds timed prompts, carries subjects and locations across shots, feeds image references into the video model, watches every result, revises weak drafts, and exposes only a reviewed winner. The model provider remains an adapter you bring.

terminalbash
pnpm add glove-video

Start with the worked video case study if you want to see the difference first. Its keyframe, exact timed beats, prompt trace, generated drafts, review evidence, delivery decision, and measured spend all come from one recorded agent run.

Why not one generate_video tool?

A one-shot wrapper proves that a provider can return an MP4. It does not give an agent the machinery to direct a result worth showing.

Production needA single call losesglove-video records
TimeA prose prompt with ambiguous pacingTimestamped beats, duration, camera, motion, and sound
ContinuitySubjects and locations re-described from memoryDurable character and scene definitions spliced verbatim
DirectionOpaque provider-specific compromisesA prompt pipeline and capability-fit trace
Quality“Job completed” mistaken for “clip is good”Actual-video review, evidence, revision prompts, and a hard gate
SequencesExpensive restarts after one failed shotCheckpointed DAG flows that resume from incomplete shots

The production loop

flowtext
brief
  → creative direction + acceptance criteria
  → continuity library + opening frame from glove-image
  → timed beats → prompt pipeline → capability fitting
  → provider job → internal video asset
  → review the actual clip
       revise → recipe replay → review again
       pass   → explicit delivery gate → user-facing video

Generated clips are internal drafts when review is configured. The review tool sends stored video bytes to a separate video-capable model and saves a score, timestamped evidence, issues, and a self-contained revision prompt. glove_video_deliver refuses anything whose latest review does not meet the configured threshold.

Reviews also receive identity, style, and first-frame images recorded in the video recipe. Hosts can pass additional reference_assetsfor evaluation-only anchors. This lets the reviewer compare a recurring face, garment, or product against the actual reference instead of judging each clip in isolation.

What “pass” means

The reviewer returns a structured decision, numeric score, strengths, and issue records containing a criterion, severity, concrete temporal evidence, and required fix. Glove then recomputes approval rather than trusting the label alone. Delivery requires all three conditions:

  1. The reviewer declared pass.
  2. The score meets the host's passingScore.
  3. No issue has major or critical severity.

Multi-shot delivery applies the same rule to every selected scene. glove_video_flow_deliver accepts reviewed replacements for revised shots and reveals the sequence only when the complete set passes.

Any failure is normalized to revise. The stored review also carries a self-contained revision_prompt, so the next draft acts on auditable evidence instead of “try again, but better.”

Quickstart

studio.tstypescript
import { createAdapter } from "glove-core";
import {
  InMemoryVideoAssetStore,
  InMemoryVideoFlowStore,
  InMemoryVideoLibrary,
  InMemoryVideoReviewStore,
  defaultVideoPipeline,
  mountVideo,
  openrouterVideo,
} from "glove-video";

await mountVideo(agent, {
  adapter: openrouterVideo(),
  assets: new InMemoryVideoAssetStore(),
  library: new InMemoryVideoLibrary(),
  flows: new InMemoryVideoFlowStore(),
  pipeline: defaultVideoPipeline(),
  review: {
    model: createAdapter({
      provider: "openrouter",
      model: "qwen/qwen3.5-flash-02-23",
      stream: false,
    }),
    store: new InMemoryVideoReviewStore(),
    passingScore: 84,
    rubric: "Presentation-ready, coherent motion, stable subject, no artifacts.",
  },
});

agent.build();
await agent.processRequest(
  "Create the strongest six-second launch film. Review every draft and deliver only a pass.",
);

Image-to-video without plumbing

Video references are asset ids with roles. A frame generated by glove-image can become a first-frame reference without uploading it to temporary object storage; the resolver hands the bytes to the video adapter at execution time.

director-call.tstypescript
glove_video_generate({
  intent: "A glass seed opens into a ring of light",
  beats: [
    { at: 0, action: "seed rests perfectly still" },
    { at: 2, action: "a warm seam appears" },
    { at: 4, action: "the shell opens in one clean motion" },
    { at: 6, action: "light settles into a calm halo" },
  ],
  refs: [{ asset: "img_opening_frame", role: "first-frame" }],
  duration: 6,
  aspect_ratio: "16:9",
  resolution: "720p",
  audio: true,
});

Flows that survive partial failure

Multi-shot work is saved as a dependency graph. A run checkpoints each completed shot with its recipe and output asset. If shot four fails, resuming keeps shots one through three and starts at the unfinished node. Continuity can use a matched reference or extend the previous clip.

Provider adapters and capability fitting

Every VideoModelAdapter declares its supported modes, reference roles, durations, aspect ratios, resolutions, audio support, and candidate limits. fitVideoToModel applies that contract before the provider call and writes every adjustment to the recipe trace. Long-running job creation, polling, cancellation, download, and provider job ids stay behind the adapter.

Cost is part of the artifact

Usage is attached to each recipe and accumulated by source for the host: requests, generated seconds, token counts where available, and real USD cost when the provider reports it. That makes creative iteration budgetable instead of a surprise discovered on an invoice.