AK Pipe Loop
The 'latest change wins' pipe merger for branching workflows
- pipe_in_1
- pipe_in_2
- pipe_in_3
- pipe_in_4
- pipe_in_5
- pipe_in_6
- pipe_in_7
- pipe_in_8
- pipe_in_9
- pipe_in_10
- pipe_out
- model
- clip
- vae
- positive
- negative
- latent
- image
When a workflow gets big enough that model, clip, vae, both conditionings, latent, and image all travel together, you reach for a pipe - one wire carrying the whole bundle. The AK Pack's answer is a pair of nodes: AK Pipe builds and updates the bundle, and AK Pipe Loop decides which bundle to hand off when several branches feed into one spot.
The README describes AK Pipe Loop in one line: it "always outputs the most recently modified connected AK Pipe." That's the whole pitch, and it's genuinely useful in iterative workflows where you have multiple parallel branches mutating state and you want to follow whoever changed last.
How it works
AK Pipe Loop takes up to ten pipes in - pipe_in_1 is required, pipe_in_2 through pipe_in_10 are optional - and, unlike most merge nodes, it doesn't blend anything. Each AK pipe carries a small hash of its contents. On every run the node compares each input's hash to what it saw last time; the first input whose hash changed becomes the winner and its contents are passed through. If nothing changed this run, it falls back to the last non-empty pipe you gave it.
There are two details that make this work. First, the node forces itself to re-run every cycle (IS_CHANGED returns NaN), so it always gets a chance to notice a changed input. Second, it keeps per-instance state across runs, so "changed since last run" is a real comparison rather than a guess. The hashing only works if your pipes came out of AK Pipe (or anything else that writes the 8-field AK_PIPE format) - the hash is stored inside the pipe tuple itself, and the node normalizes older 7-field pipes by treating them as "never changed."
The outputs are the whole bundle plus its unpacked parts: pipe_out, model, clip, vae, positive, negative, latent, image. So you can either keep the pipe and pass it along, or grab just the pieces you need.
When you'd actually use it
- Several branches each produce a finished pipe (say, different LoRA/upscale paths), and you want whatever branch you last touched to drive the next stage.
- An interactive loop where you tweak a parameter on one branch and want the pipeline to follow that branch on the next run.
- Any place a plain merge node would have you fighting over "which input wins" - here the most recent edit wins, automatically.
It's a niche tool. For the common case - "merge these two pipes, values from whichever is connected" - AK Pipe itself or a simple switch does the job. Reach for Pipe Loop when the recency of the edit is the signal you care about.
Install
Standard AK Pack install. ComfyUI Manager, search "AK Pack", install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/akawana/ComfyUI-AK-Pack
No extra dependencies, no model files.
Gotchas
- Pipes only work if the whole chain uses AK pipes. Feed it a pipe from another pack (many are 7-field or dict-shaped) and the hash detection quietly degrades - it'll still pass something through, but "most recently modified" stops being reliable.
- It's a passthrough, not a mixer. Values from the losing pipes are discarded, not merged. If you want field-level merging, use AK Pipe with multiple inputs instead.
- Because it's an output node that always re-runs, it can keep downstream nodes active even when nothing meaningful changed. Fine for a small graph; worth knowing if you're chasing why something won't idle.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| pipe_in_1 | AK_PIPE | — | |
| pipe_in_2opt | AK_PIPE | — | |
| pipe_in_3opt | AK_PIPE | — | |
| pipe_in_4opt | AK_PIPE | — | |
| pipe_in_5opt | AK_PIPE | — | |
| pipe_in_6opt | AK_PIPE | — | |
| pipe_in_7opt | AK_PIPE | — | |
| pipe_in_8opt | AK_PIPE | — | |
| pipe_in_9opt | AK_PIPE | — | |
| pipe_in_10opt | AK_PIPE | — |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| pipe_out | AK_PIPE | — |
| model | MODEL | — |
| clip | CLIP | — |
| vae | VAE | — |
| positive | CONDITIONING | — |
| negative | CONDITIONING | — |
| latent | LATENT | — |
| image | IMAGE | — |