Smooth Operators
Operators in Agent Script allow you to compare values, combine conditions, and perform arithmetic
Operators
Operators in Agent Script allow you to compare values, combine conditions, and perform arithmetic. These are used in conditional expressions and variable assignments.

Comparison Operators
| Operator | Description | Example |
|---|---|---|
== | Equal to | @variables.count == 10 |
!= | Not equal to | @variables.status != "done" |
< | Less than | @variables.age < 18 |
<= | Less than or equal | @variables.score <= 100 |
> | Greater than | @variables.count > 0 |
>= | Greater than or equal | @variables.total >= 50 |
is | Identity check | @variables.value is None |
is not | Negated identity | @variables.data is not None |
Examples
# Equality
if @variables.status == "active":
| Your account is active.
# Inequality
if @variables.role != "admin":
| You don't have admin access.
# Numeric comparisons
if @variables.balance > 0:
-> run @actions.process_withdrawal
if @variables.attempts >= 3:
-> transition to @subagent.lockout
# Null checks
if @variables.email is not None:
-> run @actions.send_notification
if @variables.phone is None:
| Please provide a phone number.Logical Operators
| Operator | Description | Example |
|---|---|---|
and | Logical AND | @variables.a and @variables.b |
or | Logical OR | @variables.x or @variables.y |
not | Logical NOT | not @variables.flag |
Examples
# AND - both conditions must be true
if @variables.is_verified and @variables.has_payment:
-> run @actions.complete_purchase
# OR - at least one condition must be true
if @variables.is_admin or @variables.is_moderator:
-> set @variables.can_delete = True
# NOT - inverts the condition
if not @variables.email_confirmed:
| Please confirm your email address.
# Combined operators
if @variables.is_logged_in and (not @variables.is_banned):
| Welcome back!
if (@variables.role == "admin" or @variables.role == "manager") and @variables.is_active:
-> run @actions.show_dashboardArithmetic Operators
| Operator | Description | Example |
|---|---|---|
+ | Addition | @variables.count + 1 |
- | Subtraction | @variables.total - 5 |
Examples
# Incrementing a counter
-> set @variables.attempt_count = @variables.attempt_count + 1
# Calculating remaining attempts
-> set @variables.remaining = @variables.max_attempts - @variables.attempt_count
# Using in conditions
if @variables.balance - @variables.withdrawal_amount >= 0:
-> run @actions.process_withdrawal
else:
| Insufficient funds for this withdrawal.Operator Precedence
When combining operators, use parentheses to ensure correct evaluation:
# Without parentheses - may not work as expected
if @variables.a or @variables.b and @variables.c:
# This is evaluated as: a or (b and c)
# With parentheses - explicit and clear
if (@variables.a or @variables.b) and @variables.c:
# This is evaluated as: (a or b) and cBest Practice
Always use parentheses when combining and and or operators to make your intent clear.
Common Patterns
Range Checking
if @variables.quantity >= 1 and @variables.quantity <= 100:
-> run @actions.process_order
else:
| Please enter a quantity between 1 and 100.Multiple Value Checking
if @variables.status == "shipped" or @variables.status == "delivered":
| Your order is on its way or has arrived.Conditional Variable Setting
if @variables.order_total > 100:
-> set @variables.shipping_cost = 0
else:
-> set @variables.shipping_cost = @variables.base_shipping + 5Guard Conditions
before_reasoning:
# Guard: ensure required data exists
if @variables.customer_id is None or @variables.session_valid == False:
-> transition to @subagent.authenticationRelated Pages
- Conditional Expressions - Using operators in if/else logic
- Variables - Working with variable values
- Reasoning Instructions - Where operators are used
8. Conditional Expressions, Oh My!
Conditional Expressions let you deterministically specify what actions to take or which prompts to include based on the current context
10. Tell Me About Utils
Utils are utility functions that can be used as tools in Agent Script, providing built-in capabilities for subagent transitions, variable setting, and escalation