Patch workflow
patch_workflowEdit an EXISTING workflow's latest version in place without resending the whole definition. Apply ordered operations (set / remove / replace_in / test) addressed by step name + a dot-path (e.g. step 'generate' path 'llm.system'), passing new code or values as raw JSON — the platform owns the escaping, so you never hand-escape the definition. For a SMALL change to a LARGE value (swap a color, fix a word), use replace_in (find→replace, unique match) so you send a few bytes, not the whole value. For a large NEW value (an embedded HTML page, a long JS block) send it with value_encoding=base64 (or gzip+base64) and a value_sha256 — base64 avoids the escapes/multibyte chars that corrupt in transit, and the sha rejects the op if it was altered anyway, so the write can't silently ship broken. The patched result is statically validated BEFORE it is written: if validation fails, no version is created and the findings are returned (valid=false). On success a NEW version is minted from the latest (an unpublished draft unless publish=true) — so there's no separate preview step: just patch it, then run_workflow / preview the created draft to see it rendered. Use this to change one block; use create_workflow_version for a wholesale rewrite.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | No | the workflow slug (provide this or workflow_id) | |
| publish | No | publish the resulting version immediately (ignored if validation fails) | |
| operations | Yes | ordered edits applied to the LATEST version's definition | |
| workflow_id | No | the workflow id (provide this or slug) | |
| expected_content_sha256 | No | the content_sha256 from the get_workflow_version you built these operations from. The patch is rejected if the latest version has changed since — nothing is applied and no version is minted. REQUIRED when any path addresses an array element by numeric index (variables[0]), because that is a claim about the definition's current shape whose failure is otherwise SILENT: if an element shifted, the patch edits the wrong one. Optional for self-locating paths — variables[name=css], variables[-] (append), a step addressed by name, or a plain field path — which mean the same thing whatever the definition holds |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| valid | Yes | ||
| created | Yes | ||
| version | No | ||
| findings | No | ||
| published | Yes | ||
| workflow_id | No |