apply_changes
Apply multiple graph spec edits in a single atomic call, adding or removing nodes, edges, and state schemas at once.
Instructions
Apply several spec edits in one call instead of one add_node/add_edge/... call each.
Prefer this over separate calls whenever wiring more than one node/edge at once (e.g. adding a whole tool-calling loop) — it's the same edit, one round trip instead of several.
operations is a list, applied in order against one loaded spec and
saved once at the end. Nothing is written if any operation is invalid
(bad op name, missing required field, dangling reference) — the whole
batch is atomic. Each entry is a dict with an "op" key plus that
operation's normal arguments:
{"op": "add_node", "id": "tools", "config": {"function": "call_tools"}} {"op": "add_edge", "from_": "chatbot", "condition": "route", "paths": {"continue": "tools", "end": "END"}} {"op": "add_edge", "from_": "tools", "to": "chatbot"} {"op": "remove_node", "id": "..."} {"op": "remove_edge", "from_": "...", "to": "..."} {"op": "set_state_schema", "fields": [...]}
entry_point is set automatically (the first node added, or pass entry_point=true on a later add_node op) — don't add an edge from "START" yourself, even though rendered graph.py contains one; that edge is derived from entry_point, not wired as a spec edge.
Returns a compact summary (counts), like the other mutating tools — call get_spec if you need the full picture afterward.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operations | Yes | ||
| project_dir | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||