Workflow Graph Tool
workflow_graphEdit workflow DAGs by adding, updating, or deleting nodes and edges. Each change re-validates the graph to prevent cycles and orphan nodes.
Instructions
Surgical edits to a workflow's DAG (nodes + edges). For metadata changes (name, description, status, validation, AI generation) use workflow_manage. Every edit re-validates the graph; an edit that would create a cycle, an unreachable node, or an invalid edge type is rejected before commit.
Actions:
save_graph (write — full replace) — workflow_id, nodes[], edges[]. Atomically replaces the entire graph; existing in-flight runs continue on the old graph.
node_add (write) — workflow_id, type (start|end|agent|conditional|human_task|switch|dynamic_fork|do_while), config (type-specific).
node_update (write) — workflow_id, node_id, config (partial).
node_delete (DESTRUCTIVE) — workflow_id, node_id. Cascade-deletes incident edges; rejected if it would orphan nodes.
edge_add (write) — workflow_id, source_id, target_id; optional condition / case_value for switch nodes.
edge_delete (DESTRUCTIVE) — workflow_id, edge_id. Rejected if it would disconnect the graph.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Action to perform: save_graph, node_update, node_add, node_delete, edge_add, edge_delete | |
| deadline_ms | No | Optional: max wall-clock time (ms) the tool may spend. If exceeded during the call, returns a DEADLINE_EXCEEDED error. Minimum 100 ms. Leave unset for no deadline. | |
| workflow_id | Yes | The workflow UUID | |
| nodes | Yes | Array of node objects. Each must have: type (start|end|agent|conditional|human_task|switch|dynamic_fork|do_while), label (string), and optionally agent_id, skill_id, config. | |
| edges | No | Array of edge objects. Each must have: source_node_index (int), target_node_index (int), and optionally condition, label, is_default. | |
| node_id | Yes | The workflow node UUID | |
| label | No | New label for this node | |
| agent_id | No | UUID of the agent to assign to this node. Pass empty string to detach. | |
| skill_id | No | UUID of the skill to assign to this node. Pass empty string to detach. | |
| crew_id | No | UUID of the crew to assign to this node. Pass empty string to detach. | |
| config | No | Node configuration object (e.g. timeout, retries, prompt_override) | |
| expression | No | Condition expression for conditional/switch nodes (e.g. "output.score > 0.8") | |
| position_x | No | Horizontal position on the canvas | |
| position_y | No | Vertical position on the canvas | |
| type | Yes | Node type (see tool description for full list and config details) | |
| source_node_id | Yes | UUID of the source node (where the edge originates) | |
| target_node_id | Yes | UUID of the target node (where the edge points to) | |
| condition | No | Condition object for conditional edges (e.g. {"field": "score", "op": "gt", "value": 0.8}) | |
| case_value | No | Case value for switch node routing — this edge is taken when the expression equals this value | |
| is_default | No | Mark this as the default edge when no other condition matches. Default: false | |
| source_channel | No | Output port of the source node, e.g. "on_success", "on_error", "on_timeout" | |
| target_channel | No | Input slot of the target node (for multi-input nodes) | |
| edge_id | Yes | The workflow edge UUID to delete |