Lesson 22 / 26

Publishing and Versioning Workflows

Every published change is a release.

Versions, diffs and rollback

Publishing creates a version of the workflow that apps call. Treat each version as a release: describe what changed, run the evaluation set before publishing, and keep the previous version available for rollback. Review changes as a diff of nodes, edges, prompts and settings, not only by clicking around the canvas. If you export to code, keep the workflow under version control so changes go through code review. Product details such as node names and menus change; check the current OpenAI documentation.

Diffing two workflow versions, run

I ran this with plain Python 3. It is a small model of the workflow idea, not Agent Builder itself, and no model is called. Comparing a flattened listing of nodes and edges shows exactly what changed: a guardrail node was inserted between classify and answer, and the answer agent's max turns dropped from 6 to 4.

import json, difflib
v1 = {"nodes": [{"id": "classify", "model": "small"}, {"id": "answer", "model": "large", "max_turns": 6}],
      "edges": [["classify", "answer"]]}
v2 = {"nodes": [{"id": "classify", "model": "small"}, {"id": "guard", "type": "guardrail"},
                {"id": "answer", "model": "large", "max_turns": 4}],
      "edges": [["classify", "guard"], ["guard", "answer"]]}
def flat(w):
    nodes = [f"node {n['id']}: " + ", ".join(f"{k}={v}" for k, v in sorted(n.items()) if k != "id") for n in w["nodes"]]
    return sorted(nodes) + [f"edge {a} -> {b}" for a, b in w["edges"]]
for line in difflib.unified_diff(flat(v1), flat(v2), "workflow v1", "workflow v2", lineterm="", n=0):
    if not line.startswith("@@"):
        print(line)

Output:

--- workflow v1
+++ workflow v2
-node answer: max_turns=6, model=large
+node answer: max_turns=4, model=large
-edge classify -> answer
+node guard: type=guardrail
+edge classify -> guard
+edge guard -> answer

Pin versions in production

Have production call a specific published version, and move to a new one deliberately after evaluation.

Quick check: Why keep the previous workflow version available?

  • It is required for previews
  • Old versions run faster
  • Publishing deletes data
  • To roll back quickly if the new version misbehaves
Answer

To roll back quickly if the new version misbehaves — Rollback is the safety net for releases.