Conditional Logic & Branching

Conditional logic is an AI UX pattern that lets users (or agents) branch a workflow with if/else rules based on model output, tool results, or user state. Automation adapts instead of following one rigid script.

Share

Interactive demo

Conditional Logic
Input Value
75
Condition: Value > 50?
Yes → Action A
No → Action B

Overview

The design problem

How might we design conditional logic & branching so people can trust and act on AI output?

Use this pattern

When this pattern fits

  • Ideal for automation platforms, workflow tools, and integration systems where conditional branching enables intelligent, adaptive automation workflows.

Avoid this pattern

When to skip or lighten it

  • Single-step prompts with no branching need.
  • Flows so complex that a visual graph becomes unmaintainable—split into subflows.
  • High-stakes decisions that still need a human gate at every branch.

States

State model coming soon

Key UX elements

Key UX elements coming soon

Anti-patterns to avoid

  • Hidden branches that fire with no preview in the builder.

  • Conditions written only in code with no readable summary.

  • Infinite loops with no max-iteration guard.

  • Branch labels that do not match the actual predicate.

How products use it

ProductImplementation
ZapierPaths and filters that branch automations on field values.
MakeRouters and conditional modules in scenario graphs.
n8nIF and Switch nodes in workflow canvases.
IFTTTSimple conditional applets for consumer automations.

Implementation

Copy this prompt to generate a production-ready implementation in Cursor, Claude Code, Lovable, or any AI coding agent.

Generate a production-ready implementation of the "Conditional Logic & Branching" AI interface design pattern.

Pattern Definition:

Frequently asked questions

What is conditional logic in agent UX?

It is branching in a workflow: based on a condition (score, intent, tool status), the agent takes path A or B instead of one linear script.

How should conditions be shown to users?

In plain language next to the node (“If confidence < 0.6 → escalate”), with a test/simulate mode when possible.

How does this differ from plan-and-execute?

Plan-and-execute lays out steps for one goal. Conditional logic decides which steps run based on runtime signals.

What safety rails belong here?

Max branch depth, loop limits, and mandatory human approval on high-impact branches.

Weekly AI UX in your inbox

Weekly AI interface UX notes and resources on Substack, no spam, unsubscribe anytime.

Subscribe on Substack