# Agent Nodes

## **Introduction to AgentFlow Nodes**

In **AgentFlow**, a workflow is constructed using a series of modular **Nodes**, each representing a discrete function or operation. These nodes are visually connected on the canvas to define the logic, control flow, and data handling of the entire process.Here’s a brief introduction to the main types of **Nodes** in **AgentFlow**:

### **Basic**

* **Start Node**

  <figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FKwDROGUXwlDMtpefvdli%2Ff977a810-01d3-4bb6-acf2-9d62db49d8b6.png?alt=media&#x26;token=3c39a344-261f-4603-8c70-3c4461fc4c75" alt=""><figcaption></figcaption></figure>

{% columns %}
{% column width="41.66666666666667%" %}

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FWibIjUS6HG9vlAvvc0X8%2F544bc9418ae0be0afeaaa62d49d7e589.png?alt=media&#x26;token=b2ec775d-8961-47ce-a09b-3ad9b38b0397" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column %}

* **Function**

Serves as the default and fixed entry point for any workflow-based agent. It is automatically created when a new workflow is initialized.

* **Configurable Parameters**

Users can define additional custom input variables as needed to support downstream logic.

* **Input**

Always receives the user's query by default. Also accepts any additional user-defined input variables.

* **Output**

Passes the received query and input variables to subsequent connected nodes for further processing.
{% endcolumn %}
{% endcolumns %}

***

* **End Node**

  <figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FpfbcfK7JUBKwJXyOfFR6%2Feb8e0297-97c6-4068-8573-93b35251c264.png?alt=media&#x26;token=48c8a964-d2ec-4624-a673-8de0d8a33a2c" alt=""><figcaption></figcaption></figure>

{% columns %}
{% column width="41.66666666666667%" %}

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FnQecW7wj0AqPgIJokor1%2Fc06af47b1a105fe1a9d5e123609ddaa0.png?alt=media&#x26;token=0edc8fed-3eaa-479b-bc34-5c07e380667b" alt=""><figcaption></figcaption></figure>

{% endcolumn %}

{% column %}

* **Function**\
  Serves as one of the possible termination points in a workflow-based agent. It collects and outputs results from preceding nodes for final use, external return, or logging.
* **Configurable Parameters**\
  Users can define custom output variables to export selected values. These values are typically references to outputs from previous nodes.
* **Input**\
  Receives data from one or more connected upstream nodes. The data may include intermediate results or values computed earlier in the workflow.
* **Output**\
  Exports the specified output variables. Only variables explicitly defined by the user will be included in the final result.
  {% endcolumn %}
  {% endcolumns %}

***

* **Answer Node**

  <figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FFpCbqovWLgp8a0OCfrVT%2Faf2a99d9-a79f-4ec5-8219-2757b6c4b4bc.png?alt=media&#x26;token=a13309ee-cfdc-4225-a7ab-d47531dfb35a" alt=""><figcaption></figcaption></figure>

{% columns %}
{% column width="41.66666666666667%" %}

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FoRXTx7iyBFw0BnRKTtUn%2F66cb893911f868ad3bdbcb0c0f99dc8b.png?alt=media&#x26;token=f17fc521-6921-4fd1-bda6-418106c4d5d0" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column %}

* **Function**\
  Serves as a conversational termination point in a workflow, typically used in Chat Flow scenarios. It outputs a natural language response to the user, allowing dynamic embedding of upstream variables. It cannot coexist with an End Node in the same workflow.
* **Configurable Parameters**\
  Users can define a response template using natural language, where variables from preceding nodes can be embedded using placeholders .
* **Input**\
  Receives data from one or more upstream nodes, including all referenced variables intended for insertion into the final response.
* **Output**\
  Generates a natural language response by resolving variable references within the defined template. The response is returned directly to the user as the final message of the workflow.
  {% endcolumn %}
  {% endcolumns %}

***

**Transform**

* **Code Node**

  <figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2Fi7fCPPJu7MTNJSRORI7x%2Fc7b3865b-359c-45a5-ad04-fead9d34f3fd.png?alt=media&#x26;token=9ee0c711-e55a-4f82-94bc-c390bcc3fd99" alt=""><figcaption></figcaption></figure>

  * **Function**\
    Executes custom Python code as part of the workflow. Used for implementing flexible logic, data processing, or integration tasks that require scripting.
  * **Configurable ParametersInput Variables**: Passed into the code as function parameters.**Output Variables**: Returned as a dictionary where keys are variable names available to downstream nodes.
  * **Input**\
    Receives values from upstream nodes corresponding to the user-defined input variable names. These are passed as arguments to the code function.
  * **Output**\
    Return a dictionary containing one or more key-value pairs. Each key represents an output variable name, which can be used by downstream nodes.A typical example is as follows：

{% code fullWidth="false" %}

```python
def main(input_text1: str, input_text2: str) -> dict:
    combined_text = input_text1 + " " + input_text2
    length = len(combined_text)
    return {
    "combined_text": combined_text,
    "text_length": length
}
```

{% endcode %}

&#x20; This function `main` takes two input strings, `input_text1` and `input_text2`. It concatenates them with a space in between to form `combined_text`. Then, it calculates the length of this combined string and stores it in `text_length`. Finally, the function returns a dictionary containing both the concatenated result and its length as output variables.<br>

***

**Control Flow**

* **Condition Node**

  <figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FaImflR4DmKFtUDK7oHt6%2Fcbf69824-4634-4bd6-a91b-45cb6e4240f1.png?alt=media&#x26;token=8b1e3d97-d75a-4e07-9029-99d670a0f3a0" alt=""><figcaption></figcaption></figure>

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FT3A6NLyAvFZnAwHCnLt4%2Fb740d17287f69c417a21b612b9ec81df.png?alt=media&#x26;token=f9a321a4-a085-453a-bb47-c67ba14b437d" alt=""><figcaption></figcaption></figure>

*

```
* **Function**
```

```
&#x20;      Directs the workflow based on conditional logic. It evaluates one or more user-defined conditions and determines which downstream branch to execute accordingly.

* **Configurable Parameters**
  * A **referenced variable** (from upstream nodes)
  * A **logical expression** (e.g., `==`, `>`, `in`, etc.)
  * An associated **output branch** (executed if the condition is true) Branches are evaluated in order. Only the first true condition's branch is executed. An optional `else` branch can be defined as a fallback.
* **Input**

&#x20;      Receives variables from upstream nodes that are used in condition evaluations.

* **Output**

Executes the branch corresponding to the first condition that evaluates to true. If none match and an `else` branch is defined, the `else` branch is executed.
```

***

* **For Each Node**

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FCmbQTl320VVYI4A9gzoZ%2Fbe97e939e3ca9a1abdd019c6115d2106.png?alt=media&#x26;token=96516514-5ecd-4096-9798-41428176d729" alt=""><figcaption></figcaption></figure>

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2F9ibPpAzu6GHS8cFCdKR7%2Fc8e2d252fb2b19673452b6f5946f3d4b.png?alt=media&#x26;token=2eb4fa99-dfde-43fe-b52c-8bf995e3652f" alt=""><figcaption></figcaption></figure>

* * **Function**:\
    Iterates over an input array and repeatedly executes the nodes within a defined loop boundary.
  * **Structure**:
    * A fixed entry node: **For Each Start**
    * A loop boundary box: drag any nodes into this area to make them part of the loop body
  * **Usage**:
    * Drag nodes from the node list into the loop area
    * Set the **Input Variable** (must be of **Array** type)
    * Set the **Output Variable** (must be the output from within the loop scope.)
  * **Execution Logic**:
    * Automatically iterates through the array
    * Provides two built-in variables to nodes inside the loop:
      * `for_each_index`: the index of the current item
      * `for_each_value`: the value of the current item
  * **Optional Setting**:
    * **Parallel Execution**: Enable this option for loops without inter-item dependencies to improve performance.

***

* **Variable Assigner Node**

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FafQ7382kRyhqIfYlFMak%2Fab30c8e8de8797552d20b9d5489744d0.png?alt=media&#x26;token=f0f80c09-1164-4298-8c82-92d3a4588074" alt=""><figcaption></figcaption></figure>

{% columns %}
{% column width="41.66666666666667%" %}

<div align="center"><figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2F7FbJJt8FsOMx3miEF8qx%2F1ce947b6e1dbefb8ff034f4bc0a02c78.png?alt=media&#x26;token=56ea86d3-86ba-4b99-8dcc-21f69e31129e" alt=""><figcaption></figcaption></figure></div>
{% endcolumn %}

{% column %}

* **Function**:\
  Sets or updates globally accessible variables within the workflow. Supports both assignment and reset operations, enabling dynamic runtime behavior based on changing context.

* **Configurable Parameters**:
  * **Target variable**: The name of the global or referenced variable to modify
  * **Assignment value**: A constant, expression, or variable reference to assign
  * **Operation type**:
    * `assign`: Assign a new value to the variable
    * `reset`: Clear or reset the variable to its default state
  * Multiple variable operations can be configured in one node

* **Input**:\
  Receives variables or context from upstream nodes as sources for assignment.

* **Output**:\
  Passes the updated variables to downstream nodes for use in subsequent steps.
  {% endcolumn %}
  {% endcolumns %}

* **Human Review Node**

  <figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FodQagtJS5MyVYvfKUkMl%2F3177754b-520b-42ab-9b84-04da8f62b4ae.png?alt=media&#x26;token=58e44938-b2d9-41aa-8434-69ecbbd5dc0b" alt=""><figcaption></figcaption></figure>

  * **Function**

  Pauses the automated workflow and sends a message to a designated human reviewer for manual decision-making. Based on the reviewer’s selection, the workflow proceeds along a specified branch.

  * **Configurable Parameters**
    * **Review Message**: A customizable message presented to the reviewer to explain the context and request input.
    * **Human Review Type**: Specifies the review format (e.g., single choice, multi-choice, comment).
    * **Options**: A list of selectable options, each including:
      * **Option Name**: A label for the option (e.g., "Approve", "Reject").
      * **Option Description**: An optional description to help the reviewer understand what the option means.
    * **Reviewer Role**: Defines which user group or role is authorized to perform the review.
  * **Input**

  Receives all necessary variables and context from upstream nodes to assist the reviewer in making a decision.

  * **Output**

  The selected option is returned as an output variable and determines the next step in the workflow, typically branching based on the review result.

***

**AI Models**

* **LLM Node**

  <figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FuqozRLNKIvVlFp7hREpr%2F42a618c9-6b5b-4ff2-909d-be6ee3975967.png?alt=media&#x26;token=e580bd0e-fc5d-4bd7-97c4-037fb3a11ec5" alt=""><figcaption></figcaption></figure>

  * **Function**
  * &#x20; Integrates a Large Language Model (LLM) into the workflow to generate natural language responses, perform text understanding, summarization, translation, or other NLP-related tasks based on provided input variables. Enables conversational AI, content generation, or intelligent decision support.
  * **Configurable Parameters**
    * **System Prompt** A fixed or semi-fixed instruction that provides context or role setting for the LLM, guiding its response style and behavior (e.g., "You are a helpful assistant.")
    * **User Prompt** A dynamic prompt template that incorporates input variables to form the actual query sent to the LLM.
    * **Model Settings** Parameters like temperature, max tokens, top-p, frequency penalty, presence penalty, etc., to control output randomness, length, and style.
    * **Input Variables** Variables from upstream nodes used to fill placeholders in the User Prompt.
    * **Output Variables** Variables that store the LLM’s generated responses for downstream processing.
  * **Input**
  * &#x20; Receives input variables from previous nodes, which are injected into the User Prompt template to produce the final query for the LLM.
  * **Output**
  * &#x20; Returns generated text(s) or structured response(s) from the LLM, mapped to output variables for further use or display.

***

* **Question Classifier Node**

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2Fcyk2UDHw8LxdmHvmx8YC%2Fcb7b8ddda6b1daa764b49f788108cf6f.png?alt=media&#x26;token=9c83a7f3-507c-4874-b859-e2556802b5d8" alt=""><figcaption></figcaption></figure>

{% columns %}
{% column width="41.66666666666667%" %}

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FRXAiqPLDfbIsHUJsbg1a%2F8fb7b09097b154f615c6d8792a83bcd1.png?alt=media&#x26;token=a8b261cf-ee48-484d-9f93-f848005b1f5e" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column %}

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2F4nmuh6fqMqaXRuY5mzo7%2F93af48af9454d9f1133893ebaa12aeb7.png?alt=media&#x26;token=88b59f0d-e030-4f1c-b63c-42b82597a81b" alt=""><figcaption></figcaption></figure>

* **Function**:\
  Classifies user input into predefined categories to guide downstream workflow branching based on intent.
* **Configurable Parameters**:
  * **Model**: The language model used (e.g., GPT-4o-mini)
  * **Chat History**: Whether to include prior conversation context
  * **Class List**: Custom category labels defined by the user; each class maps to an output branch
  * **Prompt**: The classification prompt used to guide the model's decision. Leaving it blank is also allowed.
  * **Input Variables**: The input field to be classified, usually the user’s query (e.g., `User Query`)
    {% endcolumn %}
    {% endcolumns %}

***

* **Agent Node**

  <figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FOyBu6oVcvUxgHzUD0UgF%2Ff04d07af-7e9a-4d13-8387-e0a86f4cf7b4.png?alt=media&#x26;token=d382c195-34f2-4ab7-9245-7c032a6e0192" alt=""><figcaption></figcaption></figure>

  * **Function**
  * &#x20; Allows invoking another pre-built agent as a node within the current workflow. This supports modular reuse of existing logic and enables hierarchical or nested workflow designs.
  * **Configurable Parameters**
    * **Agent Reference** Select or input the ID/name of the existing agent to be invoked.
    * **Input Variables** Define the variables to be passed into the referenced agent. These should match the input schema expected by that agent.
  * **Input**
  * &#x20; Receives variables from upstream nodes and passes them as input to the specified agent.
  * **Output**
  * &#x20; Returns the predefined output variables of the referenced agent. These outputs are automatically exposed for use in subsequent nodes.

**Knowledge**

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FufXxOZtbFXi6e5KTTp1O%2Feee78ac7-cac0-456c-bfba-366d895f969e.png?alt=media&#x26;token=bfbbe803-e92f-418d-ab00-843de22a7b44" alt=""><figcaption></figcaption></figure>

{% columns %}
{% column width="41.66666666666667%" %}

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FGiMkbdJFwNpjQv7aneFf%2F9804a50df8afa66440ac766174954977.png?alt=media&#x26;token=b69f7feb-ce65-49a8-a342-c3ee0265fe91" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column %}
**Knowledge Search Node**

* **Function**

Retrieves relevant information from a specified knowledge database based on user-defined input variables. Typically used to provide external knowledge support for downstream reasoning or generation.

* **Configurable Parameters**
  * **Knowledge Database** Select the knowledge base to search from (e.g., FAQ base, product manual, research corpus).
  * **Input Variables** Specify the variables whose values will be used as search queries.
  * **Top K** Set the maximum number of results to return from the knowledge base.
  * **Score Threshold** Define the minimum similarity score required for a result to be included.
* **Input**

Receives search query inputs (usually from upstream node outputs or user inputs), which are used to query the selected knowledge base.

* **Output**

Returns a list of relevant knowledge entries, each typically including fields like `content`, `source`, and `score`. This list is passed to downstream nodes.
{% endcolumn %}
{% endcolumns %}

***

**Tool**

* **Tool Node**

  <figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FER2US8p1DyNpuVa5y4Mq%2F179fd446-699c-4fc8-8bd9-9c143846c5ca.png?alt=media&#x26;token=cfab2c84-bbd0-4791-9cd5-6354edeb04f6" alt=""><figcaption></figcaption></figure>

{% columns %}
{% column width="41.66666666666667%" %}

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FZCgguZx3zTko9G7o1ma6%2F9d46e45bf29974a97c7fed6b6c0172c5.png?alt=media&#x26;token=f44f8204-40fe-4f42-b457-7e571bfc91f5" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column %}

* **Function**

Enables integration of external tools within a workflow. Users can either select from built-in tools provided by the platform or use custom tools they have created. The Tool Node extends workflow capability with specialized processing.

* **Configurable Parameters**
  * **Tool Selection** Choose a tool from the built-in library or link a user-defined tool.
  * **Tool-Specific Configuration** Configuration options vary depending on the selected tool. Each tool may define its own required input variables, output structure, and runtime parameters.
* **Input**

Receives input variables required by the selected tool. These are usually mapped from upstream node outputs.

* **Output**

Returns the output as defined by the tool's specification. Output variables are exposed for use in downstream nodes.
{% endcolumn %}
{% endcolumns %}

***
