Argyll Expressions

Decide which work applies and adapt data between capabilities with small expressions.

Set language to argyll to use Argyll Expressions in a Script Step, Predicate, Attribute match or mapping, Space selector, or Feed fold.

Names Available in Argyll

ContextAvailable namesExpected result
Script StepResolved inputs after input mapping, consts, Feed inputs, and declared metadata inputsObject of raw outputs, or a value wrapped as result
Step PredicateResolved inputs under their invocation names, consts, and Feed inputsboolean
Attribute matchOne candidate as valueboolean
Input mappingThe selected input under mapping.name, or its Attribute name when no name is suppliedTransformed input value
Output mappingRaw outputs under the output Attribute’s outer nameValue to store for that output Attribute
Space selectorStable Step metadata as valueboolean
Feed foldCurrent Feed value as feed, plus the watched Attributes supplied by the contributing Step, bound by nameNew Feed value, serializable to JSON

Input mappings run before Step Predicates and for_each expansion. A Predicate sees the collected inputs with each candidate Work Item’s values overlaid. Metadata inputs are resolved at invocation time and are not available to Step Predicates.

Conditions

A Step Predicate reads its inputs directly:

customer_tier == "premium" && order.total >= 100

A match reads one candidate as value. This condition rejects null candidates and objects without an approved status:

value != null && value?.status == "approved"

A Space selector reads Step metadata:

"domain:risk" in value.tags && value.type == "service"

To select Steps by a tag prefix:

value.tags | any tag: startsWith(tag, "domain:")

A Step Predicate can require every check in an input named checks to pass:

length(checks) > 0 && (checks | all check: check.passed)

all is true for an empty array, so the length test keeps an empty array from passing. Each passed value must be a boolean.

Transform an Input

For an input Attribute named price_dollars with mapping.name set to amount, the expression reads the selected price as amount:

amount * 100

An input of 12.5 becomes "amount": 1250 in the invocation. The mapping receives only this input, which may be a collected list. See Invocation Mapping.

A mapping can also reduce a collected list. For an input mapped as model_results whose costs are decimal strings, this totals them:

sum(model_results | map result: number(result.cost))

Costs of "0.012" and "0.008" produce 0.02, and an empty array produces 0. A cost that is missing or not numeric is an evaluation error, which sends the original value.

Extract an Output

For an output Attribute named user_data, the script receives the whole raw output object as user_data. Given {"user": {"id": "u-123", "name": "Ada"}}, this stores the nested user object:

user_data.user

An output mapping script transforms the raw outputs and stores its result under the output Attribute’s outer name. With several successful Work Items, the script receives their aggregated outputs. This mapping for processed keys each output by its item ID:

processed | reduce byID = {}, entry: {
  ...byID,
  [entry.items.id]: entry.processed,
}

Missing Values and Null

Optional access (?.) handles absent members and missing receivers. A null receiver or incorrect type still raises an error. ?? supplies a fallback for a missing value and keeps explicit null.

customer?.address?.country ?? "CH"

A top-level missing result is an evaluation error. Explicit null is a valid transformation or Script Step result. Object construction omits missing fields. Arrays retain missing elements, which cannot be serialized to JSON. Supply a serializable fallback where needed:

records | map record: record?.email ?? null

Predicates, matches, and selectors require actual booleans. Any other result is an evaluation error. See Validation and Failure Behavior for how each context handles an error.

Validation and Failure Behavior

Step registration and updates compile Script Step bodies, Predicates, matches, and nonempty mapping scripts. Space registration, updates, and previews compile selectors. Feed registration and updates compile fold scripts. Syntax and compilation errors reject the operation. Argyll Expressions also rejects statically incompatible operands, unknown direct function names, invalid fixed argument counts in direct global calls, and a Predicate, match, or selector whose compiled result type can never be boolean. Input-dependent result types are checked at evaluation. Lua result types are checked at evaluation.

ContextEffect of an evaluation error
Script StepFails the Work Item and Step and records the failure
Step PredicateFails the Step before any of its Work Items starts and records the failure
Required-input matchFails the consuming Step before its work starts and records the failure
Optional-input matchLeaves collection unresolved and keeps the Step pending
Input mappingLogs a warning and uses the original value under the invocation name
Output mappingOmits that output
Space selectorRejects the operation evaluating membership and preserves committed catalog state
Feed foldPreserves the current Feed value and records feed_fold_failed. The contributing Flow continues

These failure consequences apply to both languages. Predicate and required-match failures do not use Work Item retries, and Script Step evaluation failures are permanent Work Item failures. A failed Step can leave other valid paths or fallback Goal sets available. Flow Goals determine the outcome. The Script Steps guide describes the shared sandbox and execution limits.

Language Reference

The Argyll Expressions documentation covers the language in full: