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

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:
Select the Anthropic Claude component to get started.
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.
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
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.
Model selection:
Choose the model you want to use, such as Claude 3 Haiku, Claude 3 Sonnet, or Claude 3 Opus.
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
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.
Model selection:
Choose the model you want to use, such as Claude 3 Haiku, Claude 3 Sonnet, or Claude 3 Opus.
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
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.
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
Search for Files Helper in the search bar or find it at the bottom of the list.
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
Input the file manually or use data from previous steps.
Select the desired output format: Text or Base64.

Create file
Enter the file content manually or extract data from previous steps.
Provide a file name.
Choose an encoding method from the following options: ASCII, UTF-8, UTF-16LE, UCS-2, Base64, Base64 URL, Latin1, Binary, Hex.

Change file encoding
Specify the source file manually or retrieve data from previous steps.
Select the current encoding format from: ASCII, UTF-8, UTF-16LE, UCS-2, Base64, Base64 URL, Latin1, Binary, Hex.
Enter the output file name and choose the new encoding format.

Check file type
Provide the file manually or retrieve it from previous steps.
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
Locate and select Asana from the list to view its available actions.
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.
After selecting an action, a configuration panel will appear on the right side of the screen for further setup.

Configuring actions
Create a Task
Connection: Use an existing connection or create a new one by clicking ‘+Create Connection.’
Workspace: Select the relevant Asana workspace where the task will be created.
Project: Choose the project to which the task will be added.
Task details: Fill in the following required fields (enter manually or pull data from previous steps):
Task Name
Description
Due Date
Tags: Assign tags to categorize the task.
Assignee: Specify the assignee for the task.

Custom API Call
Connection: Use an existing connection or create a new one by clicking ‘+Create Connection.’
URL: Input the custom API endpoint URL you want to connect to.
Request method: Select the HTTP request method (GET, POST, PATCH, PUT, DELETE, HEAD).
Headers: Authorization headers are injected automatically from your connection. To add headers, click on ‘+ Add Item.’
Query parameters: Add any required query parameters by clicking ‘+ Add Item.’
Body: Input the request body with relevant data.
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.
Use an existing connection or click ‘+ New Connection’ to create one.
Provide a name and enter your API key (found by navigating to Settings > My Account in ZBrain).
Select one or multiple knowledge bases to search from.
Enter a query or use data from previous steps to search the knowledge base.
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.
Use an existing connection or click ‘+ New Connection’ to create one.
Provide a name and enter your API key (found in Settings > My Account in ZBrain).
Select the application you want to query.
Enter a query or use data from previous steps to perform the query.
Optionally, input a conversion ID for more efficient data retrieval.

Ask AI model
Interact with large language models (LLMs) to perform tasks.
Use an existing connection or click ‘+ New Connection’ to create one.
Provide a name and enter your API key (available in Settings > My Account in ZBrain).
Select a model from the list, including multimodal models.
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.
Provide system instructions and the prompt for the model.
Provide an image URL by clicking ‘+ Add Item’ to include an image as input for the model.(Optional)
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.
Provide input manually or pull data from previous steps.

Run agent
Trigger a specific agent to perform tasks within your workflow.
Use an existing connection or click ‘+ New Connection’ to create one.
Provide a name and enter your API key (available in Settings > My Account in ZBrain).
Select the agent you want to run.
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.
Use an existing connection or click '+ New Connection' to create a new one
Provide a connection name for identification
Enter your API key (found in Settings > My Account in ZBrain)
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.
Use an existing connection or click '+ New Connection' to create a new one
Provide a connection name for identification
Enter your API key (found in Settings > My Account in ZBrain)
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.
Use an existing connection or click '+ New Connection' to create a new one
Provide a connection name for identification
Enter your API key (found in Settings > My Account in ZBrain)
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.
Use an existing connection or click '+ New Connection' to create a new one
Provide a connection name for identification
Enter your API key (found in Settings > My Account in ZBrain)
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:
Review your Flow to ensure all steps are correctly configured.
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