run_workflow
Queue a ComfyUI workflow and wait for completion, returning status, node errors, output file refs, and a preview thumbnail to verify results before saving or delivering.
Instructions
Queue the workflow and (by default) wait for completion. Returns status, node errors on failure, output file refs, any non-file return values (data_outputs: generated text, paths a save node wrote), and an inline preview thumbnail so you can SEE the result (view_output fetches full size). wait=False returns {status: queued, prompt_id} - poll get_run_status. Prove a workflow works before saving/delivering.
Text-only caller (no image input)? Pass return_preview=False - the result then carries a file path instead of a thumbnail if save_dir/COMFYUI_MOUNT_DIR is set.
roll_seeds=True (default) mirrors the browser: every seed/PrimitiveNode set to randomize/increment/decrement is re-rolled and persisted before submit - the raw /prompt API never does, so headless runs repeat forever. False re-runs the stored values.
allow_invalid=True submits despite local validation errors (ComfyUI is the final judge; use it if a valid graph is wrongly blocked). save_dir (or the configured COMFYUI_MOUNT_DIR) relocates every finished output file - images, video, audio alike - into a folder the caller can reach, returning saved_paths. Needs finished files (wait=True); a background run relocates later via save_output(prompt_id=...).
front: None (default) refuses to queue when >=2 prompts are already pending and returns {status: queue_busy} so the USER can choose; True runs next (pending jobs untouched); False waits at the back of the line.
confirm_spend: partner/API nodes charge the user's account per submit, so a graph containing one is gated - pass True only after they have agreed.
LONG RENDERS: a timeout cancels the caller's wait, not the ComfyUI job. Submit wait=False, front=False, then poll get_run_status(prompt_id) until success/error/partial and call save_output. prompt_id survives in manage_queue(status).draftsman_submitted if your session dies mid-poll.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wait | No | ||
| front | No | ||
| save_dir | No | ||
| roll_seeds | No | ||
| workflow_id | Yes | ||
| allow_invalid | No | ||
| confirm_spend | No | ||
| return_preview | No | ||
| timeout_seconds | No |