How to create a Flow?

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

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

Create a Flow from scratch

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

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

  • Webhook (Catch webhook)

  • Text

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.

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.

Adding components to the Flow

To create the logic:

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

  1. 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.

  1. Use the search bar to quickly locate your desired component.

To get detailed information on how to configure a component into your ZBrain Flow, refer -Flow components

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

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.

  • Click Logs for the particular Flow from the left panel, and it will show the Flow execution details.

  • 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.

Importing a Flow

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.

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

Disabling steps in ZBrain Flows

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.’

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

Exporting the Flow

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.

How data moves through a Flow

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.

Inserting output data from prior steps

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.

  1. 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.

  1. 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.

Best practices for Data insertion

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.

Last updated