Get Started

Using Flow Control Nodes (Merge)

Using Flow Control Nodes (Merge)

Using Flow Control Nodes (Merge)

Learning to Use Nodes β€” Merge Node

This tutorial walks you through the Merge node in Agentria. The Merge node waits for data to arrive from all connected paths before continuing the workflow. Selected variables are merged into an array ([]) and passed to the next node.

In this tutorial, you will build a "Data Merge" workflow that processes two strings a and b through separate Python nodes, then merges the results into a single array using the Merge node. This tutorial also covers how to use the AI Code Generator in a Python node.

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. Merge variables from multiple paths into an array using the Merge node.

  2. Use the AI Code Generator to automatically generate code in a Python node.

  3. Declare individual output variables by index from a merged array in the End Node.

Workflow Overview




The core of this tutorial is the Merge node.

The flow splits from the Start Node into two paths, each processed by a separate Python node. The Merge node waits until both paths finish processing, then combines the results into a single array and passes it to the End Node.

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.


  • Python node Γ— 2: Click +Add Node β†’ select from the Code category.

  • Merge node Γ— 1: 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 Python node A

  2. Out-Pin of Start Node β†’ In-Pin of Python node B

  3. Out-Pin of Python node A β†’ In-Pin of Merge node

  4. Out-Pin of Python node B β†’ In-Pin of Merge node

  5. Out-Pin of Merge node β†’ In-Pin of End Node

The Out-Pin of the Start Node can connect to multiple nodes simultaneously. The In-Pin of the Merge node accepts connections from both Python nodes.

Step 3: Configure the Start Node

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

Add the following variables in the Input Section.

Variable

Type

a

String

b

String

Step 4: Python Node A β€” Enter the AI Code Generator

Double-click Python node A to open the Node Editor.

Add a (String) in the Input Section and drag and drop a from the Start Node to connect it.

Click the icon at the top of the Edit Section to open the AI Code Generator. You can either write code directly or use the AI Code Generator to auto-generate it.

Step 5: Python Node A β€” Generate and Apply Code

Enter a prompt describing the desired behavior in the AI Code Generator field, then click Generate.

In this tutorial, generate code that capitalizes the first letter of a lowercase string.

result = a.capitalize()
result = a.capitalize()
result = a.capitalize()

Once the code is generated, click Apply to apply it to the node.

Check that an output variable is automatically added to the Output Section. If not, manually add result (String).

Step 6: Python Node B β€” Generate and Apply Code

Double-click Python node B to open the Node Editor.

Add b (String) in the Input Section and drag and drop b from the Start Node to connect it.

Follow the same steps as Steps 4–5. This time, use variable b.

result = b.capitalize()
result = b.capitalize()
result = b.capitalize()

Click Apply to apply to the node and confirm that result (String) appears in the Output Section.

Step 7: Configure the Merge Node

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

Click Add Item to add 2 rows. Drag and drop variables into each row as follows.

Row

Variable to connect

Row 1

result output of Python node A

Row 2

result output of Python node B

Once configured, the two result values are merged into an array ([]) and output as the merged variable.

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

Array []

Drag and drop merged from the Merge node 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 Test β†’ Run Test to open the input panel.

Enter hello for a and world for b, then click Run.

Once Python node A and B each finish processing, the Merge node combines the two results.

Path

Input

Processing

Output

Python node A

hello

capitalize

Hello

Python node B

world

capitalize

World

Merge node

β€”

merge

["Hello", "World"]

Confirm that result: ["Hello", "World"] 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.

Step 11: Declare Array Index Outputs

After the first test run, the merged array values become visible in the End Node editor.

Declare individual output variables by index to extract each value separately.

Variable

Value

result[0]

Hello

result[1]

World

Step 12: Review Final Results

The final results display the merged array along with each individual indexed value from every path.

Next Steps

πŸŽ‰ Congratulations! You've successfully built the "Data Merge" workflow using Agentria.

Try adding more Python nodes to create additional parallel paths, or connect the merged array to an AI model node or another Python node to build more advanced batch-processing workflows.

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