How to Define a Flow?

Defining a flow involves setting up a series of interconnected steps that guide the agent’s actions. This guide outlines the process of creating and configuring a flow, from initial setup to finalization.

Steps to define a Flow

1. Navigate to the define Flow page

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

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

🚫 No action is needed to remove this component, as it cannot be deleted from the Flow.

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

  • ZBrain (Models): This component employs large language models to process the extracted data. Tasks such as data analysis, insight generation, summarization, classification, or other outputs are performed here, tailored to meet the specific requirements of the Flow.

  • Utilities (Agent output): This component handles the processed data from previous steps and sends the final output to the agent dashboard. It serves as the last step in the Flow, ensuring the result is properly delivered to the user-facing interface in the intended format.

Note: You can customize your workflow by building logic around these pre-configured components and incorporating additional elements as needed.

2. Adding Components to the Flow

To create the logic:

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

2. Select components from the following three 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.

  • 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 locate your desired component quickly.

The following section outlines the process for integrating existing AI tools, core components, and apps into your workflow seamlessly.

Adding an AI component

Adding Anthropic Claude

To integrate Anthropic Claude into your workflow, follow these steps:

  1. Select the Anthropic Claude component to get started.

  2. Click on the component to view its available actions. You can choose from the following:

    • Ask Claude: Ask Claude any question and receive a response.

    • Extract structured data: Extract structured data from text, images, or PDFs.

    • Custom API call: Make a custom API call to a specified endpoint.

  3. After selecting an action, the component will be added to your Flow. A pop-up window will appear on the right side of the screen for further configuration.

Configuring actions

Ask Claude

  1. Connection setup:

    • Use an existing connection or create a new one by entering a connection name and API key.

    • Follow the on-screen instructions to obtain the API key and click Save once entered.

  2. Model selection:

    • Choose the model you want to use, such as Claude 3 Haiku, Claude 3 Sonnet, or Claude 3 Opus.

  3. Model settings:

    • System prompt: Provide instructions or context to guide the model's responses.

    • Temperature: Adjust the creativity and randomness of the model’s replies.

    • Maximum tokens: Set the maximum number of tokens (words/characters) for the response.

    • Questions: Enter specific questions or pull data from previous steps using the data selector panel.

    • Image input (Optional): Provide a URL for an image input if needed for the model.

    • Roles: Define roles to improve response accuracy.

Extract structured data

  1. Connection setup:

    • Use an existing connection or create a new one by entering a connection name and API key.

    • Follow the on-screen instructions to obtain the API key and click Save once entered.

  2. Model selection:

    • Choose the model you want to use, such as Claude 3 Haiku, Claude 3 Sonnet, or Claude 3 Opus.

  3. Input settings:

    • Text input: Manually enter the text or pull data from previous steps.

    • Image/PDF input: Provide the image or PDF URL to extract structured data.

    • Guide prompt: Input prompts to guide the data extraction process.

    • Data schema type: Select between Simple or Advanced schema types.

    • Data definition: Click ‘+ Add Item’ to define fields (name, description, and data type: text, number, boolean).

    • Fail if not present: Enable this switch to fail the step if the expected data is not found.

    • Maximum tokens: Set the maximum number of tokens for the output.

Custom API call

  1. Connection setup:

    • Use an existing connection or create a new one by entering a connection name and API key.

    • Follow the on-screen instructions to obtain the API key and click Save once entered.

  2. API configuration:

    • URL: Enter the API endpoint URL.

    • Method: Choose the request method (GET, POST, PATCH, PUT, DELETE, or HEAD).

    • Headers: Authorization headers are automatically injected. To add additional headers, click ‘+ Add Item.’

    • Query parameters: Click ‘+ Add Item’ to input query parameters as needed.

    • Body: Enter the request body with relevant data.

    • Timeout: Specify the timeout duration in seconds for the request.

Adding a core component

Adding Files Helper

  1. Search for Files Helper in the search bar or find it at the bottom of the list.

  2. Select one of the following actions:

    • Read file – Read a file from the file system.

    • Create file – Generate a new file from the provided content.

    • Change file encoding – Convert a file’s encoding format.

    • Check file type – Identify the MIME type of a file and filter based on selected types.

    After selecting an action, a configuration panel will appear on the right side of the screen for further setup.

Action-specific configuration

Read file

  1. Input the file manually or use data from previous steps.

  2. Select the desired output format: Text or Base64.

Create file

  1. Enter the file content manually or extract data from previous steps.

  2. Provide a file name.

  3. Choose an encoding method from the following options: ASCII, UTF-8, UTF-16LE, UCS-2, Base64, Base64 URL, Latin1, Binary, Hex.

Change file encoding

  1. Specify the source file manually or retrieve data from previous steps.

  2. Select the current encoding format from: ASCII, UTF-8, UTF-16LE, UCS-2, Base64, Base64 URL, Latin1, Binary, Hex.

  3. Enter the output file name and choose the new encoding format.

Check file type

  1. Provide the file manually or retrieve it from previous steps.

  2. Select MIME types to filter, including: Octet-stream, Plain Text, CSS Stylesheet, HTML Document, JavaScript, CSV File, iCalendar Format, APNG Image, AVIF Image, GIF Image, JPEG Image, PNG Image, and more.

Connecting a third-party tool

Adding Asana

  1. Locate and select Asana from the list to view its available actions.

  2. Choose an action from the following options:

  • Create a task – Add a new task to an Asana project.

  • Custom API call – Make a custom API request to Asana.

  1. After selecting an action, a configuration panel will appear on the right side of the screen for further setup.

Configuring actions

Create a Task

  1. Connection: Use an existing connection or create a new one by clicking ‘+Create Connection.’

  2. Workspace: Select the relevant Asana workspace where the task will be created.

  3. Project: Choose the project to which the task will be added.

  4. Task details: Fill in the following required fields (enter manually or pull data from previous steps):

    • Task Name

    • Description

    • Due Date

  5. Tags: Assign tags to categorize the task.

  6. Assignee: Specify the assignee for the task.

Custom API Call

  1. Connection: Use an existing connection or create a new one by clicking ‘+Create Connection.’

  2. URL: Input the custom API endpoint URL you want to connect to.

  3. Request method: Select the HTTP request method (GET, POST, PATCH, PUT, DELETE, HEAD).

  4. Headers: Authorization headers are injected automatically from your connection. To add headers, click on ‘+ Add Item.’

  5. Query parameters: Add any required query parameters by clicking ‘+ Add Item.’

  6. Body: Input the request body with relevant data.

  7. Timeout: Set a timeout duration in seconds for the request.

Adding ZBrain to the Flow

1. Choose the ZBrain component to add it to your Flow. 2. Click on it to view the available actions, and choose one from the following options:

  • Knowledge base search – Search within knowledge bases.

  • Query app – Query your connected applications.

  • Ask AI model – Ask the AI model anything.

  • Run agent – Run a specific agent to perform tasks.

  • App previous conversations – Retrieve query sessions or past interactions for a specific app.

  • Update knowledge base – Modify or enhance the content of an existing knowledge base in ZBrain.

  • Update app – Apply updates or changes to an existing app within ZBrain.

  • Generate image – Create high-quality images from textual descriptions, enabling visual generation based on user input.

Once you have selected an action, ZBrain will be added to your Flow, and a configuration panel will appear on the right side of the screen for further setup.

Configuring the ZBrain component

Knowledge base search

Search within uploaded knowledge bases to retrieve data.

  1. Use an existing connection or click ‘+ New Connection’ to create one.

  2. Provide a name and enter your API key (found by navigating to Settings > My Account in ZBrain).

  3. Select one or multiple knowledge bases to search from.

  4. Enter a query or use data from previous steps to search the knowledge base.

  5. Configure additional settings, such as:

    • Maximum tokens – Limit the response length.

    • Response format – Enable JSON to return the response in JSON format, or String for a text-based format.

    • Summarize – Enable this option to generate a summary of the documents.

    • Metadata – Retrieve meta-information from the documents.

Query app

Query connected applications for specific information.

  1. Use an existing connection or click ‘+ New Connection’ to create one.

  2. Provide a name and enter your API key (found in Settings > My Account in ZBrain).

  3. Select the application you want to query.

  4. Enter a query or use data from previous steps to perform the query.

  5. Optionally, input a conversion ID for more efficient data retrieval.

Ask AI model

Interact with large language models (LLMs) to perform tasks.

  1. Use an existing connection or click ‘+ New Connection’ to create one.

  2. Provide a name and enter your API key (available in Settings > My Account in ZBrain).

  3. Select a model from the list, including multimodal models.

  4. Select the pre-configured and published prompts from the prompt library. The chosen prompt becomes the agent’s system instruction, guiding the LLM to execute the task accurately and according to your defined guidelines.

  5. Provide system instructions and the prompt for the model.

  6. Provide an image URL by clicking ‘+ Add Item’ to include an image as input for the model.(Optional)

  7. Configure model parameters:

    • Temperature – Adjust response creativity (higher values = more randomness).

    • Maximum tokens – Set a limit on the response length.

    • Response format – Choose between Text, JSON Object, or JSON Schema.

    • Top P – Define the probability mass for nucleus sampling. For example, a value of 0.1 means only tokens in the top 10% probability are considered.

    • Frequency penalty – Set a value between -2.0 and 2.0 to penalize repetitive content. Positive values decrease the likelihood of repeating phrases.

    • Presence penalty – Set a value between -2.0 and 2.0 to encourage new topics. Positive values reduce the likelihood of the model repeating content already mentioned.

  8. Provide input manually or pull data from previous steps.

Run agent

Trigger a specific agent to perform tasks within your workflow.

  1. Use an existing connection or click ‘+ New Connection’ to create one.

  2. Provide a name and enter your API key (available in Settings > My Account in ZBrain).

  3. Select the agent you want to run.

  4. Provide the required URL and input data manually or pull data from previous steps using the data selector panel.

App previous conversations

Retrieve and access conversation history from your ZBrain applications to analyze past interactions, track user engagement, and maintain conversation context.

  1. Use an existing connection or click '+ New Connection' to create a new one

  2. Provide a connection name for identification

  3. Enter your API key (found in Settings > My Account in ZBrain)

  4. Configure conversation retrieval:

    • Select the ZBrain app from which you want to retrieve conversations

    • Select the specific app sessions you want to access

    • Enter the limit for the number of conversations to retrieve

Update knowledge base

Update your ZBrain knowledge base with new information or data to keep your AI applications current and accurate.

  1. Use an existing connection or click '+ New Connection' to create a new one

  2. Provide a connection name for identification

  3. Enter your API key (found in Settings > My Account in ZBrain)

  4. Configure knowledge base update:

    • Select the knowledge base (KB) you want to update from the available options

    • Enter the title for the knowledge base

    • Provide the content that will be added to the knowledge base

Update app

Modify and update the settings, configurations, and parameters of your existing ZBrain applications to optimize performance and functionality.

  1. Use an existing connection or click '+ New Connection' to create a new one

  2. Provide a connection name for identification

  3. Enter your API key (found in Settings > My Account in ZBrain)

  4. Configure app updates:

    • Select the specific app you want to update from your available applications

    • Update the following parameters as needed:

      • Name: Modify the application name

      • Description: Update the app description

      • Model: Select the LLM to use

      • Temperature: Adjust the model's creativity/randomness

      • Context max token: Define the maximum context length

      • Response max token: Set maximum response length

Generate image

Create AI-generated images using ZBrain's image generation capabilities with customizable parameters for style, quality, and format.

  1. Use an existing connection or click '+ New Connection' to create a new one

  2. Provide a connection name for identification

  3. Enter your API key (found in Settings > My Account in ZBrain)

  4. Configure image generation:

    • Model selection: Choose the model for image generation

    • Action type: Select the action to perform (generate/edit)

    • Prompt: Enter the detailed prompt describing the image you want to generate

    • Quantity: Specify the number of images to generate

    • Background: Choose background type (transparent/opaque/auto)

    • Moderation level: Set content moderation (low/auto)

    • Output format: Select image format (PNG/JPEG/WebP)

    • Quality: Choose image quality (low/medium/high)

    • Size: Select image dimensions:

      • 1024×1024 (square)

      • 1536×1024 (landscape)

      • 1024×1536 (portrait)

    • Response format: Choose how to receive the image (URL/base64_json)

Note: Please follow the on-screen prompts and instructions to connect the components and configure them efficiently and accurately.

3. Toggle options for robust workflows

Each component includes additional options:

  • Continue on failure: Enable to skip the step and proceed with the Flow even if it fails.

  • Auto retry on failure: Automatically retry the step up to four times if it fails.

4. Finalizing the Flow

Once all steps are configured:

  1. Review your Flow to ensure all steps are correctly configured.

  2. Click 'Next' to continue and set up the additional settings.

Explore advanced workflows

For more complex use cases, combine AI tools, core components, and app actions to seamlessly integrate advanced logic with third-party tools. This enables you to create highly customized workflows tailored specifically to your business needs.

Last updated