Router
Route to one of N branches based on a field value.
About this Node
Routes workflow execution to one of multiple named branch ports based on the string value returned by a JMESPath expression (`path`). Each configured entry in `cases` creates a dynamic output port, and a permanent `default` fallback port handles any unmatched or missing value while bypassing all unchosen branches.
Ports & Branches
inPort 0Inbound execution flowcasePort 1Dynamic output ports matching configured case values (1..N)defaultFallback branch when no configured case matchesHow this Node Reads Data
| Input | Access | Field | Example | Description |
|---|---|---|---|---|
| Routing Expression Path | JMESPath | path |
triage.department |
JMESPath query evaluated against the node's incoming state; the resolved value is converted to a string and matched against `cases`. |
State Keys Written (Outputs)
| Key Pattern | Type | Role | Description |
|---|---|---|---|
<scoped state passthrough> |
object |
Primary | Activates exactly one matching branch port (or `default`) and forwards scoped state downstream while bypassing all other branches. |
Tips & Best Practices
- Matching is exact string equality after converting the JMESPath result to text.
- Dynamic branch ports adapt automatically to the workflow's Flow Direction (LTR, RTL, TTB, BTT).
Commonly Paired With
Settings Parameters (2)
Configuration schema synchronized with the workflow catalog
| Field | Type | Default | Allowed Options | Description |
|---|---|---|---|---|
path |
string |
"" |
— | Context path to evaluate (JMESPath syntax) |
cases |
array<string> |
— |
— | List of case values to match |
AI Support Ticket Router
Dispatch tickets classified by an upstream LLM into dedicated `billing`, `technical`, and `sales` queues with a `default` fallback.
Node Configuration
{
"Id": "logic_switch_1",
"Type": "logic_switch",
"Config": {
"path": "classification.queue",
"cases": [
"billing",
"technical",
"sales"
]
}
}Sample Input State
{
"classification": { "queue": "billing", "priority": "high" }
}Expected Output State
{
"_chosen_branch": "billing"
}Tip: Always wire the `default` port to a fallback handler or `output_finish` node so unexpected values never stall silently.
HTTP Status Family Routing
Route based on a top-level status string computed by a Python Script or upstream API.
Node Configuration
{
"Id": "logic_switch_1",
"Type": "logic_switch",
"Config": {
"path": "decision",
"cases": [
"approve",
"escalate",
"reject"
]
}
}Sample Input State
{
"decision": "escalate"
}Expected Output State
{
"_chosen_branch": "escalate"
}