LogoLogo
Documentation
Documentation
  • Getting Started
    • Introduction
    • Sign up to Developer Edition
    • Build Your First Agent
    • Developer Support
  • Core Concepts
    • Agent
      • Knowledge
      • Webhook
    • PII Masking
    • Sub-Agent
    • Intent
    • Workflow
      • Node
        • Input
        • Output
        • Loader
        • Display
        • API Node
        • Web Crawler
        • Table Write
        • Table Read
        • Ruleset
        • Upload Document
        • Javascript
        • Workflow
        • Loop
        • Document To Image
        • External Database
        • Storage Write
        • Storage Read
        • Fetch Document
        • Prompt
        • RAG Query
        • Vector Search
        • Emit Event
    • RAG
    • Model Hub
      • Entity Recognizers
    • Data Gateway
    • Rulesets
    • Code Snippets
    • Tables
    • Storage
    • Widget
  • Overview of GenAI
    • Introduction
    • Key concepts
      • Intent Classification
      • Inference
      • Generative AI Models
      • Large Language Models (LLMs)
      • Prompt Engineering
      • AI Agents
      • RAG (Retrieval Augmented Generation)
      • AI Workflow Automation
      • AI Agents vs LLM-based APPs
Powered by GitBook
On this page
  • Overview
  • Configurations
  • Example Use-Cases
  • Key Takeaways for Developers
Export as PDF
  1. Core Concepts
  2. Workflow
  3. Node

Loop

Overview

The Loop Node in UPTIQ Workbench allows workflows to repeatedly execute a process until a specified exit condition is met. This is particularly useful for iterating over lists, verifying input validity, or ensuring a task completes before proceeding.

By using the Loop Node, developers can: ✅ Handle Iterative Processing – Process lists of items dynamically. ✅ Validate User Input Repeatedly – Ensure correct data entry before proceeding. ✅ Create Conditional Workflows – Execute repeated steps based on runtime conditions.

Unlike static workflows, the Loop Node dynamically determines whether to continue execution or exit based on real-time data evaluation.

Configurations

Field
Description

Exit Condition

A condition (in natural language) that, when met, will cause the loop to exit. If not met, the loop continues.

Execution Flow:

1️⃣ The Loop Node receives input from previous steps. 2️⃣ It evaluates the exit condition based on the provided data. 3️⃣ If the condition is met, the node outputs {"action": "exit"} and the loop terminates. 4️⃣ If the condition is NOT met, it outputs {"action": "continue"}, repeating the process.

Output Format

Action
Description

{ "action": "continue" }

Loop continues.

{ "action": "exit" }

Loop stops execution.

Example Use-Cases

Use-Case 1: Validating User Email Input

A workflow requires users to enter a valid email before proceeding. The Loop Node repeats the request until a valid email format is entered.

Configuration:

Field
Value

Exit Condition

userInput should be a valid email

Execution Process:

  • If the user enters an invalid email, the node outputs:

    { "action": "continue" }

    🔹 The workflow asks the user to re-enter their email.

  • Once the user enters a valid email, the node outputs:

    { "action": "exit" }

    🔹 The workflow proceeds to the next step.


Use-Case 2: Iterating Through a List of Questions

A chatbot is programmed to ask multiple questions, and the workflow loops until all questions are answered.

Configuration:

Field
Value

Exit Condition

"If we don’t have any questions left to ask"

Input to Loop Node:

{ "questions": ["Q1", "Q2", "Q3"] }

Execution Process:

1️⃣ First Iteration → The bot asks Q1, removing it from the list.

{ "action": "continue" }

2️⃣ Second Iteration → The bot asks Q2, removing it from the list.

{ "action": "continue" }

3️⃣ Third Iteration → The bot asks Q3, removing it from the list.

{ "action": "exit" }

🔹 Once no questions remain, the workflow exits the loop.


Use-Case 3: Retry Logic for API Requests

A workflow fetches data from an external API. If the API fails, the Loop Node retries the request until a successful response is received or retries are exhausted.

Configuration:

Field
Value

Exit Condition

"API response is successful or retry count exceeds 3"

Execution Process:

1️⃣ If the API fails, the node outputs:

{ "action": "continue" }

🔹 The API call is retried.

2️⃣ If the API succeeds or retries reach 3, the node outputs:

{ "action": "exit" }

🔹 The workflow proceeds to handle the response or logs an error.


Key Takeaways for Developers

✅ Automates Loop Execution – Runs a process repeatedly until a condition is met.

✅ Uses Natural Language for Exit Conditions – Unlike traditional programming logic, the Loop Node allows developers to define exit conditions in plain language, making it easy to configure and readable within workflows.

✅ Reduces Redundant Workflow Steps – Instead of creating multiple nodes for repetitive tasks, use a Loop Node for dynamic iteration.

✅ Enables Smart Decision-Making – The exit condition is evaluated dynamically, ensuring real-time logic execution.

✅ Supports Multiple Use Cases – Ideal for validations, API retries, question sequences, and dynamic task execution.

By integrating the Loop Node, developers can create intelligent, adaptable workflows that respond dynamically to user input, process execution results, and iterative data operations. 🚀

PreviousWorkflowNextDocument To Image

Last updated 3 months ago