ComfyUI setup for coding agents
Give your coding agent this page and a copy of your ComfyUI workflow. It explains how to expose prompts, controls and image inputs in SQUAD Studio, and how to return the finished image to your canvas.
The workflow should already work in ComfyUI. If you want a small example to start from, download the SDXL starter workflow. It already has SQUAD's input and output titles. Your ComfyUI installation still needs its node types and the checkpoint named in the file.
Give your agent this task
Copy this brief and add the path to your workflow file:
Prepare a copy of my ComfyUI workflow for SQUAD Studio using this guide. Keep my original file. Inspect the API-format JSON and, where available, the selected ComfyUI endpoint's node schema. Use the node titles below to expose only the controls I need. Preserve the working graph, model choices and connections unless a change is needed for those controls. Tell me about any missing node, model or ambiguous input rather than inventing a replacement. Return the edited JSON, a table of exposed inputs and outputs, and the checks you completed. Stop before validation or generation unless I have authorized a test run. If you cannot reach ComfyUI or operate SQUAD Studio, list those checks as pending.
1. Start with API-format JSON
Use ComfyUI's API export. Depending on your version, the command may be called Export Workflow (API) or Save (API Format). A normal saved workflow and an API export both end in .json, so check the contents. An API graph is an object keyed by node IDs. Each node has class_type and inputs; its title is stored in _meta.title. Connections look like ["4", 0], meaning output zero from node 4. See ComfyUI's API-format guide.
Import the graph itself, not an HTTP request wrapper containing a prompt property. Every top-level entry must be a node; keep request fields such as client_id and extra_data out of this file. SQUAD's workflow import accepts files up to 2 MB.
Keep node IDs, class_type, model filenames and links intact. Change a node's title, not its type. After exporting from the editor, inspect the JSON to confirm the titles survived.
2. Use these exact titles
The whole title must be one marker. Write IN and OUT in uppercase, with the dollar signs on both ends.
| Title | Purpose |
|---|---|
$IN prompt$ |
Expose a text value as the main prompt. |
$IN reference_image$ |
Expose the image file input of a core LoadImage node. |
$IN steps$ |
Expose a numeric value as an ordinary control. |
$OUT result$ |
Mark a result on a SaveImage node. |
Use a distinct name for each input and each output. Names are case-insensitive, so Prompt and prompt collide. Lowercase names with underscores are easiest to reuse. Do not put a colon (:) in an input name; text after the last colon is treated as a suffix rather than part of the name. Do not append a description outside the marker: My prompt $IN prompt$ is not a recognized title.
Bare $IN$ and $OUT$ are also supported, but their names come from the graph. Prefer explicit names so an agent does not accidentally expose a field as value when you meant seed.
Every workflow needs at least one marked image output. Use SaveImage for a returned result. PreviewImage produces temporary images that SQUAD does not collect, even if readiness accepts its title. When adapting a preview-only result, replace that node with SaveImage in the copy, preserving its images connection and setting a filename prefix.
SQUAD collects all saved image results from the run, including images saved by unmarked nodes. The $OUT title does not filter that collection. Report extra save nodes and confirm which results the user wants before removing or rerouting them. Inputs are optional: an upscaler does not need a prompt just to satisfy SQUAD.
Names with special behavior
| Name | Required value | Behavior |
|---|---|---|
prompt |
Text | Main prompt area. |
negative |
Text | Larger negative-prompt area. |
width, height |
Number | Dimensions supplied from the bot frame. |
seed |
Number | Variation control. |
batch_count |
Number | Set to 1 per Comfy job; SQUAD creates separate jobs for requested variations. |
Other names become ordinary controls. Naming something cfg does not define its limits. The selected endpoint's schema supplies the type, choices, range and step.
3. Make each input unambiguous
One marked API node exposes one literal input value. A literal is a value stored on that node, rather than a link to another node.
SQUAD chooses the value in this order:
- If the marker name matches a literal input key, ignoring case, use that key.
- For
LoadImageandLoadImageMask, use the literalimagefield. Keep other settings, such as the mask channel, intact. - Otherwise, use the node's sole literal input. If there are zero or several, fix the binding rather than guessing.
For example, a CLIPTextEncode node with a linked clip input and literal text can be titled $IN prompt$. Its only literal value is text.
This fragment illustrates the shape; it is not a complete workflow. Keep your own node IDs and connections:
{
"6": {
"class_type": "CLIPTextEncode",
"inputs": { "clip": ["4", 1], "text": "a forest at sunrise" },
"_meta": { "title": "$IN prompt$" }
},
"9": {
"class_type": "SaveImage",
"inputs": { "images": ["8", 0], "filename_prefix": "SQUAD" },
"_meta": { "title": "$OUT result$" }
}
}
A KSampler with literal seed, steps, cfg and other settings can expose steps with $IN steps$. Calling that same node $IN custom$ is ambiguous. To expose several values, connect separate value nodes supported by your installed ComfyUI and mark each one. Do not invent a node type or assume an editor-only helper survives API export.
For image references, title a core LoadImage node $IN reference_image$. For masks, title a core LoadImageMask node $IN subject_mask$. If the graph uses a custom loader, report it rather than assuming a new title will turn its file widget into a reference slot. Give multiple inputs distinct names so creators can select the intended reference. Preserve mask-channel settings and existing mask processing; renaming a node does not correct an inverted mask or change its wiring.
4. Check the actual ComfyUI installation
Use the selected endpoint's GET /object_info response to check the graph's node classes and exposed input schemas. Supported controls include text, numbers, booleans, choice lists, images and masks. Internal values such as MODEL, CLIP, VAE, LATENT and CONDITIONING are not creator controls; neither are audio and video. Keep them connected inside the graph.
Check model filenames against that endpoint's available choices, including subfolders. Keep the user's existing working model choice. SQUAD does not install or distribute ComfyUI's model weights. Missing dependencies need an explicit resolution, not a guessed filename.
In SQUAD, open Engines → Comfy endpoints and use Check connection. For Single User with ComfyUI on the same computer, the Base URL is commonly http://127.0.0.1:8188. For a team, the team host makes the request, so that address means the host's computer. Use the actual reachable address and port for ComfyUI on another machine. 0.0.0.0 is a listen address, not a destination URL. Headless mode is not a requirement. Follow Comfy endpoints for connection troubleshooting; do not disable a firewall or expose ComfyUI to the internet to make a local test pass.
5. Verify it in SQUAD Studio
- Import the copy in Bot Squads. Give it a recognizable name. An imported workflow has its first published version; changes in RAW Editor remain drafts until you publish them.
- Open the workflow's Overview, choose the intended ComfyUI endpoint and inspect Comfy readiness. Resolve missing nodes, unsupported types, duplicate names and ambiguous bindings.
- When a test run is authorized, choose Validate Using Comfy. This submits a prompt and attempts to cancel it after acceptance. It also uploads a small placeholder image to ComfyUI's input folder when the workflow loads images. It can start or finish work before cancellation; it is not a guaranteed dry run. Direct
POST /promptcalls also queue work, as ComfyUI's route documentation explains. - Once validation succeeds, make the workflow active and run it from a bot on a test canvas. Confirm the returned image appears. Change an exposed control and verify the next run uses it. For image and mask inputs, check that the intended reference and masked area are used.
Connection success, readiness and validation are separate checks. None alone proves the finished image returns correctly to SQUAD. If the agent cannot perform the canvas test, leave it pending for the person using the app.
What the agent should hand back
Return the edited API JSON and a short report containing:
- Each marked node's ID,
class_type, exact title, bound input key and schema type; list outputs separately. - Changes made to the graph and any node or model dependency still missing.
- Results for endpoint connection, readiness, validation and the canvas run, with unperformed checks marked pending.
Keep endpoint credentials out of the workflow file and report. For more about creating a bot from the imported workflow, continue with Workflows and bot squads.