Add to state list - Writer AI Studio

Overview

This block adds a string value to a list in the agent’s state. It behaves differently depending on the state element’s type:

The Add to state list block only accepts string values. If you pass a value such as a dictionary, it will be converted to a string and added to the list.

Example

The following example shows an Add to state list block as part of a For-each workflow. The For-each loop block iterates over a list of values and generates text for each value. Then, the Add to state list block adds the result of each iteration to the state list called text_gen_results. On the initial run, the Add to state list block creates the state element and adds the first value to it. Every subsequent run, the block adds the next value to the list.

Fields

Name Type Control Default Description Options Validation
Link Variable Binding - - Set the variable here and use it across your agent. - -
Value Text Textarea - - - -

End states

Below are the possible end states of the block call.

Name Field Type Description
Success - success The item was added to the list.
Error - error There was an error adding the item to the list.