ComfyUI Node

Set Runtime String

Stash a string in memory and pull it out anywhere in the graph

By kinorax·Created 4 months ago·Updated 25 days ago· 2
Set Runtime String
    • string
    key
    string

    IPT-SetRuntimeString lets you store a string by a key in ComfyUI's process memory, and - paired with its sibling IPT-GetRuntimeString - read it back anywhere else in the graph, no wire required. It's a tiny key/value store that lives for as long as ComfyUI stays running.

    Why would you want that? Because sometimes the value you need downstream is produced in a completely different corner of the workflow, and dragging a wire across the whole canvas to deliver it is exactly the kind of spaghetti the community keeps fighting. The image-info pack this ships in (kinorax/ComfyUI-Info-Prompt-Toolkit) is full of nodes that compute filenames, tags, and paths mid-run. The runtime string pair is their escape hatch: compute the value once, stash it here, and let a Get node pick it up where it's needed without thirty reroutes in between.

    How it works

    You give it a key (any non-empty string) and a string value, and it writes string into a module-level dictionary guarded by a lock. Storing again under the same key overwrites the old value. Nothing is written to disk - a ComfyUI restart wipes the whole store. The node is marked as an output node (so it always executes at the end of a run) and as non-idempotent, which is the engine's way of saying "run me every single time, don't cache me." Both flags matter: the store must actually be written each run, and the Get side must re-read each run.

    The one output, string, is just the value that went in. That pass-through isn't decoration - it's an execution-order hook. The companion GetRuntimeString node has an after input specifically to be wired from this output, so the Get can't run before the Set has stored the value.

    The inputs that matter

    • key - the storage key. Required, non-empty. Exact-match, case-sensitive.
    • string - the value to store. Required; overwrites anything under the same key.

    One output: string, returned so downstream execution can depend on it.

    Installing it

    It's part of the IPT pack - install the pack once:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kinorax/comfyui-info-prompt-toolkit.git
    cd comfyui-info-prompt-toolkit
    pip install -r requirements.txt
    

    Restart ComfyUI, or install via ComfyUI Manager ("ComfyUI-Info-Prompt-Toolkit"). No model files involved.

    Where people get burned

    Three traps. First, the store dies on restart - if you restart ComfyUI and the Get side runs before a Set has repopulated its key, you get a "runtime string not found for key" error. In practice that means: don't rely on this to persist anything across sessions; for durable values, use the pack's image-info metadata (saved to the image) instead. Second, keys are exact - a trailing space or a case difference and the Get silently won't find it. Third, there's a timing footgun if you skip the wiring: a Get that isn't ordered after its Set can read the key before it exists. That's exactly what the after input is for - use it.

    CategoryInfo-Prompt-Toolkit/Utility

    Inputs (2)

    NameTypeDefaultDescription
    keySTRINGNon-empty process-wide storage key
    stringSTRINGString to store; a value stored under the same key is overwritten

    Outputs (1)

    NameTypeDescription
    string*Stored string, returned for downstream execution ordering