run_workflow
Run a ComfyUI workflow by name, override parameters, and obtain paths to generated files. Supports waiting for completion or background execution with progress tracking.
Instructions
Run a workflow and return the paths of the files it produced.
Call describe_workflow first to see which parameter names a workflow accepts. Pass seed=-1 to randomise the seed.
Args: name: workflow file name, without the .json extension. params: parameter overrides, e.g. {"prompt": "a red fox", "seed": -1, "steps": 8}. Raw '.' keys are accepted for anything not discovered. wait: wait for the run to finish. When False, returns the prompt_id immediately and the run keeps being watched in the background, so get_progress(prompt_id) reports its steps as they happen. Prefer this for anything slow: waiting blind is what makes a caller mistake a working generation for a hung one. timeout: seconds to wait before giving up on a running job. save_outputs: convert PreviewImage nodes to SaveImage so results are written to output/ instead of the temp folder that ComfyUI clears on restart. free_on_switch: unload models from VRAM before this run when it needs a different set than the previous one AND free VRAM is already below COMFYUI_FREE_VRAM_MIN_FRACTION. Defaults to COMFYUI_FREE_ON_SWITCH. Low free VRAM is normal on its own - ComfyUI keeps models cached - so this deliberately does nothing when there is headroom.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| wait | No | ||
| params | No | ||
| timeout | No | ||
| save_outputs | No | ||
| free_on_switch | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||