Comfy UI

Action ID: comfy_ui

Description

Run any ComfyUI workflow.

Connection

Name
Description
Required
Category

PixelML Connection

The PixelML connection to call PixelML API.

True

pixelml

Input Parameters

Name
Type
Required
Default
Description

workflow_json

string

-

Default SDXL workflow

Your ComfyUI workflow in API format JSON. Export from ComfyUI using 'Save (API format)'

View JSON Schema
{
  "description": "Comfy UI node input.",
  "properties": {
    "workflow_json": {
      "default": "{\"3\":{\"inputs\":{\"seed\":156680208700286,\"steps\":10,\"cfg\":2.5,\"sampler_name\":\"dpmpp_2m_sde\",\"scheduler\":\"karras\",\"denoise\":1,\"model\":[\"4\",0],\"positive\":[\"6\",0],\"negative\":[\"7\",0],\"latent_image\":[\"5\",0]},\"class_type\":\"KSampler\",\"_meta\":{\"title\":\"KSampler\"}},\"4\":{\"inputs\":{\"ckpt_name\":\"SDXL-Flash.safetensors\"},\"class_type\":\"CheckpointLoaderSimple\",\"_meta\":{\"title\":\"Load Checkpoint\"}},\"5\":{\"inputs\":{\"width\":1024,\"height\":1024,\"batch_size\":1},\"class_type\":\"EmptyLatentImage\",\"_meta\":{\"title\":\"Empty Latent Image\"}},\"6\":{\"inputs\":{\"text\":[\"10\",0],\"clip\":[\"4\",1]},\"class_type\":\"CLIPTextEncode\",\"_meta\":{\"title\":\"CLIP Text Encode (Prompt)\"}},\"7\":{\"inputs\":{\"text\":[\"11\",0],\"clip\":[\"4\",1]},\"class_type\":\"CLIPTextEncode\",\"_meta\":{\"title\":\"CLIP Text Encode (Prompt)\"}},\"8\":{\"inputs\":{\"samples\":[\"3\",0],\"vae\":[\"4\",2]},\"class_type\":\"VAEDecode\",\"_meta\":{\"title\":\"VAE Decode\"}},\"9\":{\"inputs\":{\"filename_prefix\":\"ComfyUI\",\"images\":[\"8\",0]},\"class_type\":\"SaveImage\",\"_meta\":{\"title\":\"Save Image\"}},\"10\":{\"inputs\":{\"name\":\"prompt\",\"value\":\"beautiful scenery nature glass bottle landscape, purple galaxy bottle,\"},\"class_type\":\"StringInput_PixelML\",\"_meta\":{\"title\":\"StringInput_PixelML\"}},\"11\":{\"inputs\":{\"name\":\"negative_prompt\",\"value\":\"text, watermark\"},\"class_type\":\"StringInput_PixelML\",\"_meta\":{\"title\":\"StringInput_PixelML\"}}}",
      "description": "Your ComfyUI workflow as JSON. You must use the API version of your workflow. Get it from ComfyUI using 'Save (API format)'",
      "title": "Workflow JSON (API Format)",
      "type": "string"
    }
  },
  "title": "ComfyUINodeInput",
  "type": "object"
}

Output Parameters

Name
Type
Description

outputs

array

Array of image URLs generated by the ComfyUI workflow

View JSON Schema
{
  "description": "Comfy UI node output.",
  "properties": {
    "outputs": {
      "items": {
        "title": "Output",
        "type": "string"
      },
      "title": "List outputs",
      "type": "array"
    }
  },
  "required": [
    "outputs"
  ],
  "title": "ComfyUINodeOutput",
  "type": "object"
}

How It Works

This node executes custom ComfyUI workflows through the PixelML API, allowing you to leverage ComfyUI's powerful node-based image generation capabilities within your AgenticFlow workflows. You provide your ComfyUI workflow in API JSON format (exported from ComfyUI), and the node processes it remotely, returning URLs to the generated images for further use in your workflow pipeline.

Usage Examples

Example 1: Basic Text-to-Image Generation

Input:

workflow_json: {
  "3": {
    "inputs": {
      "seed": 42,
      "steps": 20,
      "cfg": 7.0,
      "sampler_name": "euler",
      "scheduler": "normal",
      "denoise": 1,
      "model": ["4", 0],
      "positive": ["6", 0],
      "negative": ["7", 0],
      "latent_image": ["5", 0]
    },
    "class_type": "KSampler"
  },
  "10": {
    "inputs": {
      "name": "prompt",
      "value": "professional portrait of a business woman in modern office, natural lighting"
    },
    "class_type": "StringInput_PixelML"
  }
  // ... additional nodes
}

Output:

outputs: [
  "https://storage.pixelml.com/outputs/comfyui_12345_0.png"
]

Example 2: Batch Image Generation

Input:

workflow_json: {
  "5": {
    "inputs": {
      "width": 512,
      "height": 768,
      "batch_size": 4
    },
    "class_type": "EmptyLatentImage"
  },
  "10": {
    "inputs": {
      "name": "prompt",
      "value": "fantasy landscape with mountains and rivers, concept art style"
    },
    "class_type": "StringInput_PixelML"
  }
  // ... additional nodes
}

Output:

outputs: [
  "https://storage.pixelml.com/outputs/comfyui_67890_0.png",
  "https://storage.pixelml.com/outputs/comfyui_67890_1.png",
  "https://storage.pixelml.com/outputs/comfyui_67890_2.png",
  "https://storage.pixelml.com/outputs/comfyui_67890_3.png"
]

Example 3: Image-to-Image with ControlNet

Input:

workflow_json: {
  "12": {
    "inputs": {
      "image": "https://example.com/input-sketch.png",
      "control_net": "control_v11p_sd15_canny"
    },
    "class_type": "ControlNetLoader"
  },
  "10": {
    "inputs": {
      "name": "prompt",
      "value": "realistic photo based on sketch, professional photography"
    },
    "class_type": "StringInput_PixelML"
  }
  // ... additional nodes
}

Output:

outputs: [
  "https://storage.pixelml.com/outputs/comfyui_24680_0.png"
]

Common Use Cases

  • Custom AI Image Generation: Execute complex ComfyUI workflows with custom models, LoRAs, and processing chains

  • Automated Content Creation: Generate product images, marketing visuals, or social media content at scale

  • Image Processing Pipelines: Apply sophisticated image transformations like upscaling, inpainting, or style transfer

  • Batch Image Production: Generate multiple variations of images with different seeds or parameters in one workflow run

  • ControlNet Integration: Use advanced conditioning methods like pose, depth, or canny edge detection for precise image generation

  • Custom Model Workflows: Leverage specialized fine-tuned models or custom trained checkpoints not available in standard tools

  • Complex Multi-Stage Generation: Chain multiple generation steps, refinements, and post-processing in a single workflow

Error Handling

Error Type
Cause
Solution

Invalid JSON Format

workflow_json is not valid JSON

Ensure the workflow is properly formatted JSON from ComfyUI's API export

Missing Required Nodes

Workflow missing essential nodes like SaveImage

Include all necessary nodes; ensure at least one SaveImage node exists

Invalid Node Configuration

Node inputs reference non-existent nodes or outputs

Verify all node connections and references are correct in the workflow

Model Not Found

Referenced checkpoint or model doesn't exist on server

Use models available in the PixelML environment or check model names

Insufficient Resources

Workflow requires more GPU memory than available

Reduce batch size, image resolution, or simplify the workflow

Connection Timeout

PixelML API connection failed or timed out

Check your PixelML connection settings and network connectivity

Execution Failed

ComfyUI workflow execution encountered an error

Review the workflow for errors; test locally in ComfyUI first

Notes

  • PixelML Connection Required: This node requires a valid PixelML connection to execute ComfyUI workflows remotely.

  • API Format Only: You must export your workflow using ComfyUI's 'Save (API format)' option, not the regular workflow format.

  • StringInput_PixelML Nodes: Use StringInput_PixelML nodes in your workflow to make it dynamic and accept parameters from AgenticFlow.

  • Model Availability: Only models and custom nodes available in the PixelML environment can be used; not all local custom nodes may be supported.

  • Output Image Storage: Generated images are temporarily stored and accessible via URLs; download or save them for long-term use.

  • Workflow Complexity: Complex workflows with many nodes may take longer to execute; consider execution time in your workflow design.

  • Testing: Always test your ComfyUI workflow locally before integrating it into AgenticFlow to ensure it works correctly.

  • Batch Processing: The outputs array will contain multiple URLs if your workflow generates multiple images via batch_size or multiple SaveImage nodes.

Last updated

Was this helpful?