Variables are a powerful way to pass around data from one step to another or from the initial input you defined on the Start step to any action step. This is data that is either defined before running, or will be defined during the execution of your workflow.
When are variables defined?
Variables come from 2 different places. They can either come from each field you define in your Start step or from each action step’s output. Since we know what each action step will output, we can suggest the different variables that you can use for that action step.
When you are going to reference a variable defined from the Start Step, it will show up like this in the autocomplete dropdown, the example is the default you set for it. If it says
input this means it’s coming from the Start Step, then one bottom left you see the variable name, in this case
topic, and lastly the
e.g. is what you defined the default to be, but this will be the value which you define when running the workflow.
When the variable will come from the output of an action step, you will see something like this:
This is very similar to the structure shown for the input variable, but now you see the name of the action node, and here you can see the
model variable, which is defined under
step1, you can see the step number of your action step, by looking at the pill on it.
How to use a variable
To use a variable within a step, simple type the
@ symbol to trigger the variable autocomplete feature. You will then see a dropdown telling you which variables you can reference. As you can see from the screenshot below, I typed the
@ symbol to show me which variables are available, I see a
topic variable available from the
input and I also see the variables that would be returned from the output of
Once I select it, you can see it is now highlighted in green, letting me know that this is a variable being used. Since I selected the variable from the
input which will come from the Start Step, this means that this variable will be defined at the time in which I run the workflow, so if I passed in
Star Wars as the
topic which is the variable we chose, then the message sent to the AI will be
Tell me a joke about Star Wars.
Here you can see an example of what a variable referencing the output of a step looks like: