The when field in ReasonChip tasks lets you control
whether a task should run based on a Python expression. It's evaluated
securely using only the current variable context and a restricted set of
built-in functions.
Internally, when expressions are evaluated using:
result = eval(expr, {"__builtins__": SAFE_BUILTINS}, variables.vobj)
This means your pipeline variables are available as Python-safe attributes, along with the following safe built-ins:
absminmaxsumroundpowlenintfloatstrboollisttupledictsortedreversedenumeraterangeallanyreprformattypeisinstanceiternextescapeunescapeErrors during evaluation raise a safe EvaluationException
with helpful debug info.
variables.vobj)and, or,
not, comparisons)✅ Example:
when: len(items) > 0 and user.is_active
For safety and consistency, the following are not allowed:
eval, exec, compileExample that will still fail (if you try a disallowed object):
when: open("/etc/passwd")
Always keep conditional logic safe and data-driven.
when logic simple and declarative.DeclareTask or CodeTask for complex pre-logic.variables.vobj as your mental model: it's a flattened, attribute-accessible object view of all variables.EvaluationException and halts unless handled upstream.© 2025 South Patron LLC. All rights reserved.
AI everywhere.