Get Started

Using Data Nodes (Set Value)

Using Data Nodes (Set Value)

Using Data Nodes (Set Value)

Learning to Use Nodes — Set Value Node

This tutorial walks you through the Set Value node in Agentria. The Set Value node sets a global variable value. Select the global variable to update in the Global Variable field, then enter a value or expression in the Set Value field — the result is stored in the selected global variable.

In this tutorial, you will build a "+1 Counter" workflow that starts the global variable num at 0, increments it by 1 using the Set Value node, and returns the final value once num reaches 10. The Loop node is used alongside to verify that the Set Value node correctly updates the global variable on each iteration.

Before You Begin

For instructions on how to enter the Agentria Canvas, refer to the 🔗3-Step Core Guide.

After completing this tutorial, you will be able to:

  1. Configure the Global Variable and Set Value fields of the Set Value node.

  2. Build a workflow that updates a global variable value using an expression.

  3. Set multiple global variables at once using +Add Item.

Workflow Overview




The core of this tutorial is the Set Value node.

The Set Value node evaluates the num + 1 expression on every iteration and stores the result in the global variable num. Without the Set Value node updating the global variable, the Loop node would always evaluate the condition against the initial value and the loop would never end. By updating num each iteration, the Loop node can check the latest value.

For detailed usage of the Loop node used in this tutorial, refer to the 🔗Loop Node Guide.

Step 1: Create an Ability

Create a new Ability on the Agentria Canvas.

Step 2: Arrange and Connect the Workflow

Add the following nodes to the Canvas and arrange them as shown in the image.


  • Set Value node: Click +Add Node → select from the Data category.

  • Loop node: Click +Add Node → select from the Flow Control category.


Once arranged, connect the edges in the following order.

  1. Out-Pin of Start Node → In-Pin of Set Value node

  2. Out-Pin of Set Value node → In-Pin of Loop node

  3. pass pin of Loop node → In-Pin of End Node

  4. loop pin of Loop node → In-Pin of Set Value node

Step 3: Open the Global Variables Tab

Open the left side panel on the Canvas and navigate to the Global Variables tab. Click + to start adding a global variable.

Step 4: Declare a Global Variable

Configure the global variable as follows.

Field

Value

Type

Integer

Name

num

Default

0

num is the counter's starting value. This tutorial uses the global variable's default value (0) as the counter's initial value.

Step 5: Configure the Set Value Node

Double-click the Set Value node to open the Node Editor.

The Set Value node provides the following options.

Option

Required

Description

Global Variable

Required

Select the global variable to update.

Set Value

Required

Enter a value or expression to set in the global variable. Drag and drop variables from Ability Variables on the left to complete the expression.

Setting the Global Variable

Select the global variable num in the Global Variable field.

Entering the Set Value

Enter the following expression in the Set Value field. Drag and drop num from Ability Variables on the left to complete it.

num + 1 adds 1 to the current value of the global variable num. With this configuration, the result of the num + 1 expression is stored in the global variable num on every iteration.

Setting Multiple Variables at Once

Click +Add Item in the Node Editor to add a new Global Variable / Set Value row. This lets you update multiple global variables in a single node.

Functions and Expressions Available in Set Value

In the Set Value field of the Set Value node, you can use not only arithmetic operators but also the built-in functions and constants listed below. Combined with variables, you can handle tasks such as averaging, rounding, sorting, and length calculation — all within a single node.

Available Functions and Constants

Category

Function/Constant

Description

Example

Type Conversion

str()

Convert to string

str(123)"123"


int()

Convert to integer

int("42")42


float()

Convert to float

float("3.14")3.14


bool()

Convert to boolean

bool(0)False


list()

Convert to list

list("abc")['a','b','c']


dict()

Convert to dictionary

dict(a=1, b=2){'a':1,'b':2}


tuple()

Convert to tuple

tuple([1,2])(1, 2)


set()

Convert to set

set([1,1,2]){1, 2}

Math/Aggregation

len()

Length

len(items)3


abs()

Absolute value

abs(-5)5


min()

Minimum value

min(3, 7, 1)1


max()

Maximum value

max(a, b, c)


sum()

Sum

sum(scores)


round()

Round

round(price * 1.1, 2)

Sequence Operations

sorted()

Sort

sorted(items, reverse=True)


reversed()

Reverse

list(reversed(items))


enumerate()

Index + value

list(enumerate(items))


zip()

Zip

list(zip(keys, vals))


range()

Number range

list(range(5))[0,1,2,3,4]

Constants

True

True

bool(x) == True


False

False

flag or False


None

Null value

value or None

Usage Examples

By combining these functions, you can write common operations in a single expression line — no separate Code node required.

Purpose

Expression

Calculate average

sum(scores) / len(scores)

Price with tax

round(price * 1.1, 2)

Unique item count

len(set(items))

Sort descending

sorted(values, reverse=True)

Range (max - min)

max(nums) - min(nums)

String to number + 1

int(text_value) + 1

Functions not listed above are not available. For more complex logic, use the 🔗Code Node (Python).

Step 6: Configure the Loop Node

Double-click the Loop node to open the Node Editor.

The Loop node checks the condition against the global variable num updated by the Set Value node.

Option

Value

Loop Condition

num < 10

Max Iterations

20

Enter the following expression in the Loop Condition field. Drag and drop num from Ability Variables to complete it.

While num < 10 is true, the flow returns to the Set Value node via the loop pin. When num reaches 10, the condition becomes false and the flow proceeds to the End Node via the pass pin.

Step 7: Check the Start Node

This tutorial uses the global variable's default value (0) as the counter's initial value, so no Input variables need to be declared in the Start Node. Leave the Start Node as is.

Step 8: Configure the End Node

Double-click the End Node to open the Node Editor.

Add the following variable in the Output Section.

Variable

Type

result

Integer

Drag and drop num from Ability Variables to bind it to result.

Step 9: Run the Ability Test

Click the Run Test button in the bottom-right corner of the Canvas. Proceed through Run TestRun TestRun to execute the full test.

The global variable num starts at 0. The Set Value node evaluates num + 1 and updates num, then the Loop node checks the num < 10 condition. When num reaches 10, the condition becomes false and the flow proceeds to the End Node via the pass pin.

Iteration

num (before check)

Set Value (num + 1)

num (after update)

Condition (num < 10)

1

0

+1

1

True (loop)

2

1

+1

2

True (loop)

3

2

+1

3

True (loop)

4

3

+1

4

True (loop)

5

4

+1

5

True (loop)

6

5

+1

6

True (loop)

7

6

+1

7

True (loop)

8

7

+1

8

True (loop)

9

8

+1

9

True (loop)

10

9

+1

10

True (loop)

11

10

False (pass)

Confirm that result: 10 is returned.

Step 10: Review Execution Results

In the Execution Monitor panel of the test window, review the step-by-step execution results of each node.

Next Steps

🎉 Congratulations! You've successfully built the "+1 Counter" workflow using Agentria.

Try updating multiple global variables at once using +Add Item, or change the expression to build more complex state management workflows.

Agentria is a place where ideas become reality—your workflow can expand infinitely with your creativity.