I found the documentation on the While Loop, Transform and Set State nodes to be lacking, so I created this simple example.
What it Does:
The purpose of this workflow is to generate Haikus based on a list of subjects that are set in a state variable called a_list.
Start Node
There are two state variables set in the Start node: a_list and a_ctr. The a_list variable is set to a list of Haiku topics. The a_ctr will be used for the While loop.
While Loop
The While loop uses the size function on the a_list to determine the number of elements in the list and the a_ctr will keep track of the iterations through the list.
Transform Node
This node is needed to transform the item in a_list into a scalar called subject. An Agent node can only operate on scalar values.
Agent Node
This is the Agent that writes a Haiku based on the selected subject from the list.
Set State
This might be the most important step. We need to increment a_ctr so that we don’t loop endlessly.
There may have been a better way to do this, but I wanted to create an example that used some of the least documented aspects of Agent Builder.





