Condition Operators
A structured condition is the object that decides whether a routing case holds. It appears as the
when of a case on a condition or agent-directive node, and as the when of an
agent-directive’s humanGate, where it decides whether the step waits for a person:
{ "id": "check-status", "type": "condition", "cases": [ { "when": { "operator": "eq", "left": { "contextPath": "status" }, "right": "ready" }, "output": "ready" } ], "connections": { "ready": "next-step", "default": "wait" }}Every example below shows the condition object itself — what you place in a case’s when.
Comparison Operators
Equal (eq)
{ "operator": "eq", "left": { "contextPath": "status" }, "right": "ready"}Works with strings, numbers, booleans.
Not Equal (neq)
{ "operator": "neq", "left": { "contextPath": "error_count" }, "right": 0}Greater Than (gt)
{ "operator": "gt", "left": { "contextPath": "score" }, "right": 80}Greater Than or Equal (gte)
{ "operator": "gte", "left": { "contextPath": "items_count" }, "right": 1}Less Than (lt)
{ "operator": "lt", "left": { "contextPath": "retry_count" }, "right": 3}Less Than or Equal (lte)
{ "operator": "lte", "left": { "contextPath": "error_rate" }, "right": 0.05}String Operators
Contains (contains)
{ "operator": "contains", "left": { "contextPath": "message" }, "right": "error"}Also works with arrays:
{ "operator": "contains", "left": { "contextPath": "tags" }, "right": "urgent"}Existence Operators
Exists (exists)
{ "operator": "exists", "value": { "contextPath": "optional_field" }}Returns true if variable exists and is not null/undefined.
Logical Operators
AND (and)
All conditions must be true:
{ "operator": "and", "conditions": [ { "operator": "eq", "left": { "contextPath": "status" }, "right": "complete" }, { "operator": "gt", "left": { "contextPath": "score" }, "right": 80 } ]}OR (or)
At least one condition must be true:
{ "operator": "or", "conditions": [ { "operator": "eq", "left": { "contextPath": "priority" }, "right": "high" }, { "operator": "eq", "left": { "contextPath": "priority" }, "right": "critical" } ]}NOT (not)
Negates a condition:
{ "operator": "not", "condition": { "operator": "eq", "left": { "contextPath": "status" }, "right": "blocked" }}Context Path Syntax
Simple Path
{ "contextPath": "variable_name" }Nested Path
{ "contextPath": "user.profile.name" }Array Index
{ "contextPath": "items[0]" }Combined
{ "contextPath": "results[0].score" }Literal Values
Right-hand values can be literals:
{ "right": "string value"}{ "right": 42}{ "right": true}{ "right": null}When comparing with contextPath on both sides, both values are resolved from context before
comparison.
Common Patterns
Check Boolean Flag
{ "operator": "eq", "left": { "contextPath": "has_tests" }, "right": "yes"}Check Iteration Limit
{ "operator": "lt", "left": { "contextPath": "current_iteration" }, "right": 5}Route Three Outcomes
One case per authored output; the first case that holds wins, and default covers the rest:
{ "id": "route-verdict", "type": "condition", "cases": [ { "when": { "operator": "eq", "left": { "contextPath": "verdict" }, "right": "blocked" }, "output": "blocked" }, { "when": { "operator": "eq", "left": { "contextPath": "verdict" }, "right": "minor" }, "output": "minor" } ], "connections": { "blocked": "escalate", "minor": "fix-issues", "default": "proceed" }}See Also
- Workflow Templates - Using conditions in workflows
- Validation - Input validation rules