# Sequential Agent

The **Sequential Agent** in THub is a component within the AgentFlow V1 architecture designed to execute a series of tasks in a predetermined order. This setup is particularly useful for workflows that require a structured sequence of operations, such as data collection, processing, and response generation.

#### 1) **Agent Node**

The **Agent Node** serves as the central decision-making component within a workflow. It leverages a Large Language Model (LLM) to process inputs, access tools, and retrieve information from knowledge bases to generate context-aware responses.

**Key Features:**

* **Tool Integration**: Configure which tools the agent can utilize.
* **Knowledge Access**: Connect to document stores or vector databases for information retrieval.
* **Memory Management**: Enable or disable memory to consider past interactions.
* **Flow State Updates**: Modify the workflow's runtime state (`$flow.state`) during execution.

**Inputs**: Data from prior nodes or initial triggers.

**Outputs**: Agent-generated responses, either as plain text or structured JSON.

<figure><img src="/files/OIQOpxWY3mgrdmtwACzF" alt=""><figcaption></figcaption></figure>

#### **2)Condition Node**

The **Condition Node** introduces deterministic branching logic, allowing the workflow to diverge based on specified conditions.

**Key Features:**

* **Conditional Evaluation**: Assess input values using logical operators (e.g., equals, contains).
* **Branching Paths**: Direct the workflow along different routes based on evaluation results.

**Inputs**: Data to be evaluated.

**Outputs**: Branches corresponding to condition outcomes (e.g., true or false).

<figure><img src="/files/B7LHAvjo8fSHDTleC4mz" alt=""><figcaption></figcaption></figure>

#### **3)Condition  Agent**

The Condition agent  is an agent that uses a large language model (LLM) to decide which actions to take based on specific conditions or criteria. This means the agent's behavior isn't solely determined by a predefined workflow, but it uses its reasoning capabilities to select the most appropriate course of action based on the current state and input.

<figure><img src="/files/WoPqg6U0odw0qAvwUu7J" alt=""><figcaption></figcaption></figure>

#### **4)Custom JS Function Node**

The **Custom JS Function Node** allows the execution of bespoke JavaScript code within the workflow, enabling complex data transformations or integrations.

**Key Features:**

* **Custom Logic**: Implement specific operations not covered by standard nodes.
* **Access to Flow Context**: Utilize variables like `$flow.state`, `$flow.input`, and custom-defined variables.
* **Flow State Updates**: Modify the workflow's runtime state based on function outcomes.

**Inputs**: Defined input variables and access to flow context.

**Outputs**: String value returned by the executed JavaScript function.

<figure><img src="/files/60RFccda6RrSammkyg3k" alt=""><figcaption></figcaption></figure>

#### **5)END Node**

The **END Node** signifies the termination point of a workflow or a specific branch within it.

**Key Features:**

* **Final Output**: Deliver a concluding message to the user, which can be static or dynamically generated.
* **Workflow Termination**: No further nodes are processed beyond this point.

**Inputs**: Message content from previous nodes or flow state.

**Outputs**: None; this node concludes the execution path.

<figure><img src="/files/u6PmB3VbudAUe0TI99T1" alt="" width="158"><figcaption></figcaption></figure>

#### 6) **Execute Flow Node**

The **Execute Flow Node** enables the invocation of another complete THub Chatflow or AgentFlow from within the current workflow, promoting modular design.

**Key Features:**

* **Sub-Workflow Execution**: Trigger separate, pre-existing workflows.
* **Input Passing**: Provide initial inputs to the invoked workflow.
* **Flow State Updates**: Incorporate outputs from the executed sub-flow into the current workflow's state.

**Inputs**: Execution signal and input data for the sub-flow.

**Outputs**: Results returned by the executed sub-flow.

<figure><img src="/files/fglPUFm00kZmEhGtafki" alt="" width="161"><figcaption></figcaption></figure>

#### 7)**LLM Node**

The **LLM Node** provides direct access to a configured Large Language Model for executing AI tasks, such as data extraction or content generation.

**Key Features:**

* **Structured Output**: Configure the LLM to return responses in a specific JSON schema.
* **Flow State Updates**: Store LLM outputs in the workflow's runtime state for downstream use.

**Inputs**: Data from the workflow's initial trigger or preceding nodes.

**Outputs**: LLM-generated responses, either as plain text or structured data.

<figure><img src="/files/rRp16upN2HFtP4gHJt2K" alt="" width="161"><figcaption></figcaption></figure>

#### **8)Loop Node**

The **Loop Node** introduces controlled cycles within the workflow, enabling iterative processes where a sequence of nodes is executed multiple times based on defined conditions.

**Key Features:**

* **Iteration Control**: Define the maximum number of loop iterations to prevent infinite cycles.
* **Loop Back Target**: Specify the node to which the workflow should return after each iteration.

**Inputs**: Execution signal to activate the loop.

**Outputs**: Redirects execution flow back to the specified node.

<figure><img src="/files/99RnWVkFDzoXWfjriKqS" alt="" width="158"><figcaption></figcaption></figure>

#### **9)Start Node**

The **Start Node** is the designated entry point for initiating any AgentFlow V2 workflow execution.

**Key Features:**

* **Input Configuration**: Determine how the workflow is triggered, either by chat input or a submitted form.
* **Flow State Initialization**: Define the initial key-value pairs for the workflow's runtime state.
* **Memory Settings**: Configure whether to consider past messages from the conversation thread.

**Inputs**: Initial data that triggers the workflow.

**Outputs**: Passes along the initial input data and the initialized Flow State to the first operational node.

<figure><img src="/files/QGg9GXHLMkwWJcKSAXvM" alt="" width="236"><figcaption></figcaption></figure>

#### 10) State Node

The **State Node** provides a mechanism for storing and managing intermediate data within the workflow, allowing information to be shared across different nodes.

**Key Features:**

• **Data Storage**: Stores intermediate values during workflow execution.\
• **State Persistence:** Maintains data across multiple steps in the flow.\
• **Flexible Usage:** Can store different types of data as required.\
• **Workflow Integration:** Enables smooth data sharing between nodes.

**Inputs:** Necessary data or values to be stored, usually coming from previous node outputs.

**Outputs:** Stored state data that can be accessed and used by subsequent nodes in the workflow.

<figure><img src="/files/BICJMbdszybwh3IrGnHL" alt=""><figcaption></figcaption></figure>

#### 11) **Tool Node**

The **Tool Node** provides a mechanism for directly and deterministically executing a specific, pre-defined Flowise Tool within the workflow sequence.

**Key Features:**

* **Deterministic Execution**: Executes the selected tool without involving LLM reasoning for tool selection.
* **Input Argument Mapping**: Define how data from your workflow is supplied to the selected tool.
* **Flow State Updates**: Store the tool's output in the workflow's runtime state for use in subsequent nodes.

**Inputs**: Necessary data for the tool's arguments, sourced from previous node outputs or flow state.

**Outputs**: Raw output generated by the executed tool.

<figure><img src="/files/P2K6UyzI8OwYIO6wGjkD" alt="" width="225"><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thub.tech/langchain/sequential-agent.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
