Skip to main content

Loops


Intro

The loops node allows you to map over an object of items and run a specific trigger for every item of them.

Please note that this node is still under development.


How this node works

this node will get an object of items and map over them, while mapping it will save each item's value as a parameter and pass it to the trigger given to it.

This node is a little bit different compared to other nodes and it's functionality may change forward over time.


How to use this node response

This node is not yet capable of saving responses so It's not accessible using the koxy.res.{NODE_NAME} syntax.

The nodes that the loop triggers will save their response as NODE_NAME.LOOP_ITEM_VALUE, example: if we have a loop called loop1 and it triggers an AI node one time with an item called "prompt1", the AI node's response will be saved as model1.prompt1 and it can be accessed using the koxy.res.{model1.prompt1} syntax.

We are facing an issue with this. See known issues


Node properties

  • name: node names should be unique and can't be changed.

  • Trigger: This will be called for each item as described above (using flows as loops triggers is not recommended).

  • Items: an object of items you want to loop over.

  • Next: the trigger that the node should call after looping over all the items. click on the next input to get a list of available triggers.


How to get the current item value

To use this node in the right way You need to understand its functionality. this node will save a dynamic parameter each time it maps over an item in the items object, in the triggered node (You entered as your loop's trigger) you can get the current item value using the koxy.get.{LOOP_NAME} syntax. (The LOOP_NAME is the name you give to your loop node).


Example

Coming soon.


Dynamic variables support

You can use Dynamic variables in the following properties:

  • Trigger.

  • Items.


Known issues

  • In some cases any node the loop will trigger (Trigger input) won't save any response even if It supports saving responses so its response can't be accessed using the koxy.res.{NODE_NAME.LOOP_ITEM_VALUE} syntax.

  • In some cases the triggered node will save only the last response.