LatentFromBatch_motorway_edition
Grab one latent out of a batch without the wire spaghetti
- MOTORWAY 🚌💨
- MOTORWAY 🚌💨
This is ComfyUI's stock LatentFromBatch node, re-wrapped for the Motorway pipe instead of direct wiring. You feed it a latent batch, it slices out a chunk, and it tucks the result back inside the pipe. If you've ever needed frame #3 of a 6-frame latent batch as its own thing, this is the node.
Think of it as a "get me this slice" operation: batch_index is where to start and length is how many to take. Slice from index 0 with length 1 and you've isolated the first sample - the move you want before sending a single frame off to img2img or a face pass. It also copies along any noise mask and the per-sample batch indices, so you're not breaking whatever upstream nodes were tracking.
The Motorway wrapper bit
Every _motorway_edition node works the same way: it reads its tensor inputs out of the pipe by key, runs the original ComfyUI node's logic unchanged, and writes the outputs back under new keys. That's why there are no tensor input ports here - just the pipe and a set of string fields:
MOTORWAY 🚌💨- the pipe. Required.INPUT_samples_key(defaultsamples) - which key in the pipe holds the latent batch.batch_index(0–63, default 0) - first sample to keep.length(1–64, default 1) - how many samples to take.OUTPUT_LATENT_key(defaultLATENT) - the key the sliced latent lands under.
Defaults are sane: if you've been feeding latents through a Motorway ramp under the key samples, this node works with zero configuration and drops the result at LATENT. One thing worth knowing: the underlying core node clamps to the batch size, so asking for index 5 of a 4-frame batch doesn't crash - it just returns what's there. The only output port is the pipe itself, so to actually use the sliced latent in a normal node you pull it back out with a Motorway AxB ramp (set its ANY_(A)_key to LATENT).
Installing
The whole pack comes in one piece, so installing this node means installing the Motorway pack:
cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway
# restart ComfyUI
Or use ComfyUI Manager: search for ComfyUI_agilly1989_motorway and hit Install. No model downloads, no extra pip dependencies - the code only imports core ComfyUI modules, which is refreshingly rare for a custom node pack.
Gotchas
- You must start with a
MotorwayStartnode (or aMotorwaySeed/MotorwayInt/etc.) or there's no pipe to feed in. - Keys are exact strings. If you hit
Key: 'samples' doesn't exist in motorway(or a'MotorwayClass' object has no attribute 'hash_...'error), the upstream node stored the latent under a different key than this node is asking for. Check both key fields. - The pack is a one-dev beta. The author's own README opens with "CURRENTLY IN ACTIVE DEVELOPMENT (BETA)! IF THINGS BREAK ITS BECAUSE I BROKE IT," and the generated clone nodes have been toggled on and off during refactors. If the node isn't in your menu after install, that's the beta talking - it may be back in the next commit.
Where this node shines is batching workflows: generate a grid, slice out the one you want to work on, and keep the rest of the pipe flowing. Cheap, predictable, and it never touches pixels.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — | |
| INPUT_samples_key | STRING | samples | — |
| batch_index | INT | 00–63 | — |
| length | INT | 11–64 | — |
| OUTPUT_LATENT_key | STRING | LATENT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — |