Skip to content

Template Node

The template node is one of the core components in FlowAI, capable of integrating inputs from multiple nodes into a single output. Through proper use of template nodes, you can achieve content reuse and variable merging, thereby simplifying complex workflows.

Node Configuration

Basic Settings

  1. Node Name

    • Set a descriptive name for the template node
    • Recommend using names that reflect the merging purpose, such as “Merge User Info”, “Integrate Order Data”, etc.
    • Naming convention: Use verb + noun format, like “Merge User Info”, “Integrate Order Data”
  2. Content Settings

    • You can directly input text and insert variables in the content area
    • Variable format is $variableName, for example $LLM1.result or $input.input
    • Supports insertion of multiple variables and custom text between variables

Output

- The merged content will be output as a new variable
- Output variable format is `$nodeName.template`, for example `$template1.template`

Usage Examples

1. Merging User Information

Let’s create a simple user information merging process, one of the most common scenarios in FlowAI:

  1. Input Node Configuration

    User Info Input Node Configuration

  2. Template Configuration

    Node Name: MergeUserInfo
    Content:
    User Name: $Start.name
    User Age: $Start.age
    User Address: $Start.address

    Note: Ensure all referenced variables exist before the template node!

    Template Configuration

  3. Output Node Configuration

    Process the merged content for subsequent operations Output Node Configuration

2. Integrating Order Data

A practical example - integrating multiple order information into one output, suitable for order processing, data analysis, and other scenarios:

  1. Input Node Configuration Order Info Input Node Configuration

  2. Template Configuration

    Node Name: IntegrateOrderData
    Content:
    Order Number: $Start.orderId
    Order Amount: $Start.amount
    Order Status: $Start.status

    Template Configuration

  3. Processing Node Configuration

    For example, you can:

    • Send integrated order data to database
    • Send integrated order data to email system
    • Send integrated order data to reporting system

3. Message Template Generation

Demonstrating how to use template nodes to generate message templates, suitable for message pushing, notification sending, and other scenarios:

Node Name: Generate Message Template
Content:
Dear $Start.name:
Your order $Start.orderId has been $Start.status.
Thank you for your support!

Message Template Generation Configuration

Advanced Usage

1. Nested Templates

You can achieve complex logic by connecting multiple template nodes, suitable for multi-level content integration and complex business rules:

[User Info Template] --> [Order Info Template] --> [Message Template Generation]

2. Combined Template Example

Using multiple variables and custom text in one template node, suitable for scenarios requiring simultaneous integration of multiple variables:

Node Name: GenerateReport
Content:
Report Date: $Start.date
Total Users: $Start.userCount
Total Orders: $Start.orderCount
Total Sales: $Start.totalSales

Best Practices

  1. Content Design Principles

    • Pay attention to variable naming conventions
    • Ensure variables exist before the template node
    • Use comments to explain business meaning of each variable
    • Keep content logic simple and maintainable
  2. Variable Handling

    • Verify variable existence before templating
    • Consider data type consistency
    • Mind variable scope
  3. Error Handling

    • Add default value handling for exceptional cases
    • Add logging at critical template nodes
    • Consider necessity of data validation

Common Issues

Debugging Tips

Using Output Nodes Add output nodes after each template node to help debug the flow:

[Template Node] --> [Output Node(Print Template Result)]

Through proper use of template nodes, you can build flexible and powerful workflows. Remember to carefully plan templating logic and ensure variable completeness and consistency to guarantee reliable workflow operation.

Need a Custom AI Agent?

Custom AI agents designed for real-world business operations.