Sow
Stash values mid-loop, collect them at the end
- signal
- value
- *
Sow is the "collect things as you go" half of the Sow/Reap pair from ComfyUI Functional. Think of it as a bucket you drop values into while a loop runs, so you can pull them all out at the end as one list. Without it, gathering per-iteration results from a Map or Nest means inventing some accumulator plumbing; with it, you just tag a bucket, throw values in, and keep moving.
It pairs with the pack's whole pitch - defining functions inline, mapping them over lists, building loops in the node editor. When your loop produces something worth keeping on every iteration (a score, a mask, a preview), Sow is the natural place to record it. The example workflow functional-sow-reap.json ships in the repo and shows the pattern.
Inputs:
signal- any value; used only to force execution order. Chain it through the nodes that must finish before the Sow fires.value- the thing you're saving.tag- a plain string (default"default"), the bucket's name. Give each collection its own tag so Reap can pull them apart.
Output: a single wildcard socket that passes signal straight through, so the chain continues.
Under the hood it's dead simple: Sow appends value into a global per-tag list, and Reap returns that list and clears it. What makes it safe is the pack's execution hook - every run calls reset_reap_storage(), so yesterday's leftovers never leak into today's results. Also note IS_CHANGED returns NaN, which is the pack's way of saying "this node must run every time" - that's what disables caching around side-effect nodes and keeps results honest, at the cost of slower reruns.
Install
From the single pack, via Manager (search Duanyll/comfyui_functional) or:
cd ComfyUI/custom_nodes && git clone https://github.com/Duanyll/comfyui_functional
then restart ComfyUI. No models, no extra pip deps. Pair with Basic Data Handling so your arrays are LIST-typed - feeding ComfyUI's native Data List into these nodes can freeze the graph.
Gotchas
- Ordering is your job. Sow doesn't invent execution order; it only runs when the signal chain reaches it. If two Sows race, you get whatever order ComfyUI happened to evaluate, which is why the README harps on chaining
signaldeliberately. - Reap clears the bucket. A Reap drains everything sown under its tag, so a second Reap on the same tag in one run comes back empty. Harvest once, then move on.
- Expect slower runs. Side effects disable caching; that's the trade for results that aren't stale.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| signal | * | — | |
| value | * | — | |
| tag | STRING | default | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |