edit_workflow
Apply batched edits to ComfyUI workflows: add or remove nodes, connect inputs, update widget values, titles, modes, and groups in a single operation.
Instructions
Apply batched edits. Each op is a dict with 'op' plus:
{"op": "add_node", "class_type": str, "title"?: str, "widgets"?: {name: value}}
{"op": "remove_node", "node_id": int}
{"op": "connect", "from_node": int, "from_output": str|int, "to_node": int, "to_input": str}
{"op": "set_widget", "node_id": int, "input": str, "value": any}
{"op": "set_title", "node_id": int, "title": str}
{"op": "set_mode", "node_id": int, "mode": int} # 0 normal, 2 mute, 4 bypass
All six have a definition-scoped twin taking an extra "definition_id", for editing inside a subgraph definition: add_node_to_definition, remove_node_from_definition, and connect/set_widget/set_title/ set_mode_in_definition. A malformed op reports its own required keys.
Layout/group ops (no definition twin): set_pos {node_id, pos:[x,y], size?:[w,h]}; add_group {title, node_ids:[int,...], color?}; set_group {group_id, title?, node_ids?, color?}; remove_group {group_id}. Groups are addressed by member node_ids - bounding comes from their own extents. organize_workflow re-lays out and re-groups everything, so run these AFTER it, not before.
Slot/widget names come from get_node_info. Virtual classes: Note/MarkdownNote take one widget 'text'; Reroute/PrimitiveNode take none at add - connect a PrimitiveNode to a widget input to mirror its type, then set_widget 'value' (+ 'control_after_generate' for number/combo, to advance each run).
Ops apply in order; a failing op stops the batch (graph unchanged past that point). Widget values and link types are checked live - "force": true on set_widget/add_node/connect overrides; on connect it also lets a frontend-only input (no /object_info entry - rgthree switches, dynamic collectors) be wired by creating the socket.
Result is a compact delta (applied ops + changed nodes); pass summary=true or call inspect_workflow for the full graph.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| summary | No | ||
| operations | Yes | ||
| workflow_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||