Accumulation Get Item | akatz-loops
Grab Any Single Value Out of a Loop's Accumulation
- accumulation
- *
Once you've run a loop with Akatz-Loop-Nodes, the interesting results stop being one image and start being a whole series - one per iteration. The pack carries that series around as an ACCUMULATION, and this node is its list[index]. Feed it the accumulation, tell it which iteration you want, and out pops that single value, whatever type it was. It's the difference between dumping every loop result and cherry-picking the one you actually care about.
An accumulation is exactly as simple as it sounds: internally it's a growing list ({"accum": [...]}) that the AccumulateNode keeps appending to each time the loop body runs. AccumulationGetItem just does accum[index] on that list and hands you the result. Because the output is the wildcard type *, you can pull an image, a latent, an int, or a string out of the same accumulation - the node doesn't care, and neither does the socket it plugs into.
The input that matters
Only two inputs exist, and you'll only touch one:
- accumulation - the ACCUMULATION socket from a loop body's
AccumulateNode. - index - which item to pull, zero-based, default
0.
That's it. Wire the accumulation in, set the index (or convert it to an input if you want a loop to walk the list itself), and you're done. The single * output wires into anything that consumed the original value type - a SaveImage for an image, a VAEEncode for a latent, a number slot for an int.
Why you'd reach for it
The typical shape is: a ForLoopOpen/ForLoopClose pair runs a refinement pass N times, each iteration's AccumulateNode grows the list, and at the end you want the best iteration - the third one, say - not the last one. Or you want to compare iteration 2 against iteration 9 without saving all ten. This is the node that makes that a one-wire grab instead of re-running the loop.
The one trap is the index. It's zero-based and there's no bounds guard in the node, so asking for item 10 of a 9-item accumulation raises an IndexError and kills the run. If your loop length is dynamic, check it first with AccumulationGetLength and clamp your index - or just be sure quantity in your loop is a constant you trust.
Install
The node ships in the Akatz-Loop-Nodes pack (akatz-ai). Via ComfyUI Manager, search "Akatz-Loop-Nodes" and install; or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/akatz-ai/Akatz-Loop-Nodes
Then restart ComfyUI. The pack's only Python dependency is opencv-python, which Manager installs for you; it's needed for the image nodes in the same pack, not for this one. No models to download.
One confusing thing you'll see on the node page: comfy.icu lists it under custom_nodes.ComfyUI-Execution-Inversion. That's lineage, not a requirement - the pack is a rework of BadCafeCode's execution-inversion loop demo, so the module paths inherited its name. You do not need that repo installed for this node to work; the Akatz pack is self-contained.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| accumulation | ACCUMULATION | — | |
| index | INT | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |