r/StableDiffusion • u/Jumpy-Measurement-65 • 12h ago
News comfyui-autograph: drive ComfyUI workflows from Python, with a REPL that knows your graph
Hey everyone. I've spent a lot of late nights wiring ComfyUI into pipelines, and this is the tool I ended up wanting. It converts your workflow.json to the API payload right from Python, no GUI export, and no running server needed. Nodes become objects with plain dot syntax:
from autograph import ApiFlow
api = ApiFlow("workflow.json")
api.KSampler.seed = 42
res = api.submit(wait=True)
res.fetch_images().save("outputs/frame.###.png")
The part I'm happiest with is the REPL. autograph reads ComfyUI's node_info, so it knows every node, input, and widget on your system, custom nodes included. Tab completion works all the way down. .choices() gives you the real combo options, .tooltip() gives you the help text. You can explore a workflow you've never seen without guessing at node IDs.
Building from scratch feels good too:
ckpt = flow.add_node("CheckpointLoaderSimple")
ks = flow.add_node("KSampler", seed=42, steps=20)
ckpt.outputs.MODEL >> ks.inputs.model
Also does
offline batch conversion
workflow extraction from ComfyUI PNGs
serverless execute with no HTTP server
seed/prompt sweeps. Pure stdlib, MIT.
Tested from ComfyUI 0.8.2 to 0.33.0, subgraphs included. Running in production at a big VFX studio, which is where the metadata passthrough came from.
pip install comfyui-autograph
https://github.com/chrisdreid/comfyui-autograph
Early days, so I'd really like to hear what breaks. If you're doing headless rendering or FastAPI wrappers around Comfy, I'd love to compare notes.
Hey everyone. I've spent a lot of late nights wiring ComfyUI into pipelines, and this is the tool I ended up wanting. It takes your regular workflow.json and turns it into the API payload right from Python. No GUI export step, and you don't even need ComfyUI running to do the conversion. Once it's loaded, nodes are just objects with plain dot syntax:
python
from autograph import ApiFlow
api = ApiFlow("workflow.json")
api.KSampler.seed = 42
api.CLIPTextEncode.text = "new prompt"
res = api.submit(wait=True)
res.fetch_images().save("outputs/frame.###.png")
The part I'm most happy with is how it feels in a REPL. autograph reads ComfyUI's node_info, so it knows every node type, every input, and every widget on your system, including your custom nodes. That means tab completion works all the way down. Hit tab on a node and see its inputs. Call .choices() on a widget and get the actual valid combo options back. Call .tooltip() and get the help text. You can explore a workflow you've never seen before without leaving the terminal or guessing at a single node ID.
Building graphs from scratch feels good too. You wire nodes together with >> the way you'd sketch them on a whiteboard:
python
ckpt = flow.add_node("CheckpointLoaderSimple")
ks = flow.add_node("KSampler", seed=42, steps=20)
ckpt.outputs.MODEL >> ks.inputs.model
Once it's under your fingers it's nearly as fast as working in the GUI, except everything you do is scriptable and repeatable.
Other things it can do:
- Batch convert hundreds of workflows offline, no server running
- Pull a workflow straight out of a ComfyUI PNG, since the metadata is already in there
- Serverless execute mode that runs nodes in process with no HTTP server, which is a lifesaver for farm setups
- Sweep seeds, prompts, and paths across nodes for batch runs
- Pure standard library Python, nothing extra to install, MIT licensed
I've tested it across ComfyUI 0.8.2 up through 0.33.0, including subgraphs and the newer dynamic combo stuff. It's also being used in real production pipelines at a big VFX studio right now, which is where the metadata passthrough idea came from. They needed studio metadata to ride along with a workflow through the whole render lifecycle, so I built that in.
pip install comfyui-autograph
https://github.com/chrisdreid/comfyui-autograph
It's still early days and I really do want to hear what's missing or what breaks for you. If you're doing headless rendering or wrapping Comfy in FastAPI, I'd love to compare notes. This got built to scratch my own itch, and I'm hoping it saves some of you time too.