Skip to content
AGENTEX on XEnter App

Conditions and transforms

Branch on a value with Condition steps, and pick, compare, threshold or format values with Transform steps and sandboxed code.

Conditions and transforms are the logic steps of a workflow. A condition decides which later steps run; a transform turns captured values into the values you report. This page covers their settings, exactly how they evaluate, and the optional sandboxed transform for your own code. It is for creators building workflows.

Values from earlier steps#

Logic steps work on values chosen in a value picker:

  • Input: name: the buyer's value.
  • Step name → Field: one output field of a data step, for example "Token metadata → Decimals".
  • Step name result: the result of a condition, transform, AI analysis or sandboxed transform.
  • Fixed value: a value you type. true and false are read as booleans; everything else as text.

A step can only use values from steps ticked under its Depends on. Values carry their evidence: a transform of a data step's output keeps that step's evidence, so a finding built from it still cites the original reads.

Condition#

A condition checks one value and chooses which dependent step runs next. Add it with Condition ("Branch on a value") in the library.

SettingWhat to enter
Checked valueThe value to test.
ComparisonOne of the operators below.
Compared withThe value to compare against (not shown for "exists"). "Numbers compare exactly, never as floating point."
If true, continue toA step to run when the check is true, or No step.
If false, continue toA step to run when the check is false, or No step.
ComparisonTrue when
equalsThe value equals the compared value. EVM addresses compare without regard to letter case; a number and a numeric text compare as exact numbers.
existsThe checked value is available (its step succeeded and the field is present). Takes no compared value.
is greater thanThe value is a number greater than the compared number.
is less thanThe value is a number less than the compared number.
is at leastThe value is a number greater than or equal to the compared number.
is at mostThe value is a number less than or equal to the compared number.

Branches#

  • Only steps that depend on the condition appear in the branch lists: "A branch step must depend on this condition: tick it under "Depends on" on that step."
  • Set at least one branch, and make the two branches different steps.
  • The step in the branch that is not taken is skipped, with a reason such as "Condition check did not select this branch (false)." Steps that depend on a skipped step are skipped too.
  • Steps that depend on the condition but are in neither branch run whatever the outcome.

When a condition cannot decide#

If the checked value is unavailable (its step failed or the field is missing), or the values cannot be compared (for example text with "is greater than"), the condition evaluates to unknown: neither branch runs, the trail shows "condition was unknown", and the report is partial. "exists" never returns unknown: an unavailable value is simply false.

Use the outcome as a value#

A condition's result is true or false (empty when unknown). Bind Condition name result to a finding of type True or false to report the outcome itself, for example "Supply above one billion: true".

Transform#

A transform computes one value from others. Add it with Transform ("Pick, compare or format values") and choose an Operation.

OperationSettingsResult
Pick a valueValue to pickThe chosen value, unchanged, with its evidence.
Compare two valuesFirst value, Comparison (equals, is greater than, is less than, is at least, is at most), Second valueTrue or false.
Threshold (above / equal / below)Value, Threshold (an exact decimal)The text above, equal or below.
Format an exact token amountAmount in the token's smallest unit, DecimalsThe amount as an exact decimal, for example 1000000 with 6 decimals becomes 1. "Uses whole-number arithmetic, so the formatted amount is exact."

All comparisons use exact decimal arithmetic. If an input value is unavailable or of the wrong kind (for example a non-numeric threshold value, or an amount that is not a whole number of smallest units, or decimals outside 0 to 255), the transform's result is unavailable with a reason, and any finding that uses it is reported as unknown.

The result of a transform is used as Transform name result. Bind it to a finding whose type matches: True or false for a comparison, Text for a threshold, Exact decimal for a formatted amount.

Sandboxed transform#

A sandboxed transform runs your own JavaScript on values from earlier steps. The production server offers it; where it is not offered the library shows "Not available on this server".

SettingRule
Values passed to (step)Named values, added with New value name and Add value. "The code receives these values as one JSON object; its result keeps their evidence and adds no observation of its own."
CodeOne ES module, up to 16,000 characters, that exports a default function returning JSON, for example export default ({ value }) => ({ value });
Time limit (ms)500 to 10,000 milliseconds, and no longer than the step timeout.

The code "Runs in an isolated container with no network, a read-only filesystem and CPU, memory and time limits." Its output is limited to 64 KiB. Code containing credentials is rejected. Diagnostics from your code are never copied into the report.

Use the result as Sandboxed name result in later steps. Its value is whatever your function returned. A finding can only report a single text, number or true-or-false value, so return one of those if you want to report the result directly.

A workflow with a sandboxed transform cannot publish a saved example, and the report adds the limitation: "Sandboxed transform values are computed by creator code in an isolated container without network access; they inherit the evidence of their inputs and add no observation."

Example: flag a large supply#

  1. Add Token metadata (Tokens and wallets) with Token address set to Input: Token address.
  2. Add a Transform, operation Format an exact token amount: amount "Token metadata → Total supply atomic", decimals "Token metadata → Decimals". Its Depends on must include Token metadata.
  3. Add a second Transform, operation Threshold: tick Token metadata under Depends on, set value to "Token metadata → Total supply atomic" and threshold to 1000000000000000000000000000 (one billion tokens at 18 decimals).
  4. Add a Report section, tick both transforms under Depends on, and declare two findings in Settings: "Total supply" (Exact decimal) bound to the first transform and "Supply versus one billion" (Text) bound to the second.

Every finding cites the Token metadata reads, because both transforms inherit that step's evidence.