Nodes/ComfyUI Griptape Nodes/Griptape Util: Switch Node
ComfyUI Node

Griptape Util: Switch Node

The little router that keeps your workflow tidy

By griptape-ai·Created 2 years ago·Updated about a year ago· 238
Griptape Util: Switch Node
  • input_1
  • OUTPUT
switch1

The Switch Node is the pack's most unassuming utility, and it's the one I'd miss most if it disappeared. It does exactly one thing: takes any number of inputs and lets you choose which one becomes the output. Connect strings, drivers, agents, whatever - it's type-agnostic, so it doesn't care what flows through it - set the switch number, and that input passes straight through to OUTPUT.

If that sounds almost too simple to be useful, think about what it replaces. Without a switch, changing which prompt, which model driver, or which tool config your workflow uses means rewiring the graph by hand - dragging connections, deleting nodes, losing your place. With a switch, you connect all the candidates once, then flip a number. Want to A/B test two different agent configurations? Want to switch between an OpenAI driver and an Ollama driver without rebuilding anything? This node makes those one-parameter changes instead of graph surgery. It's the same philosophy as the routing utilities in quality-of-life packs like rgthree - small nodes that make big workflows maintainable.

How it works

The mechanism is deliberately trivial: the node collects everything connected to its inputs, reads the switch integer, and returns inputs[switch - 1] - so switch: 1 selects the first connected input, switch: 2 the second, and so on. There's no type checking, no coercion, nothing clever. That's a feature: it means any datatype you can put on a wire can be routed through it.

The inputs that matter

  • input_1 - the first input to choose from. The tooltip explains the trick: connect an input and the node dynamically creates more inputs for you. You start with one and grow the list as you add candidates. There's no fixed limit beyond what the UI lets you create.
  • switch - an integer, default 1. The input to pass through. Indexing starts at 1, so this is the only place people usually stumble - switch: 1 is the first input, not zero.

The single output, OUTPUT (type * - it passes whatever type came in), wires into whatever consumes the selected value.

Install

It ships with the pack, so:

cd ComfyUI/custom_nodes
git clone https://github.com/griptape-ai/ComfyUI-Griptape

or ComfyUI Manager → search "Griptape" → install → restart. Then right-click → Griptape/Agent Utils.

Where people get burned

Honestly, not much to burn you here - it's a trivially simple node. The two things worth remembering: the 1-based indexing (switch: 1 is the first input, not the zeroth), so keep your switch value aligned with what's actually connected, or you'll route the wrong candidate. And because it's type-agnostic, it's easy to route the wrong kind of thing through it if you're careless - a driver where a string is expected won't error at this node, it'll error downstream. For a beginner it's a great way to learn how the pack's type system works, though: connect things, flip the switch, watch what flows.

CategoryGriptape/Agent Utils

Inputs (2)

NameTypeDefaultDescription
input_1opt*An input to choose. Connect an input to dynamically create more inputs.
switchoptINT1The input to choose.

Outputs (1)

NameTypeDescription
OUTPUT*