Validation
Contact email is available:JSON
Build and store a payload:Lists and Randomization
Build a numbered list in a random order withrange, enumerate, append, and random_shuffle:
Debugging With print
Write resolved values to the call’s system notes while the step runs:
print(...) becomes a system note before the final run success note.
Routing With Multiple Conditions
A Code Step can return more than one boolean. Returned booleans map to the step’sconditions array by index:
- Output index
0→conditions[0] - Output index
1→conditions[1] - Output index
2→conditions[2] - The final condition should be
"otherwise"and acts as the fallback
Counter example
This starts at1 and increments each time the step runs:
- First run →
(True, False)→ routes toconditions[0] - Second run →
(False, True)→ routes toconditions[1] - Third run →
(False, False)→ routes to the final"otherwise"condition
Choosing a row by number
Instead of booleans,run() can return a whole number: the condition row to route to, counting from 1. This is easier to maintain when a step has many rows, because adding a row doesn’t change the other returns.
return 1→ the first condition,return 3→ the thirdreturn False(or0) → the final"otherwise"condition- A number past the last row routes to the last row, and a note is written to the call’s system notes
- A negative number is an error and routes to
"otherwise"
return statement. A list or tuple that mixes booleans and numbers, such as return True, 2, is invalid.
Single-boolean tools
All tools use the same condition-array routing. For a single boolean output,True routes to the first condition and False routes to the final one. Return multiple booleans only when a step needs more than true/otherwise routing.
Troubleshooting
Code Step must contain exactly one top-level def run():
Missing def run():, extra top-level statements, or more than one function. Move setup inside run():
unindent does not match any outer indentation level
Inconsistent indentation, or leading spaces before def run():. def run(): must start at the first column.
name 'input_1' is not defined
The code references input_1, but that input isn’t mapped on the step. Map the additional input, or remove the reference.
Function 'x' is not allowed / Method 'x' is not allowed
The code called something off the allow-list. Use an allowed equivalent:
run() must return bool, an int row number, or list/tuple of bools
The return value isn’t a boolean, ordered booleans or a whole row number: for example a string, a decimal such as 1.0, or a tuple with a number in it. Wrap results in bool(...), or return a plain whole number to pick a row.
Counter does not increment
Make sure the same variable placeholder is used for both the read and the write. If the read and write paths differ, the counter appears to reset.Branch goes to the wrong step
Multi-output routing uses condition-array indexes, not matching values, and a returned row number counts from 1 in the same order. Conditionorder controls the sort before routing — verify the stored order matches the intended array order.
Next Steps
- Code Step overview — The
run()contract and variables - Allowed Functions — The full deny-by-default allow-list
- Tool Steps — How tool steps and conditions work

