Phase 6: ComfyUI — Workflow Engine · 50 min · Python · ComfyUI
Parameter Patching
Load a template, swap the prompt, change the seed, inject a LoRA — all without opening the UI. That's parameter patching.
Hiring signal: Parameter patching (programmatically swapping prompts, seeds, guidance, LoRAs in workflow JSON) is the key skill that turns ComfyUI from a visual tool into production infrastructure.
What you will learn
- Load workflow templates: reading API-format JSON as a base template
- Patch prompt text: replacing CLIP Text Encode node inputs
- Patch seeds and guidance scale: changing KSampler parameters
- Inject LoRAs: dynamically adding LoRA Loader nodes and connecting to model/clip
The Problem
A team has a ComfyUI workflow that generates product images. They need to:
- Generate 100 products with different prompts (same workflow, different text)
- Test different seeds for each product (A/B testing)
- Apply different LoRAs for different product categories
- Change resolution for social media variants
They don't want to manually edit the workflow in the UI 100 times. They need to programmatically patch the workflow JSON — swap prompts, change seeds, inject LoRAs — and execute via API.
Parameter patching is the key skill that turns ComfyUI from a visual tool into production infrastructure.
What you'll build
Load workflow templates as base JSON. Patch prompt text (CLIP Text Encode inputs), seeds and guidance (KSampler parameters), and inject LoRA Loader nodes dynamically. Execute patched workflows via API.
Loading Workflow Templates
import json
def load_template(template_path: str) -> dict:
"""Load an API-format workflow JSON as a template."""
with open(template_path) as f:
return json.load(f)
# Template is the base workflow — you patch it for each generation
template = load_template("basic_workflow_api.json")
Unlock the full lesson
You've read the first 2 sections. The rest of this lesson covers Patching Prompts, Patching Seeds and Guidance, Patching Resolution, Injecting LoRAs, Batch Generation with Patching, Key Takeaways, What's Next — plus a hands-on lab, quiz, and project artifact.
Create a free account to unlock Phase 0 and Phase 1 of every course — no credit card.
Browse all courses · View pricing · DeVenture Academy