Skip to main content
All CollectionsFlows
Understanding Conditional Routing in AI Agent Flows
Understanding Conditional Routing in AI Agent Flows

Learn how to use conditional routing to create dynamic conversation paths based on API responses and user inputs.

Alvaro Vargas avatar
Written by Alvaro Vargas
Updated over a month ago

What is Conditional Routing?

Conditional Routing is a powerful feature that allows your AI Agent to make intelligent decisions based on specific conditions, such as API responses or captured variables. Think of it as a traffic controller for your conversations, directing users down different paths based on their inputs or system responses. This feature is available on all plans.

Key Components

The Conditional Routing node consists of several essential components that work together to create dynamic conversation flows:

  • Model Selection: Choose from available AI models (GPT-4, GPT-4o, etc.)

  • Temperature Settings: Adjust how creative or precise the AI's responses should be

  • Multiple Conditions: Create and manage different routing scenarios

  • No Match Path: Define behavior for when no conditions are met

Creating Effective Conditions

Each condition in your routing node requires careful setup to ensure proper functionality. A well-structured condition includes a clear evaluation prompt, relevant variables, and a defined execution path.

For example, a basic order verification setup might look like this:

Condition #1: Check if API response contains matching order number Reference variables: {last_api_response}, {numero_de_orden}

Condition #2: Check if API response doesn't contain matching order Reference variables: {last_api_response}, {numero_de_orden}

Writing Clear Conditions

Your condition prompts should be specific and unambiguous. Focus on creating conditions that are:

  • Easy to understand

  • Specific to one scenario

  • Properly ordered (more specific before more general)

  • Well-documented

Variable Usage

When setting up your conditions, remember to:

  • Use curly braces to reference variables: {variable_name}

  • Ensure variables are captured before they're needed

  • Validate variable content within your conditions

Common Use Cases

Order Status Verification

One of the most common applications of Conditional Routing is in order status checking. The system can:

  • Verify order numbers against your database

  • Route users based on API response content

  • Handle invalid order numbers gracefully

  • Escalate to support when necessary

API Response Processing

When working with external systems, Conditional Routing excels at processing various API responses. Your flow can handle multiple scenarios:

  • Successful API calls with valid data

  • Failed requests requiring error handling

  • Empty or invalid responses

Testing & Auditing Strategy

  • Test & Audit mode in conversation transcripts before deploying to production to review how conditional routing is performing

  • Verify all possible conversation paths

  • Include edge cases in your testing

  • Monitor routing performance regularly

Did this answer your question?