Conditional Routing
Updated 10 days ago • July 24, 2026
Conditional routing is driven by edge when values and node return values.
Edge syntax
Node return
Execution routing matches in this order:
state.lastConditionstate.lastIntent
If no condition matches for that conditional group, runtime falls back to an internal __end__ mapping for that source node.
Example loop
Define the condition branches on the workflow edges.
Return the matching condition from the node.
Workflow transition (different from edge routing)
Use transitionTo to jump to another workflow id:
The orchestrator emits a transition chunk and loads the target workflow with selectWorkflow.
Studio topology visibility
Kortyx Studio uses a hybrid model for workflow-to-workflow edges:
- The canonical path is
kortyx topology push, usually run in CI or during deploy. This sends declared topology to the Kortyx API before traffic arrives. - If the SDK can statically understand a
transitionTotarget from node code, the pushed topology can show that edge before the transition has ever run. - If the target is computed dynamically, Studio still records the edge after the transition happens at runtime.
For local development:
For CI/deploy:
Prefer return shapes where the target workflow id is visible in code:
Constants are also fine when they map clearly to registered workflow ids:
Avoid hiding stable workflow topology behind arbitrary runtime logic when the set of targets is known:
If a transition target is truly dynamic, no extra metadata is required. Studio will show the edge once telemetry observes an actual transitionTo event.