Free Intro Class
    Botspot Logo

    agenthub · switch-case

    Switch / Case

    Route on one value across many branches. Each case label you add becomes its own output port; anything unmatched leaves through default.

    category Logicin value · dataout defaultexecution asyncmodel cost none

    Why the node earns its place

    The sibling of Condition, and the clean way to fan a status field — an onboarding stage, a ticket state — to one branch per value. Chaining Conditions to do the same thing would trip the executor's no-reconverge constraint almost immediately.

    Matching is equality only, deliberately: loose enough that a config "5" matches an integer 5, with an optional normalize pass. There is no expression language to learn, and no eval to audit.

    How it works at run time

    1. 1
      Resolve the match value: a wired value input, then value_context_key from run context, then the value path into data.
    2. 2
      Normalise the value and every case label together when set — lower for case-insensitive, phone10 for numbers.
    3. 3
      Walk the cases in order; first match wins. Its label is the branch that fires.
    4. 4
      No match leaves through default.

    What you wire

    Inputs

    • value
      any
    • data
      object

    Outputs

    • default
      object

    Configuration

    KeyTypeDefault & optionsWhat it does
    valuestringMatch value as a dotted path into the input `data` (e.g. 'record.stage'). Overridden by a wired `value` input or value_context_key. When `value` input IS wired, this path navigates within that wired value.
    value_context_keystringRead the match value from run context instead of data (e.g. 'stage'). Wins over the `value` path.
    cases *arrayThe case labels to match against, in priority order (first match wins). Each label becomes an output branch of the same name; unmatched values fall through to `default`.
    normalizestringdefault "none" none · trim · lower · phone10Normalize the value AND every case label before matching. lower = case-insensitive; phone10 = last 10 digits.

    What usually goes wrong

    Watch for this

    Case labels become port names, so they must be unique, and none of them may be called next or matched — both are keys in the node's own return envelope. Renaming a case rewires the canvas, because the label is the port.

    Behaviour & provenance

    buildersChat & voice agents, Image workflows, Video workflows, Automations
    routesyes — fires one branch
    side effectsnone — computes only
    replay safetynot applicable
    talks tonothing outside the run
    holdsno credentials