# How to create a Flow?

{% embed url="<https://youtu.be/VVwwUOvEQDs?si=j_IoHwXK5_DYMTkO>" %}
Quick 'How-to' video with steps to create a Flow
{% endembed %}

ZBrain Flows allow you to define logic for a use case in a step-by-step, modular format. These flows can be used independently or integrated within Apps and Agents to orchestrate dynamic, multi-step tasks. Each flow is arranged vertically, with steps passing data smoothly from one to the next. A flow begins with a trigger step, followed by multiple action steps, each performing a specific task. The output from one step becomes the input for the next, ensuring every stage has the information it needs to continue the workflow.

Defining a Flow involves configuring a sequence of interconnected steps that determine how the system processes inputs, makes decisions and takes actions, and produces outputs. This guide walks you through the process of creating, configuring, and finalizing a Flow, from initial setup to deployment.

### Steps to create a Flow <a href="#steps-to-create-a-flow" id="steps-to-create-a-flow"></a>

You can create a Flow either from scratch or by importing an existing flow.

#### **Create a Flow from scratch** <a href="#create-a-flow-from-scratch" id="create-a-flow-from-scratch"></a>

* Click **Flows** and click ‘+ New Flow’ to create the Flow from scratch.

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

Upon navigating to the Flow page, you will see two default components:

* **Webhook (Catch webhook)**
* **Text**

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

**Webhook (Catch webhook):** This component is used to receive HTTP requests and trigger flows via unique URLs. The live URL for the webhook will be displayed. You can generate sample data and trigger the published Flow using this component.

* **Synchronous requests:** If a response is required, add `/sync` to the URL. If the operation takes longer than 30 seconds, a 408 timeout will be returned. To send back data, include a webhook step with the return response action.
* **Test URL:** To generate sample data without triggering the Flow, append `/test` to the webhook URL.
* **Authentication:** You can select Basic Auth or Header Auth for authentication.
* You can replace Catch Webhook with any other input triggers-
  * Click three dots on the Catch Webhook and click 'Replace'
  * Select the desired trigger component from the available list of components and complete the setup on the right panel.

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

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

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

**Text:** The trigger input component captures incoming data from webhooks or other sources. It initiates the Flow based on predefined conditions and serves as the starting point for processing the data.

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

#### **Adding components to the Flow** <a href="#adding-components-to-the-flow" id="adding-components-to-the-flow"></a>

To create the logic:

1. Click the '+' icon between the default elements to add new components to your workflow.

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

2. Select components from the following four categories:

* **AI:** Includes LLM and advanced AI tools, each offering a unique set of functions and features to enhance your workflow with intelligent capabilities.
* **Core components:** Provides essential programming logic and helper methods to manage Flow control, data manipulation, and processing tasks. This includes foundational building blocks that control logic, manage flow structure, and handle external interactions.
* **Apps:** Includes integrations with third-party tools like Amazon S3, Slack, JIRA, and Google Sheets, enabling seamless connections between your workflow and external applications.

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

3. Use the search bar to quickly locate your desired component.
4. For example, you can add an **Ask AI Model** from the ZBrain component/piece to your Flow.

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

ZBrain Builder supports full Markdown formatting within the System Instructions and Prompt fields of the **Ask AI Model** configuration in Flows.

For example:

Follow the steps below to add and configure an **Ask AI Model** in your Flow.

**Step 1: Add the Ask AI Model**

1. Open your **Flow** in ZBrain Builder.
2. Click **Add Component**.
3. Select **Ask AI Model** from the available components.
4. The Ask AI Model is now added to your Flow.

Ask AI Model lets you choose the LLMs you want. To select an LLM:

* Select the desired LLM from the **Model** drop-down.

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

You can choose different advanced LLMs using the Ask AI Model Flow piece, such as Claude 4.5 Sonnet, GPT-5.1, or Gemini-3-Pro-preview.

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

**Step 2: Configure System Instructions and Prompt**

1. In the Ask AI Model configuration panel, locate the **System Instructions** and **Prompt** fields.
2. Enter your desired instructions or prompt text.
3. Use **Markdown formatting** to style your content for better readability.
   * You can apply Markdown manually using syntax such as:
     * `#` for headings
     * `**bold**` or `*italic*` for emphasis
     * `-` for bullet lists
     * `[text](url)` for links
   * Alternatively, use the **integrated Markdown editor**, which provides toolbar options for formatting without typing syntax.

> **Note:** Any content generated by large language models (LLMs) automatically preserves Markdown formatting.

To get detailed information on how to configure a component into your ZBrain Flow, refer -[Flow components](https://docs.zbrain.ai/zbrain-documentation/zbrain-builder/zbrain-ai-agents/creating-custom-ai-agents/define-flow/flow-components)

#### Copy and paste workflow steps <a href="#copy-and-paste-workflow-steps" id="copy-and-paste-workflow-steps"></a>

You can copy any existing workflow step and paste it immediately after a selected step, either within the same workflow or across different workflows. This helps minimize repetitive configuration by enabling you to reuse steps without having to rebuild the logic from scratch. The duplicated step remains fully editable, allowing you to modify it as needed after pasting.

To copy and paste a workflow step:

* Click on the 3 dots of the required Flow piece and select the **Copy** option

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

* Select the workflow step after which you want to paste the copied Flow component, and click **Paste After** to insert it immediately after the selected step.

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

**Note**: The Flow Canvas automatically scrolls while you add or move components, enhancing usability when designing or managing large or complex workflows. This feature enables you to drag and position components beyond the visible area with ease, ensuring a smoother design experience.

**Finalizing and publishing the Flow**

Once all steps are configured:

1. Review your Flow to ensure all steps are correctly configured.
2. Click 'Save' to save the configuration and publish the flow, making it available.

#### Credit cost tracking for Flow executions <a href="#credit-cost-tracking-for-flow-executions" id="credit-cost-tracking-for-flow-executions"></a>

ZBrain Builder offers comprehensive credit cost tracking for every Flow execution, providing users with full transparency into resource consumption. This feature applies to both standalone Flows and Flows invoked within agents.

To view the cost tracking:

* Navigate to the **Flows** tab and click on the desired executed Flow from the list.

<figure><img src="/files/4GGIAF0B3vNLNzTyCZU5" alt=""><figcaption></figcaption></figure>

* Click **Logs** for the specific Flow in the left panel to view the Flow execution details.

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

* Select any succeeded Flow and it will show the Run Details with
  * **Duration** – Total time taken for the Flow to complete.
  * **Total Credits Consumed** – Overall credit cost of the Flow run.
  * **Tokens Used** – Number of tokens consumed during the execution.
  * **Fixed Cost** – Any applicable fixed execution cost.

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

#### &#x20;**Importing a Flow** <a href="#importing-a-flow" id="importing-a-flow"></a>

To import a flow -

* Click on 'Import Flow'.
* It opens a file upload dialog where you can select a flow file (typically in JSON format) to import.

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

* Once selected, click 'Import' and the Flow will be added under Flows.

#### **Disabling steps in ZBrain Flows** <a href="#disabling-steps-in-zbrain-flows" id="disabling-steps-in-zbrain-flows"></a>

You can disable individual steps within a Flow based on your business logic. This provides you with greater control and flexibility during testing, debugging, and iterative development, without altering the core structure of the Flow.

* From Flows, select the particular Flow you want to modify.
* Select the step you want to disable and click the three dots on the component, and click ‘Disable.’

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

* Disabled steps are highlighted distinctly, improving workflow readability and maintenance.

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

#### **Exporting the Flow** <a href="#exporting-the-flow" id="exporting-the-flow"></a>

You can export the Flow to another agent or as an orchestration method for Apps using the 'Export' option available on the **All Flows** page.

* Click the three dots beside the Status column of the particular Flow you want to export.
* Select the 'Export' option, and the Flow will be downloaded in JSON format.

<figure><img src="/files/8KohvTvvFQ47x0RtjeWH" alt=""><figcaption></figcaption></figure>

### **Step-by-step data movement in a Flow** <a href="#step-by-step-data-movement-in-a-flow" id="step-by-step-data-movement-in-a-flow"></a>

In ZBrain Flow, automation is built as a sequence of vertically connected steps, starting with a trigger and progressing through one or more actions. Each step receives data from the previous one, processes it, and—when applicable—produces new data for the next step. This ensures that every stage in the flow has the necessary context and inputs to execute its task effectively.

Flow steps can be broadly classified into three categories.

* **Trigger step** – Initiates the flow, either with generated data (e.g., form submissions) or without data (e.g., time-based schedules). This is a Webhook or any other source that triggers the Flow, as described above in ‘Create a Flow from scratch’**.**
* **Action steps** – Uses incoming data to perform defined tasks, often producing new outputs for subsequent steps.
* **Final step** – Executes the final action in the flow, such as generating a summary or sending a report, without passing data further. This is the last step in a Flow and does not have any further steps to pass data to.

**Note**:

#### Visual alerts for missing inputs in Flow <a href="#visual-alerts-for-missing-inputs-in-flow" id="visual-alerts-for-missing-inputs-in-flow"></a>

ZBrain Builder includes visual indicators to highlight missing or broken input dependencies in your Flow. This ensures greater transparency during workflow design and reduces time spent troubleshooting issues from deleted or altered nodes.

When a step (node) in a Flow that provides inputs to downstream steps is deleted or modified such that its outputs are no longer available, ZBrain Builder automatically flags the affected steps with a visual warning icon and highlighting. This allows users to quickly identify and fix broken dependencies.

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

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

#### Inserting output data from prior steps <a href="#inserting-output-data-from-prior-steps" id="inserting-output-data-from-prior-steps"></a>

To incorporate data produced by earlier steps into your current step, ZBrain Flows provides an intuitive way to insert the data where needed through the Data Selector panel.

1. **Accessing the Data Selector panel**

* Click on any input field in the current step where you intend to use data from a prior step. This action will open the Data Selector panel.
* The panel will display a list of all available data from previous steps in the flow.

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

2. **Navigating the panel**

* To view more detailed information about any data item, click the dropdown arrow next to an entry. This will reveal additional properties or nested data that you can use.
* Browse through the list to find the data you need, then click on the item to insert it into the current step's input field.

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

3. **Inserting data**

* Once you select a data item, it is inserted directly into the current input field at the position of your cursor.
* This enables the combination of static text (predefined information) and dynamic data, enhancing workflow flexibility and enabling more personalized, context-driven operations.

<figure><img src="/files/2u0ZVrrWScv594C0S4qx" alt=""><figcaption></figcaption></figure>

#### **Best practices for Data insertion** <a href="#best-practices-for-data-insertion" id="best-practices-for-data-insertion"></a>

To ensure a smooth and error-free experience when inserting data, consider the following best practices:

* **Expand data items**: Always click the dropdown to expand data items before inserting them. This ensures you fully understand the type of data available and helps determine whether it fits the input field you are working with.
* **Verify compatibility**: Before inserting data into a field, double-check that it matches the expected format and aligns with the intended use of that field. This helps ensure consistency and prevents errors in the flow, keeping your process efficient and reliable.


---

# 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.zbrain.ai/zbrain-documentation/zbrain-builder/flows/how-to-create-a-flow.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.
