- Router Node - Route execution based on condition matching with multiple named paths
- Decision Node - LLM-powered intelligent routing based on natural language criteria
- Human-in-the-Loop Node - Pause execution and request a human decision before proceeding
Router Node
The Router Node evaluates a condition and routes pipeline execution to one of multiple named paths. It uses template-based conditions (similar to Jinja2 syntax) to determine which route to take, with a default fallback route if no conditions match.
- Route execution to different paths based on state variable values
- Implement branching logic with multiple named routes
- Evaluate complex conditions using template syntax
- Provide fallback behavior with default output
- Create multi-path workflows based on data conditions
- Create loops and iterative execution by routing back to previous nodes

Jinja Syntax Examples
Jinja Syntax Examples
The Router Node uses Jinja2-like template syntax for condition evaluation. Here are common patterns:String Matching:Multiple Conditions with elif:Logical Operators:Numeric Comparisons:String Filters:Complex Conditions:
- Always Provide Default Output: Ensure fallback behavior for unmatched conditions to prevent pipeline failures.
- Match Route Names Exactly: Route names in condition must match node IDs exactly (case-sensitive).
- Order Conditions by Specificity: Place most specific conditions first to avoid unintended matches.
- Use Filters for String Comparisons: Normalize strings with
|loweror|upperfor reliable matching. - List All Routes: Include all possible routes in the Routes list for clarity and validation.
- Test All Paths: Ensure every condition path is reachable and test edge cases.
- Use Descriptive Route Names: Name routes clearly to indicate their purpose (e.g., “ApprovedWorkflow” not “Path1”).
- Document Complex Conditions: Add comments in YAML to explain routing logic for maintainability.
- Use Router for Loop Control: When creating loops, use state variables (counters, flags) to control loop termination and prevent infinite loops.
Decision Node
The Decision Node uses LLM intelligence to make routing decisions based on natural language criteria. It operates as a standalone node in the pipeline and analyzes the input to intelligently select the appropriate output path from multiple decision outputs.
- Make intelligent routing decisions using LLM reasoning
- Route based on natural language criteria without writing conditions
- Handle complex decision logic that’s difficult to express in templates
- Leverage context and semantics for routing decisions
- Simplify decision-making with descriptive instructions
Decision nodes cannot be connected to another Decision node. If you need sequential decision-making, use a different node type (such as Router, LLM, or Code) between Decision nodes.

The Decision Node operates as a standalone node that uses LLM to:
- Read input state variables (configured in
inputparameter) - Analyze description for routing criteria
- Select appropriate output from
nodeslist - Return selected node ID for routing
- If uncertain, defaults to
default_output
- Write Clear Decision Criteria: Provide specific, unambiguous routing rules with examples for each path.
- Provide Examples in Description: Help the LLM understand expected routing with concrete examples.
- Always Define Default Output: Provide fallback for unclear cases to prevent pipeline failures.
- List All Decision Outputs: Include all possible routing targets in the
nodeslist. - Structure Descriptions Clearly: Use headings, lists, and clear formatting to organize routing criteria.
- Use Decision Node for Complex Routing: Choose when routing requires semantic understanding, not simple condition matching.
- Configure Input Variables: Include relevant state variables in
inputfor the LLM to analyze. - Test with Various Inputs: Verify LLM routing across different scenarios and edge cases.
- Monitor Decision Quality: Review LLM routing decisions periodically and refine description if needed.
- Provide Context in Description: Help the LLM make better decisions by explaining the use case.
- Use Descriptive Output Names: Name outputs clearly to match description (e.g., “TechnicalSupport” not “Output1”).
- Use Interrupts for Debugging: Enable interrupts to review decision-making and routing results during development.
Human-in-the-Loop Node
The Human-in-the-Loop (HITL) Node pauses pipeline execution and waits for a human decision before continuing. It presents a configurable message to the user and provides up to three action buttons — Approve, Edit, and Reject — each routing to a different downstream node.
- Gate critical actions — require human sign-off before irreversible steps
- Validate AI output — let a human review and approve content generated by previous nodes
- Allow human correction — give users the ability to edit a state value before the pipeline continues
- Implement approval workflows — build multi-step review processes where humans are in the decision path
- Enforce compliance checkpoints — ensure sensitive operations are authorized by a person

How It Works
-
The node builds the user-facing message from the configured
user_message. - Pipeline execution pauses using LangGraph’s dynamic interrupt mechanism.
- The UI displays the message along with action buttons for each configured route.
-
The user chooses an action:
- Execution continues from the target node.
The HITL node uses LangGraph’s
Command(goto=) pattern for routing — no explicit transition field or conditional edges are needed. All route target nodes must exist in the pipeline.UI Behavior
When the pipeline reaches a HITL node during a run, the chat panel displays the configured user message and action buttons for each configured route. Only buttons with valid routes appear. After the user clicks an action, the pipeline resumes automatically. Approve Appears when: theapprove route is configured.
-
The Approve button signals that the user accepts the content or action as-is. Clicking it immediately resumes the pipeline and routes execution to the node specified in
approve. No state variables are modified — the pipeline continues with the same state it had when it paused.
edit route and a valid edit_state_key are configured (and the Edit route does not point to END).
-
The Edit button allows the user to revise a specific piece of content before the pipeline continues. Clicking it opens a text input field pre-filled with (or adjacent to) the current value of the
edit_state_keystate variable. After the user submits the revised text, the pipeline updatesedit_state_keywith the new value and routes execution to the node specified inedit.
reject route is configured.
-
The Reject button (red) signals that the user has declined the content or action entirely. Clicking it resumes the pipeline and routes execution to the node specified in
reject— typicallyENDto cancel the workflow, or a regeneration node to start over. No state variables are modified.
1. Place HITL Before Irreversible Actions
1. Place HITL Before Irreversible Actions
Always gate destructive or hard-to-undo operations:✅ Good:
2. Use F-String to Show Relevant Context
2. Use F-String to Show Relevant Context
Show users the content they are reviewing:✅ Good:
3. Route Edit Back Through Processing When Needed
3. Route Edit Back Through Processing When Needed
If the user’s edited value needs to be re-processed by an LLM, route Edit to a node earlier in the pipeline:
4. Always Configure the Reject Route
4. Always Configure the Reject Route
Without a Reject route, users cannot decline an action. Set it to
END or a recovery node:Example 1: Content Approval Workflow
Example 1: Content Approval Workflow
An LLM generates a blog post draft. A human reviews it, approves it for publishing, edits the draft directly, or rejects it to trigger a full regeneration.
Example 2: Jira Ticket Approval Before Creation
Example 2: Jira Ticket Approval Before Creation
An agent prepares a Jira ticket. A human approves, edits the description, or rejects ticket creation entirely.
Control Flow Nodes Comparison
When to Use Each Node
Router Node
Router Node
Choose Router Node when you:
- Need multiple named routes based on explicit conditions
- Have condition logic you can express in Jinja2-like templates
- Want fast, deterministic routing without LLM overhead
- Know all possible paths and conditions upfront
- Need to match keywords, compare values, or check status
- Need binary or multi-branch conditional logic with if-else routing
- Want to create loops by routing back to previous nodes
Decision Node
Decision Node
Choose Decision Node when you:
- Need LLM intelligence for routing decisions
- Routing logic is complex, nuanced, or context-dependent
- Want natural language decision criteria instead of templates
- Require semantic understanding of user input or content
- Template conditions are too rigid or difficult to express
- Need to analyze multiple input variables simultaneously
- Routing depends on understanding intent, sentiment, or meaning
HITL Node
HITL Node
Choose HITL Node when you need:
- A human to approve, reject, or edit pipeline output before it is acted upon
- A compliance checkpoint before an irreversible operation (database write, external API call, email send)
- Inline human correction of AI-generated content without restarting the pipeline
- An explicit audit trail of human decisions in an automated workflow
Deprecated Control Flow Nodes
The following control flow nodes are deprecated and will be removed in a future release. Please migrate to the recommended alternatives:Condition Node
Condition Node
The Condition node is deprecated and will be removed in an upcoming release.Migration: Use the Router node for expression-based routing or the Decision node for AI-powered routing decisions.Migration Guide: Condition Node Migration
- Nodes Overview - Understand all available node types
- Execution Nodes - Function, Tool, Code, and Custom nodes
- States - Manage data flow through pipeline state
- Connections - Link nodes together
- YAML Configuration - See complete node syntax examples