This ComfyUI tutorial workflow automates running a list of text prompts one-by-one and saving an image for each entry. It uses the custom FL_PromptSelectorBasic node to read a multiline prompt list and select a single line based on an index provided by a PrimitiveInt node. That selected prompt is then fed into the generation chain powered by the Z-Image-Turbo model, and the resulting image is written to disk by SaveImage. A MarkdownNote in the graph documents the intent and wiring so you can quickly see how the pieces fit together.
Under the hood, FL_PromptSelectorBasic exposes a text field where you paste prompts (one per line). The PrimitiveInt node supplies an index that determines which line is currently active. In a batch run, the index advances one step per batch iteration (when driven by your generation/driver node; listed here as ca7506c4-0f1a-4a77-9d2e-b9077eaf58d5), so each iteration consumes the next prompt from the list. This pattern is ideal for prompt A/B testing, producing sets of assets, or iterating through a campaign brief without manually editing the graph between runs.
API
Use this workflow from code
Every Comfy workflow is a JSON graph. The payload below is this workflow, exactly as ComfyUI runs it — fetch it from the URL, keep it in version control, or load it in ComfyUI and run it node by node.
Run it from TypeScript or Python with the Comfy SDK. The same code targets Comfy Cloud or a ComfyUI you host yourself — only the base URL changes.
// Install (beta)
npm i @comfyorg/sdk
// Run "Batch Process Text Prompts From List" (TypeScript)
import { Comfy } from "@comfyorg/sdk";
const client = new Comfy({ apiKey: "comfyui-..." });
// This workflow, exported in API format (see note below)
const wf = await client.workflows.fromFile("utility_text_lists_select_prompt_api.json");
const job = await client.run(wf);
await job.getOutputs("36")[0].toFile("output.png"); // SaveImageThe SDK takes a workflow in API format: open this workflow in ComfyUI and use File → Export Workflow (API).
Comfy Cloud API access requires a plan with an API key.
FAQ














