Agent.ai Documentation home page
Search...
⌘K
Ask AI
Support
Platform
Platform
Search...
Navigation
Actions
If/Else Statement
Guides
API Reference
Recipes
Documentation
Community
Using Agent.ai
Welcome
AI Agents Explained
Security & Privacy
Marketplace Credits
Rate Limits
Profile
Settings
Integrations
Agent Team
Agent Runs
Agent Requests
For Builders
Builder Overview
Public Agent Policy
LLM Models
Action Availability
Knowledge Base
Secrets
Serverless Functions
Snippets
Clone an Agent
MCP Server
Lists in For Loops
Output Formatting
Actions
Get User Input
Get User File
Get User List
Get User KBs and Files
Click Go to Continue
Wait for User Confirmation
Get Bluesky Posts
Enrich with Breeze Intelligence
Get Data from Builder's Knowledge Base
Get Data from User's Uploaded Files
Get Instagram Followers
Get Instagram Profile
Get LinkedIn Activity
Get LinkedIn Profile
Get Twitter Users
Get Recent Tweets
Google News Data
Search Bluesky Posts
Search Results
Web Page Content
Web Page Screenshot
YouTube Channel Data
YouTube Search Results
Get HubSpot CRM Object
Add HubSpot CRM Object
Update HubSpot CRM Object
Get HubSpot Owners
Get HubSpot Object Properties
Get Assigned Company
Use GenAI (LLM)
Generate Image
Set Variable
Add to List
Continue or Exit Workflow
If/Else Statement
For Loop
End If/Else/For Statement
Show User Output
Send Message
Create Blog Post
Save To Google Doc
Format Text
Post to Bluesky
Save To File
Convert File
Call Serverless Function
Invoke Web API
Invoke Other Agent
Store Variable to Database
Get Variable from Database
On this page
Overview
Use Cases
How to Use If/Else Statements
Step 1: Add the Action
Step 2: Configure the First Condition
Writing Conditions
Step 3: Add Additional Paths (Else If)
Step 4: Add a Default Path (Else)
Step 5: End the Statement
Example: IF/ELSE Example Agent
Actions
If/Else Statement
Overview
If/Else statements create decision points in your workflow. They evaluate a condition and direct your agent down different paths based on whether that condition is true or false.
Use Cases
Create branching workflows based on user inputs or data values
Implement decision logic to handle different scenarios
Personalize responses to different types of users
Apply different processing based on data characteristics
How to Use If/Else Statements
Step 1: Add the Action
In your agent’s Actions tab, click “Add action”
Select the “If/Else Statement” option
Step 2: Configure the First Condition
Leave the “Is Else Statement?” checkbox
unchecked
for your first condition
Enter your condition in the field
Add the actions you want to run when this condition is TRUE
Writing Conditions
Conditions must evaluate to true or false. Common formats include:
Comparing numbers
: variable > 100
Checking equality
: variable == “specific value”
Multiple conditions
: variable1 > 10 && variable2 == “active”
Step 3: Add Additional Paths (Else If)
Add another “If/Else Statement” action
Check the “Is Else Statement?” checkbox to connect it to the previous condition
Enter your next condition
Add the actions you want to run when this condition is TRUE
Repeat this step to add as many alternative paths as needed
Step 4: Add a Default Path (Else)
Add an “If/Else Statement” action after your other conditions
Check the “Is Else Statement?” checkbox
Leave the Conditional Statement field
blank
Add the actions to run when no other conditions are met
Step 5: End the Statement
After all your conditional paths, add the “
End If/Else/For Statement
” action
Example: IF/ELSE Example Agent
See
this simple example
agent to learn how to use If/Else statements:
We collect a budget amount from the user
We evaluate three budget ranges
Each path provides different output based on the budget amount
Continue or Exit Workflow
For Loop
Assistant
Responses are generated using AI and may contain mistakes.