run_comfyscript
Run complex ComfyUI workflows as Python scripts, simplifying multi-stage graph authoring that JSON cannot easily express.
Instructions
Author and run a ComfyUI workflow as Python via ComfyScript — runs on spark in the comfyui venv against the live server. Use this for COMPLEX/multi-stage graphs (LTX-2.3 audio, two-stage pipelines) that are awkward to express as JSON or drive via the GUI. Provide a snippet with a with Workflow(wait=True): block ending in SaveImage(...)/SaveVideo(...); the imports + load() are auto-prepended. Every server node (incl. custom: HunyuanImage3Generate, LTXV*, RES4LYF samplers) is available as a function. Returns the new output filenames (view with view_image) plus an output tail. Heavy models (HunyuanImage-3.0 ~13min) need a high timeout_sec.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes | ComfyScript Python. Nodes are functions whose positional args follow each node's required-input order, e.g.: model,clip,vae = CheckpointLoaderSimple('cyberrealisticXL_v90.safetensors'); pos = CLIPTextEncode('a tiger', clip); neg = CLIPTextEncode('blurry', clip); latent = KSampler(model, 42, 28, 6.0, 'dpmpp_2m', 'karras', pos, neg, EmptyLatentImage(896,1152,1), 1.0); SaveImage(VAEDecode(latent, vae), 'out'). Wrap in `with Workflow(wait=True):`. | |
| timeout_sec | No | Max seconds to wait (default 900, max 1800). |