Skip to content

Accumulate

Builds up an ordered list of values across steps or iterations. Each call appends the provided value to an accumulation container, gracefully handling first-time initialization and no-op behavior when the value to add is None.
Preview

Usage

Use this node when you need to collect multiple values over time into a single list, such as aggregating results from a loop or conditional branch. Feed the 'accumulation' output back into the next call's 'accumulation' input to keep appending values, and supply the new item via 'to_add'.

Inputs

FieldRequiredTypeDescriptionExample
to_addTrueWILDCARDThe next item to append to the accumulation. Accepts any type. If this is None, the node will not add anything and will forward the existing accumulation.42
accumulationFalseACCUMULATIONThe current accumulation container. If omitted or None, a new accumulation is started. Can be either a proper ACCUMULATION object or a raw value (which will be normalized).{"accum": ["a", "b"]}

Outputs

FieldTypeDescriptionExample
accumulationACCUMULATIONThe updated accumulation container with the newly added item (if provided). Internally represented as an object with an 'accum' list.{"accum": ["a", "b", "c"]}

Important Notes

  • Skips None values: If 'to_add' is None, the output simply forwards the existing accumulation (or creates an empty one if none exists).
  • Initialization behavior: If no prior accumulation is provided, the node starts a new one containing only 'to_add' (unless 'to_add' is None, in which case it starts empty).
  • Flexible input: If 'accumulation' is a proper ACCUMULATION (with an 'accum' list), the item is appended. If a raw value is provided as 'accumulation', it is normalized and the output becomes [accumulation, to_add].
  • Order preserving: Items are appended in the order the node is executed.
  • Type-agnostic: The accumulator can mix different value types in one list.
  • Error handling: On internal errors, the node returns an empty accumulation {"accum": []}.

Troubleshooting

  • Items are not appearing in the list: Ensure 'to_add' is not None for the steps where you expect an item to be appended.
  • Accumulation resets unexpectedly: Verify you are reconnecting the previous 'accumulation' output back into the next node's 'accumulation' input each iteration.
  • Unexpected first elements: If you pass a non-ACCUMULATION value into 'accumulation', the node will treat it as the first element and append 'to_add'. Use a proper ACCUMULATION or the previous output to avoid this.
  • Empty result: If you see {"accum": []}, you may have started with None and 'to_add' was None, or an error occurred upstream. Provide a valid 'to_add' or confirm prior steps.
  • Mixed types issues downstream: Downstream nodes must handle mixed types if you accumulate heterogeneous items. Filter or standardize types before accumulation if needed.