enqueue_workflow
Submit ComfyUI workflows to the execution queue, re-run past jobs, fetch and run workflows from URLs, and execute templates with overrides for custom renders.
Instructions
Submit work to the ComfyUI execution queue — the primary way an agent starts a render. Driven by the action parameter:
action:"enqueue" — Submit an API-format workflow you are already holding (one you built with create_workflow, loaded with get_workflow, or edited with create_workflow action:"modify"). Returns immediately with the prompt_id and queue position; does NOT wait for completion. Seed values in the workflow are used EXACTLY as supplied — they are NOT re-randomized, so a run is reproducible by resubmitting the same workflow (for a fresh-seed re-run of a past job, use action:"rerun").
workflowis required. Use queue (action:"status") to check progress later, or get_history (action:"list") to retrieve results and images after completion.action:"rerun" — Re-run the workflow behind a PREVIOUS generation. Retrieves the prompt graph from execution history (by
prompt_id, or the most recent run when omitted — chosen by ComfyUI's queue number, same logic as get_history) and re-enqueues it, optionally applyinginputsoverrides. Seeds are re-randomized (within each node's declared range) unless disable_random_seed is set or the seed is pinned viainputs. Returns the new prompt_id and the source prompt_id it came from. Clear error if no matching history exists. To re-run from a registered ASSET instead of history, use generate_image (action:"regenerate").action:"run_url" — Read (and optionally execute) a SHARED workflow from a URL. Fetches the workflow JSON, accepts API-format prompt graphs or UI-format exports (UI is auto-converted via the same converter as get_workflow), validates it, and summarizes it. Supports raw .json links and GitHub blob/raw URLs (blob is normalized to raw); other share hosts that need a site API return a clear 'paste the raw JSON URL' error. The fetch is bounded (http/https only, timeout + size cap, loopback/private/metadata IPs rejected to prevent SSRF). READ-ONLY unless run=true; when run=true it enqueues the workflow (applying optional
inputsoverrides) and returns the prompt_id.urlis required.action:"template_schema" — Get a template's OVERRIDABLE run-time parameters (its 'slots') BEFORE running it. Pass a bundled pack name (from list_packs action:"list") or a custom-node-contributed workflow template name (from list_packs action:"list_templates") as
template. Returnsslots— the meaningful knobs: positive/negative prompt, seed, steps, cfg, sampler/scheduler, width/height, checkpoint/LoRA/model files, denoise, batch_size, input image — plusother_slots(every remaining overridable widget), each with a stable key ".", semantic role, type, current value, and min/max/options where the node schema is known. Read-only. Feed the keys DIRECTLY into action:"run_template"'soverrides(same convention) for a schema→run round-trip.action:"run_template" — ONE-SHOT: run a named workflow template (a bundled pack from list_packs) with optional
overrides. Resolves the template's expert graph, applies overrides, and enqueues it — replacing the manual list_packs (action:"read_workflow") → create_workflow (action:"modify") → action:"enqueue" chain. Override keys are '.' (e.g. {'6.text': 'a cat', '3.seed': 42}) — the SAME keys action:"template_schema" reports (when available), so schema→run round-trips; only widget values can be overridden, never graph connections. By default returns {prompt_id} immediately; pass wait:true to block until the job completes and return its outputs (images etc.). Unresolvable template names return a clear error with near-matches.templateis required.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| run | No | action:"run_url" — if true, enqueue the fetched workflow for execution and return the prompt_id. Default false: only fetch, validate, and summarize (read-only). | |
| url | No | action:"run_url" — URL of the workflow JSON. Raw .json links and GitHub blob/raw URLs work directly. REQUIRED for that action. | |
| wait | No | action:"run_template" — block until the job completes and return its outputs. Default false: return {prompt_id} immediately. | |
| action | Yes | Which enqueue entry point to use. action:"enqueue" requires `workflow`; action:"rerun" takes an optional `prompt_id` (+ `inputs`); action:"run_url" requires `url` (+ `run`/`inputs`); action:"template_schema" and action:"run_template" require `template`; with action:"run_template" you may also pass `overrides`/`wait`/`timeout_s`. | |
| inputs | No | Overrides applied to every node with a matching input name (e.g. cfg, steps, sampler_name, seed, text). Used by action:"rerun", and by action:"run_url" only when run=true. | |
| template | No | Template name/id: a bundled pack directory name (list_packs action:"list") or a custom-node-contributed workflow template name (list_packs action:"list_templates"). REQUIRED for action:"template_schema" and action:"run_template". | |
| workflow | No | action:"enqueue" — ComfyUI workflow in API format (node ID -> {class_type, inputs}). REQUIRED for that action. | |
| overrides | No | action:"run_template" — widget overrides keyed '<nodeId>.<widget_name>' (action:"template_schema"'s keys), e.g. {'6.text': 'a red fox', '3.steps': 20}. | |
| prompt_id | No | action:"rerun" — prompt ID of the generation to re-run. If omitted, uses the most recent execution. | |
| timeout_s | No | action:"run_template" — max seconds to wait when wait:true (default 300). On timeout the job keeps running; poll queue (action:"status"). | |
| disable_random_seed | No | If true, do not randomize seed values — applies to action:"rerun" and action:"run_template" (for action:"rerun", combine with inputs.seed to reproduce exactly). It is a NO-OP for action:"enqueue", whose seeds are always used exactly as supplied (issue #865). |