For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Dashboard
User GuideDeveloper GuidesAPI Reference
User GuideDeveloper GuidesAPI Reference
  • Getting Started
    • What is Runtype?
    • Creating your account
    • Platform keys vs. BYOK
    • Understanding the Runtype UI
    • Quickstart: Social Media Post Generator
    • Quickstart: From Agent to Chat Widget
  • Dashboard
    • What is the Dashboard?
    • Daily executions
  • Playground
    • What is the Playground?
  • Products & Surfaces
    • What are Products?
    • What are Surfaces?
    • Creating a product
    • Setting up a chat surface
    • Setting up an API surface
    • Setting up an MCP surface
    • Setting up an A2A surface
    • Setting up a Slack surface
    • Setting up a webhook surface
    • MCP authentication
    • Authenticating with product API keys
    • Embedding the chat widget (script tag)
    • Embedding the chat widget (React)
    • Surface orchestration modes
    • Product views
    • Adding capabilities to a product
    • Connecting external agents
    • How A2A works
    • Connecting to MCP clients
    • Scoping API keys to capabilities
    • Auto-generated OpenAPI spec
    • Calling your API endpoints
    • Client tokens and domain restrictions
    • AI-powered theme generation
    • Widget theming and customization
    • Product versioning and status
  • Flows
    • What are Flows?
    • Creating and editing flows
    • Flow step types overview
    • Agent and flow templates
    • Using prompt steps
    • Using transform-data steps
    • Using conditional steps
    • Using fetch-url and api-call steps
    • Using record steps (upsert/retrieve)
    • Flow variables and templates
    • Flow versioning and publishing
    • Running flows in batch
    • Handling batch failures
    • Debugging flows
  • Agents
    • What are Agents?
    • Creating and configuring agents
    • Agent tools
  • Records
    • What are Records?
    • Creating and managing records
    • Using records in flows
    • Filtering and searching records
  • Tools
    • What are Tools?
    • Built-in tools
    • Creating custom tools
    • Creating external tools
    • Runtime tools
  • Evals
    • What are Evals?
    • Running an eval
    • Interpreting eval results
  • Schedules
    • What are Schedules?
    • Automating batch processing
  • Logs
    • What are Logs?
    • Working with logs
  • Integrations
    • Connecting AI model providers
    • Slack integration
    • Google Workspace integration
    • GitHub integration
    • Linear integration
    • Weaviate (vector search)
    • Firecrawl (web scraping)
    • Exa (web search)
    • Braintrust (tracing)
  • Settings
    • What's in Settings?
    • Available AI models
    • What are Organizations?
    • Managing AI models
    • Managing API keys
    • Managing secrets
    • Billing and plans
    • Usage data
    • Team members and permissions
    • Appearance and preferences
    • Integrations (PostHog, Weaviate, Daytona)
  • Troubleshooting & FAQ
    • FAQ
    • Rate limits and usage
    • Managing Runtype with Claude
    • Agent skills
    • Flow execution failures
    • Common errors and solutions
    • Authentication issues
Dashboard
LogoLogo
On this page
  • Add a conditional step
  • Writing conditions
  • Examples
  • Check AI confidence
  • User tier routing
  • Error detection
  • Multiple conditions
  • String comparisons
  • Checking for existence
  • Nested conditionals
  • Stopping on invalid input
  • Accessing branch outputs
  • Testing conditionals
  • Common patterns
  • Validation
  • Feature flags
  • Fallback logic
  • Conditionally skipping a single step (when)
  • Set a when condition in the editor
  • How skipping works
  • Errors are treated as skip by default
  • When to use when vs a Conditional step
  • Next steps
Flows

Using conditional steps

Was this page helpful?
Previous

Using fetch-url and api-call steps

Next
Built with

Conditional steps branch Flow execution based on conditions, letting you build if/else logic and route data through different paths. To gate a single step instead of branching, give that step a when condition — see Conditionally skipping a single step (when).

Add a conditional step

  1. In the Flow editor, click Add Step
  2. Select Conditional
  3. Configure:
    • Name: Descriptive label (e.g., “Check sentiment”)
    • Condition: Define when the “if” branch executes
    • If branch: Steps to run when condition is true
    • Else branch: Steps to run when condition is false (optional)
  4. Click Save Step

Writing conditions

Conditions use JavaScript expressions. Reference variables with {{variable}} syntax:

{{sentiment.score}} > 0.5

Supported operators:

  • ==, !=, <, >, <=, >= — Comparison
  • &&, || — Logical AND/OR
  • ! — Negation

Examples

Check AI confidence

{{analysis_result.confidence}} > 0.8

If true: Use AI response. Else: Route to human review.

User tier routing

{{customer_data.tier}} == "premium"

If true: Priority support Flow. Else: Standard support Flow.

Error detection

{{api_result.status}} != 200

If true: Error handling. Else: Process response.

Multiple conditions

{{order_total}} > 1000 && {{customer_data.tier}} == "standard"

If true: Require approval. Else: Auto-approve.

String comparisons

Use quotes for string values:

{{sentiment_result.label}} == "negative"
{{process_status}} != "completed"

Checking for existence

Test if a value exists:

{{customer_data.email}} != null
{{order_history.length}} > 0

Nested conditionals

Add conditional steps inside if/else branches for complex logic:

Main conditional: Is tier premium?
If true:
Nested conditional: Is order > $5000?
If true: VIP processing
Else: Premium processing
Else: Standard processing

Conditional steps can be nested up to 10 levels deep. Flows that exceed this limit fail validation. Real-world flows rarely need more than 3 or 4 levels. If you are approaching the limit, use a transform-data step to consolidate the branching logic into a single boolean expression, then reference that in one conditional.

Stopping on invalid input

Use a conditional branch to guard against invalid requests. Place the main processing logic in the “else” branch so the Flow skips it when validation fails:

Conditional: Is request invalid?
If true: Log or notify about the error
Else: Continue processing

Keep conditions simple. If you need complex logic, use a transform-data step to calculate a boolean, then reference that in the conditional.

Accessing branch outputs

Steps inside conditional branches set their outputVariable in the same Flow-level scope. Reference them by their outputVariable name in later steps:

{{branch_result}}

Testing conditionals

Run your Flow with inputs that trigger both branches:

  1. Test with condition = true input
  2. Verify “if” branch executes
  3. Test with condition = false input
  4. Verify “else” branch executes

Common patterns

Validation

Conditional: Input is valid?
If false: Log validation error
Else: Continue processing

Feature flags

Conditional: New feature enabled?
If true: New implementation
Else: Legacy implementation

Fallback logic

Conditional: Primary API succeeded?
If false: Try backup API
Else: Use primary response

Conditionally skipping a single step (when)

Any step can carry an optional when condition that gates just that one step. When the condition is falsy, the step is skipped and the Flow continues — you don’t need to wrap the step in a Conditional to do this.

This is useful when one step should only run in certain cases, such as a retry that runs only after a failure, or an enrichment step that runs only when data is present.

Set a when condition in the editor

By default, every step shows an Always runs pill. Set a condition to make the step run only when that condition is true:

  1. In the Flow editor, find the step you want to gate
  2. Click the Always runs pill on that step
  3. Enter a JavaScript expression in the condition editor (up to 500 characters)
  4. Save the condition

Once a condition is set, the pill changes to Runs conditionally with an amber accent, and the step gets an amber left border so you can spot gated steps at a glance. Consecutive steps that share the same condition are grouped together under a single amber border.

How skipping works

When the Flow runs and a step’s when condition evaluates to a falsy value, that step is skipped:

  • The step’s outputVariable is set to null, so later steps that reference it see null rather than stale data
  • The Flow continues to the next step as normal
  • The step appears as skipped in the execution trace

Conditions use the same {{variable}} syntax as Conditional steps. For example:

{{needs_retry}} == true

This step runs only when needs_retry is true; otherwise it is skipped.

Errors are treated as skip by default

If a when condition throws an error — for example, because of a typo or a missing variable — the step is skipped by default rather than failing the whole Flow. This keeps a single bad expression from halting execution.

If you want a broken condition to stop the Flow instead, set the step’s error handling to fail on error.

When to use when vs a Conditional step

Use when to skip a single step. Use a Conditional step when you need separate true and false branches.

when conditionConditional step
ScopeGates a single stepGates one or more branching steps
BranchesSkip or runTrue branch and false branch
Output when skippedoutputVariable becomes nullBranch steps set their own outputs
Use case”Only run this step if X""If X do A, else do B”

Next steps

  • Flow variables and templates for variable reference
  • Using transform-data steps to prepare data for conditionals
  • Debugging flows to trace conditional execution and skipped steps