Skip to main content

Overview

Nodes are the fundamental building blocks of ComfyUI workflows. Each node represents a specific operation in the image generation pipeline, from loading models to applying effects. Nodes communicate through typed connections and execute in dependency order.

Node Class Structure

All ComfyUI nodes follow a common structure defined by the ComfyNodeABC base class:

Required Class Attributes

classmethod
required
Returns a dictionary defining node inputs in three categories:
  • required: Mandatory inputs for execution
  • optional: Optional inputs with defaults
  • hidden: Special inputs like prompt metadata
tuple
required
Tuple of output type strings (e.g., ("IMAGE", "MASK"))
string
required
Name of the method to execute when the node runs
string
Category path for organizing nodes in the UI (e.g., "loaders", "conditioning/controlnet")

Optional Class Attributes

boolean
Set to True for nodes that produce final outputs (like SaveImage)
tuple
Descriptive tooltips for each output
string
Detailed description of the node’s functionality
list
Alternative search terms for finding the node
boolean
Mark node as deprecated (still functional but discouraged)

Input Types

Built-in Types

ComfyUI provides standard types for common data:

Input Configuration

Inputs can include additional configuration:
any
Default value when not connected
number
Minimum allowed value (INT/FLOAT)
number
Maximum allowed value (INT/FLOAT)
number
Increment step for UI controls
boolean
Use multiline text input (STRING)
boolean
Enable dynamic prompt syntax (STRING)
string
Help text displayed to users
boolean
Hide in simple mode

Node Connections

Connections between nodes are represented as arrays:
Example:
This connects:
  • Node 1’s first output (index 0)
  • To Node 3’s first input (index 0)
  • Link ID 1
  • Data type: MODEL

Input Data Resolution

From execution.py:152-184, inputs are resolved at runtime:
Lazy Evaluation: Nodes can defer input evaluation until needed using the check_lazy_status method.

Node Execution

Map Over List Pattern

Nodes can process batched inputs using the map-over-list pattern:
From execution.py:232-308, the execution system handles batching:

Async Execution

Nodes can be asynchronous:
Async tasks are automatically managed:

Node Validation

Input Validation

Nodes can implement custom validation:
From execution.py:971-998, validation is called before execution:

Type Validation

Type checking happens automatically:

Special Node Features

Hidden Inputs

Nodes can access workflow metadata through hidden inputs:
These are automatically injected:

IS_CHANGED Method

Nodes can invalidate cache when inputs change:

Combo Inputs

Dynamic dropdown lists:

Node Categories

Loaders

Load models, images, and other resources
  • CheckpointLoaderSimple
  • VAELoader
  • LoraLoader

Conditioning

Create and modify text conditioning
  • CLIPTextEncode
  • ConditioningCombine
  • ConditioningSetArea

Sampling

Generate and refine latents
  • KSampler
  • SamplerCustom
  • KSamplerAdvanced

Latent

Manipulate latent space
  • VAEEncode
  • VAEDecode
  • LatentUpscale

Image

Process and transform images
  • ImageScale
  • ImageBlur
  • ImageComposite

Output

Save and export results
  • SaveImage
  • SaveLatent
  • PreviewImage

Example: Complete Node Implementation

See Also

Workflows

How nodes connect into workflows

Execution

How nodes are executed

Models

Loading and using models in nodes