{{}} template-string interpolation, the 43 built-in functions, and type coercion rules. Expressions are used in conditions (WHEN, CHECK, constraint rules), value assignments (SET), template interpolation ({{}}), and function calls. For rich content output formats (voice, cards, carousels, interactive actions, templates), see Rich content.
Expression syntax
Comparison operators
Logical operators
Write logical operators in uppercase (
AND, OR, NOT). ! is also accepted as a prefix negation.
Unary operators
Operator precedence
- Parentheses
() - Unary operators (
NOT,IS SET,IS NOT SET) - Comparison operators (
==,!=,>,<,>=,<=,contains,matches) ANDOR
Quoting a condition
AWHEN value — in HANDOFF, ON_RETURN WHEN, ESCALATE triggers, COMPLETE, and hook WHEN/RESPOND branches — is unwrapped from its quotes and evaluated as a condition whenever it contains a condition operator: ==, !=, <, >, &&, ||, !, IS [NOT] SET, contains, matches, startsWith, endsWith, in, or a function call. So WHEN: "dispute == true" and WHEN: dispute == true are the same condition. A quoted value with none of these — a natural-language phrase such as WHEN: "task done" — stays a quoted literal string, which most deterministic evaluators treat as always-truthy.
Variable paths and dot notation
Reference variables using dot notation to access nested values.Path resolution rules
- The evaluator looks up the full path in the session context.
- The Platform resolves each segment left to right:
user.address.cityresolvesuser, thenaddresson the result, thencity. - If any segment resolves to
nullorundefined, the entire path resolves toundefined. - Array access uses bracket notation:
items[0],items[2].name.
Template strings
Template strings use{{}} syntax for variable interpolation within RESPOND, summary, and other string properties — including inside a TEMPLATES: block body:
Conditional sections
Templates support conditional rendering with{{#if}}...{{/if}}:
Function calls in templates
You can call built-in functions within template strings:Built-in function reference
ABL provides 36 built-in functions organized into seven categories (plus the CEL-only content-analysis helpers described below). All functions are called withFUNCTION_NAME(arg1, arg2, ...) syntax. Function names are uppercase.
Math functions
Math functions coerce string arguments to numbers automatically:
ADD("2", "3") returns 5.
String functions
The string functions gracefully handle
null and undefined and return an empty string: UPPER(null) returns "".
To prevent memory issues, the limit on string output is 100,000 characters.
Identity-matching functions
These compare what a caller actually said against a stored value — they are deterministic similarity scoring, not a semantic/model judgment, built for voice identity verification (see Write authority for aREADONLY field that stores the result).
kind is optional — omitted, it defaults to text (unchanged behavior, no warning) — and otherwise one of:
Platform-owned match bands (authors never pick a threshold):
A
-1 score (nothing to judge) always reports "missing".
The guiding principle: values that sound the same cannot be told apart by a caller (speech-to-text just picks a spelling), so they score as a
"match" — only values that sound genuinely different can fail. For example email compares the domain by sound but matches its ending exactly (kore.ai is not kore.com); person_name matches common respellings (Jon/John, Steven/Stephen) and scores a near-same name (Ahmed/Ahmad) as "retry", never a straight mismatch, while a genuinely different name (Mark/Mary) is a "mismatch"; address reads house/unit letters and matches street words that sound alike. The matcher reads the value itself, not the sentence around it — filler words (“no”, “sorry”, “I mean”) are not stripped, so an answer that contains them alongside the correct value still fails to match as written.Formatting functions
The mask patterns are explained below.
The default mask character is
*. Pass a third argument to use a different character: MASK(ssn, "last4", "x").
The date format uses the following notations:
Example:
FORMAT_DATE("2024-03-15T10:30:00Z", "YYYY-MM-DD HH:mm") returns "2024-03-15 10:30".
FORMAT_DATE formats in UTC by default — a date-time string without an explicit offset is interpreted as UTC, so the output is deterministic regardless of where the runtime executes. Pass an optional IANA timezone name as the third argument to format in that zone instead:
Type checking and coercion functions
Array functions
Object functions
OBJECT_KEYS and OBJECT_VALUES return an empty array for non-object inputs (null, arrays, strings).
OBJECT_MERGE accepts any number of arguments and skips non-object values.
Utility functions
COALESCE considers 0 and false as valid (non-null) values: COALESCE(0, "fallback") returns 0.
UNIQUE_ID generates a random alphanumeric string suitable for reference numbers. It is not cryptographically secure — do not use it for tokens or secrets.
Content-analysis functions (CEL guardrails)
CEL-based guardrail checks have access to an additionalabl.* namespace of content-analysis helpers:
Pattern limits
abl.matches_pattern and abl.not_matches_pattern run on the RE2 engine.
- Each pattern can be at most 500 characters and must use RE2 syntax. RE2 has no backreferences or lookarounds.
- A pattern outside these limits never matches.
abl.not_matches_patternis then true for every input. Validation warns withCEL_MATCH_PATTERN_REJECTED. - To use a longer pattern, split it into several calls joined with
||, or with&&forabl.not_matches_pattern. - The checked text is scanned up to 100,000 characters. Text past that length is not scanned.
In CEL expressions the core functions above are also available under the
abl. namespace with lowercase names (for example, abl.upper(x)), and CEL-native operators (&&, ||, !, %, in, ternary ? :) and macros (size(), has()) can be used.abl.pii_equal(left, right) compares two values without ever exposing the underlying plaintext to the expression — both left and right must be live PII-vault tokens (the opaque form a PII-classified value takes once captured, for example, via a sensitive: true GATHER field), and the comparison happens inside the vault itself. Values are canonicalized before comparing (email lowercased/trimmed, phone/SSN/credit-card digits-only, etc.), so abl.pii_equal(session.data.values.email, caller_provided_email) matches Member@Example.com against member@example.com.
Nested function calls
Functions can be nested as arguments to other functions:Using expressions in ABL
In conditions (WHEN, CHECK, constraint rules)
Long boolean conditions
Ordinary boolean conditions can combineAND, OR, and NOT beyond the original 4,096-unit CEL limit. The extended path accepts up to 65,536 prepared UTF-16 source units, 4,096 syntax nodes, and 64 nesting levels. Each indivisible comparison, call, or ternary stays limited to 4,096 units. CEL evaluates the complete parsed expression and keeps precedence and short-circuit order.
Short conditions, strict checkpoint conditions, PII comparisons, and scalar SET evaluation keep their existing protections. A supported long rule can now match where the old fallback disagreed. No migration is required. An unsupported expression produces the non-blocking warning CEL_EXPRESSION_LIMIT, with its agent, path, and prepared length.
Size limits for conditions and regex patterns
The same limits apply to every condition: stepIF / WHEN branches, HANDOFF and DELEGATE WHEN, COMPLETE, constraints, hooks, and guardrail checks.
Lengths are counted in characters after ABL syntax is converted to CEL, so they can differ slightly from what you typed.
HANDOFF and DELEGATE WHEN evaluate each top-level OR / AND alternative on its own, so the limits apply to each alternative.
A condition or pattern over a limit does not stop the agent and is not an error:
- At publish, the compiler warns:
CEL_EXPRESSION_LIMITfor a condition andCEL_MATCH_PATTERN_REJECTEDfor a pattern written as text. Studio shows up to three of these warnings as toasts after you publish an agent, with a “+N more” note. A pattern held in a variable can only be checked at run time. - At run time, a pattern over the limit matches nothing:
abl.matches_patternis false andabl.not_matches_patternis true for every input. A condition over the limit is not evaluated as written. Most conditions fall back to a simpler evaluator that can return a different result. HookCALL/RESPONDguards, checkpoint conditions, and PII comparisons fail closed. In step branches and inHANDOFF/DELEGATEWHEN, the session trace records awarningevent with codecondition_limit_reached, the reason, and the length.
OR / AND (|| / &&):
Comments in conditions
On condition surfaces that accept line comments,// outside a complete string starts a comment through the end of the line. Comment text does not add variables, operators, or WHEN, BEFORE, or IMPLIES clauses. A quoted URL, or // inside an escaped, raw, bytes, or triple-quoted string, stays literal. YAML enabled_when keeps its separate single-line scalar restriction.
A condition that contains only comments is invalid for these constructs:
- A constraint requirement or applicability gate.
- A
HANDOFForDELEGATEWHENorENABLED_WHEN. - A conditional GATHER activation.
In SET assignments
Missing paths in value expressions
A value expression computes a value for aCALL argument (WITH or a named inline argument), a tool PROCESS mapping, a TRANSFORM MAP field, or a SET. Inside one, a key that is missing from a record reads as null wherever it appears, including inside COALESCE, a ternary, an object or list literal, and arithmetic. So COALESCE(order.list.items, fallback) falls through to fallback when order has no list. Only the branch a ternary takes is evaluated. x IS SET over a missing nested path is false.
An expression has no value in two cases:
- A single path that is not set, such as
empty.list.kindon its own. ACALLargument written this way is left out of the tool input, and aMAPfield has no value. UseCOALESCE(path, default)when the tool needs a value. - An expression that cannot be evaluated, such as text plus a number, a ternary whose condition is not
trueorfalse, or bracket access to a missing key (order["list"].kind). The runtime never sends a partial reading of it. The trace records awarningevent that names the argument or field.
Types in conditions and computed values
- A conditional needs a true/false condition. In
flag ? "a" : "b",flagmust holdtrueorfalse. Text, a number, or a missing value is an evaluation error. Writeflag == true ? "a" : "b"whenflagmay be missing. !xneeds a true/falsex. Writeflag != truewhenflagmay be missing.containsneeds text or a list on the left. On text it is a substring test. On a list, an element must equal the right side. A number or an object on the left is an evaluation error.- Arithmetic needs numbers.
+also joins text to text and a list to a list.
When a SET value cannot be evaluated
A computed value is a function call, field read, index, conditional, comparison, logical operator, or arithmetic with an operand that is quoted text or a variable the session holds or declares. When one cannot be evaluated:- A step
SETclears the variable. AHANDOFFCONTEXTSETleaves it unchanged. - The trace gets a
warningevent with codeset_expression_not_evaluated. It carriesfield,source,outcome(no_value, orstored_expression_textunderkeep_text),reason(ternary_condition_not_bool,no_matching_overload, orevaluation_failed), and ahint. It never carries values or the expression text.
recent_input is a built-in available in SET contexts: the caller’s last 3 utterances, joined. input_transcript is a built-in, read-only SET value on realtime voice channels — the provider’s transcript of the current caller turn (empty when there is none). An authored session variable with either name takes precedence over the built-in.In template interpolation
In TRANSFORM pipelines
Type coercion rules
The evaluator applies these coercion rules during expression evaluation:Related articles:
- Rich content — voice configuration, format-specific output, carousels, interactive actions, and templates
- Memory and constraints — condition expressions in constraint rules, variable paths and session context
- Multi-agent and supervisor — condition syntax for WHEN clauses in routing/escalation
- Data types and utilities — types used in function signatures, lookup validation functions