run_workflow
Execute a ComfyUI workflow JSON and retrieve results, either blocking until completion or returning a prompt ID to poll. Includes spend-consent handling for paid workflows.
Instructions
Run a ComfyUI workflow JSON on the ComfyUI this server targets.
That is this machine unless COMFYUI_URL/COMFYUI_HOST points the
run/job tools at another one. Wraps comfy run --workflow <path>;
accepts an API-format or UI-export file.
Args:
wait: if True (default), block until the run finishes and return the
full result. If False, submit and return with a prompt_id to
poll via job(action="status").
Progress notifications are EMITTED WHEN THE ENGINE REPORTS ANY —
do not rely on them. comfy-cli 1.15.0's stream carries no
per-step events for this verb, so in practice a run is silent
until it finishes. Poll ``job(action="status")`` from a second
call if you need progress.
timeout_seconds: used only when ``wait=True``; default 110s sits under
a typical client's ~120s budget. For a longer run, prefer
``wait=False`` + ``job(action="wait")``/``job(action="watch")``.
confirm_spend: SOME workflows (partner-API nodes from
``emit_partner_workflow``, or an ``API``-tagged template) spend
credits when run. Set True ONLY when the user has actually agreed
to spend — never merely to clear an error. Free workflows are
never gated by this.Gotchas:
- Without consent, a paid workflow fails CLOSED
(spend_consent_required, nothing spent) on a comfy-cli carrying
the gate — the enforced floor; a source build past the fail-open
floor check may lack it and still spend.
- A workflow requesting a huge allocation can pass validation and then
crash the whole ComfyUI process on OOM — surfaced as
connection-loss/timeout, not a node error; get_logs still reads
the log across the crash.
- Partner-API nodes need a Comfy credential (COMFY_API_KEY);
transient failures retry automatically.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wait | No | ||
| confirm_spend | No | ||
| workflow_path | Yes | ||
| timeout_seconds | No |