Movie sprite: contract

Checked by: tests/contract/test_workflow_contract_docs.py.

Turn one character picture into a transparent looping body video, its exact first frame, a preview and their records. The face is held still, so the portrait-motion workflow can add blinks and mouth shapes to the finished canonical.png separately; that workflow is not a step of this one.

The workflow is an FX workflow file, workflow.yaml, over its own node types in nodes/ and FX's built-in fx/video.generate@1; uv run python -m grida.fx plan|run movie-sprite plans and runs it. The checkout's root fx.yaml finds it by id; with an installed wheel, list the installed fx_games/workflows folder under workflows: in your own fx.yaml. uv run python -m grida.fx schema movie-sprite prints its inputs as JSON Schema:

Graph and calls

flowchart LR
  C[character] --> P[plate: fit onto a green plate]
  A[direction, motion, constraints, seconds] --> B[brief: write the motion brief]
  P --> T[take: fx/video.generate, one call]
  B --> T
  T --> F[finish: key, loop and verify]
  S[footage] --> F
  J[finish settings] --> F
  F --> O[loop, canonical, preview, contact sheet, manifest, report, frames]

With a character, the plan has four steps: plate, brief, take and finish. With footage, it has finish alone, and makes no call.

from grida.fx import run

result = run("movie-sprite", input_files=["take.yaml"], live=True, max_usd=2)
result.deliver({"loop": "sprites/idle.mkv", "canonical": "sprites/idle.png"})

The take is a long provider job. FX records the job before it is submitted and once fal takes it, so a run that stops while the clip renders collects it next time instead of paying for it again; a submission whose answer never arrived stops the take for a person (python -m grida.fx jobs lists it, and --forget clears it once you have checked fal). FX, the call's one retry owner, resends a submission only when fal answered that it took nothing. A job fal failed, or a clip whose size or length is not what was asked for, fails the step and is billed: the next run submits it again as a new attempt, and nothing resubmits it within the run. A different take is asked for on purpose with python -m grida.fx reroll, and the next live run draws it.

Cache and identity

Each step's identity is its node type's locked version (fx.lock; the node modules' sources and FX Games' movie sprite component count as their source) and what it reads. The take's call is kept in FX's call cache by its capability, route, request (the prompt, the plate's digest, length, resolution and aspect ratio) and take number, so changing only the finishing settings reruns finish alone and bills nothing, and a reroll is a new take. Changing the template, the plate's fit or the brief's wording changes the request, and with it the bill.

A take answered by a provider earlier, under the same request, is reused from the cache whatever run made it.

Outputs

Under the run folder's outputs/:

The take, the preview, the contact sheet and the report are files of their steps, which FX's viewer (python -m grida.fx start) shows.

Graph

FX plans the committed sample's take path offline; this is the shape of that plan. scripts/write_workflow_contracts.py --write regenerates the block, and the check above fails when it drifts:

{
  "graph_kind": "fx-graph-v1",
  "topology_sha256": "8fe00c409807766aa7300acb2df7d49bcc77dbdd697eb58fa0ebb569405c5ef9",
  "node_count": 4,
  "operation_counts": {
    "local": 3,
    "video_generate": 1
  },
  "outputs": [
    "outputs/canonical.png",
    "outputs/contact_sheet.png",
    "outputs/frames.zip",
    "outputs/loop.mkv",
    "outputs/manifest.json",
    "outputs/preview.mp4",
    "outputs/report.json"
  ],
  "type_ids": [
    "movie_sprite/brief",
    "movie_sprite/finish",
    "movie_sprite/plate",
    "movie_sprite/take"
  ]
}

Runnable offline example

inputs/supplied_clip/make_inputs.py <directory> draws an original geometric actor as a still and as a twelve-frame lossless clip, without a provider, and writes take.yaml (the still, for planning a take) and clip.yaml (the clip, finished as footage):

uv run python src/fx_games/workflows/movie_sprite/inputs/supplied_clip/make_inputs.py /tmp/movie-inputs
uv run python -m grida.fx plan movie-sprite --inputs /tmp/movie-inputs/take.yaml
uv run python -m grida.fx run movie-sprite --inputs /tmp/movie-inputs/clip.yaml
uv run python -m grida.fx inspect movie-sprite --verify

Tests run the take path offline with a stand-in for the video call, the footage path for real, and the importer that makes an example from a run. The installed-wheel probe runs outside the checkout. Live runs and human motion review remain separate evidence.