Nodes/comfyui-AGSoft/🔀 AGSoft Switch Any
ComfyUI Node

🔀 AGSoft Switch Any

One switch that routes images, text, latents, models — anything at all

By Art-xmaster·Created 12 months ago·Updated a day ago· 23
🔀 AGSoft Switch Any
    • output
    selected_inputinput_1
    number_of_inputs2

    ComfyUI switches are usually typed - a text switch routes text, an image switch routes images, and the moment you want to switch between a checkpoint and a LoRA-loaded model you're out of luck. 🔀 AGSoft Switch Any refuses that limitation: its inputs accept any data type, so one node can route images, text, latents, models, audio, video - anything with a wire. Set the selector, and whatever's on the chosen input passes through the output untouched.

    How it works

    Two controls:

    • number_of_inputs (2–30) - how many sockets it grows. Default 2, and the node always keeps at least two. Inputs are named input_1, input_2, etc.
    • selected_input - a dropdown (input_1input_30) that picks which one flows to the output. It updates automatically to match number_of_inputs, so you can't select a socket that doesn't exist.

    Under the hood it's a *-typed input grabbing from **kwargs and returning the chosen value unchanged - no copying, no type juggling. That's the whole mechanism, and it's exactly why it works on model objects: the node never inspects what it's passing.

    The single output is * - the wildcard type - so it'll plug into anything downstream that expects a specific type. Because ComfyUI routes by matching types at connect time, the * output is what makes this the rare switch that doesn't complain when you later drag it to a model input.

    Where it shines

    • A/B testing different checkpoints or samplers: wire two models into input_1/input_2, flip the dropdown, rerun.
    • Conditional pipelines: route different prompts or different reference images based on one selection point instead of a pile of typed switches.
    • Prototyping: when you're not sure which branch of a graph you want, a single switch is faster than muting groups.

    The honest caveat: a switch is a manual or externally-driven thing. If you want automatic branching based on a value, this isn't that - pair it with a selector that feeds its selected_input from logic elsewhere, or just flip it by hand. And because it's *-typed, ComfyUI won't warn you at connect time if the thing you're routing into doesn't match what the downstream node expects - the error appears at queue time instead. That's the trade for flexibility.

    Installing

    cd ComfyUI/custom_nodes
    git clone https://github.com/Art-xmaster/comfyui-AGSoft
    

    Restart ComfyUI, or ComfyUI Manager → "comfyui-AGSoft". No models, no extra deps. When you're choosing between this and the pack's fixed text switches (X2/X4/X8), use those for text-only routing - the selector is a plain 1-based integer there and they're simpler to read. Reach for Switch Any the moment your data stops being just text.

    CategoryAGSoft/Utility

    Inputs (2)

    NameTypeDefaultDescription
    selected_inputCOMBOinput_1Select which input to pass to the output from the dropdown list. The list shows all available inputs based on number_of_inputs setting. Example: select "input_2" → output receives data from input_2 --- Выберите из выпадающего списка, какой вход передать на выход. Список показывает все доступные входы на основе настройки number_of_inputs. Пример: выберите "input_2" → выход получает данные из input_2
    number_of_inputsINT22–30Number of dynamic inputs to create (minimum 2, maximum 30). Each input will be named input_1, input_2, input_3, etc. The combo box above will automatically update to show only available inputs. Example: number_of_inputs=5 → creates input_1, input_2, input_3, input_4, input_5 --- Количество динамических входов для создания (минимум 2, максимум 30). Каждый вход будет называться input_1, input_2, input_3 и т.д. Комбо бокс выше автоматически обновится, показав только доступные входы. Пример: number_of_inputs=5 → создаются input_1, input_2, input_3, input_4, input_5

    Outputs (1)

    NameTypeDescription
    output*