Workflow

update()

workflow.update(patch) → Promise<Workflow>

Changes the workflow. What you send is validated as a whole definition — there is no patching of a single step.

PUTrevalidatedobject updates itself
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

await workflow.update({ name: "Weekly digest (Monday)" });

await workflow.update({
  steps: workflow.data.steps.map((s) =>
    s.id === "write" ? { ...s, config: { ...s.config, model: "gemini-3.1-pro" } } : s),
});
workflow.update(name="Weekly digest (Monday)")

workflow.update(steps=[
    {**s, "config": {**s["config"], "model": "gemini-3.1-pro"}} if s["id"] == "write" else s
    for s in workflow.data["steps"]
])

Send the whole thing you are changing

steps replaces steps

Sending one step leaves the workflow with one step. Read data.steps, map it, send it back — which is also what keeps the edges valid, since they name step ids.

Everything is checked again

Templates, the graph, the required approvals, the tool names. A change that breaks a reference elsewhere is refused with invalid_workflow, and nothing is saved.

Agent tools are serialised here too

An agent.run step whose tools is an object is converted before it is sent, exactly as on create.

Runs in flight keep the old definition

A run executes the definition it started with. Changing a workflow does not change what an in-flight run is doing — which is what makes an update safe on a busy workflow.

It returns the workflow

And replaces data on the object, so the instance you hold is current.