Sub topic 9
Versioning and Documenting Workflows for a Team
This chapter assumes you can write a parameterized prompt template and that you have a set of fixed test inputs for your workflow. If a teammate edits a shared template, the output changes for everyone. Versioning and documentation let you see what changed, undo it, and hand the workflow to someone new.
Why workflows need versions
A workflow is a set of files: templates, brand context, validation rules, and a list of steps. A small edit to any of them can change the results. Without versions, a team runs into these problems:
- Nobody can say which template produced last month's newsletter.
- A "quick improvement" breaks a downstream step, and no one can find the earlier text.
- Two people keep slightly different copies of the same prompt.
The fix is the same one software teams use. Keep the workflow files in one shared place with history, such as a Git repository. Give each released state a version number.
What to version together
Treat these items as one unit, because a change to any of them can change the output:
- Prompt templates and step order.
- Brand voice and constraint text.
- Output schema and validation rules.
- The model name and settings you tested against.
- The fixed test inputs and the checklist.
Changing the model is a workflow change. Record it the way you would record a template edit, and rerun your tests.
Choosing version numbers
A three-part number (MAJOR.MINOR.PATCH) works well. Base it on what downstream steps and people would notice.
| Change | Example | Bump |
|---|---|---|
| Output fields renamed or removed | `preview_text` becomes `preheader` | MAJOR |
| New input, new step, or new wording that shifts tone | Add a `promo_code` input | MINOR |
| Typo or formatting fix with no behavior change | Fix a misspelled brand name | PATCH |
A MAJOR bump warns every tool and teammate that consumes the output that they may need to update.
Stamping every run
Documentation helps only if you can tie an output back to the exact workflow that made it. Store the version with each run:
import json
from datetime import date
WORKFLOW = {
"name": "weekly-newsletter",
"version": "1.2.0",
"owner": "content-team",
"model": "your-model-name",
"template": "Summarize this campaign brief in 3 bullets:\n{brief}",
}
def run_record(workflow, inputs, output):
return {
"workflow": workflow["name"],
"version": workflow["version"],
"model": workflow["model"],
"run_date": date.today().isoformat(),
"inputs": inputs,
"output": output,
}
record = run_record(WORKFLOW, {"brief": "Spring service discount"}, "- Point one")
print(json.dumps(record, indent=2))If a subscriber complains about an email, you can open the run record and see which version wrote it. You can then rerun that version's test inputs.
A safe change process
The test step reuses the fixed inputs and checklist from the previous chapter. The review step gives a second person the chance to catch a change that passes the checklist but still sounds wrong.
What to document
Keep a short README next to the workflow files. A new teammate should be able to run the workflow from it alone. Include:
- Purpose: the task, who uses the output, and how often it runs.
- Inputs: each name, its format, and an example value.
- Steps: one line per step, with where human review happens.
- Outputs: the schema and the validation rules.
- Owner: the person who approves changes.
- Known limits: cases where the workflow performs badly.
- Changelog: a dated list of versions, each with a reason for the change.
Write changelog entries as reasons, not diffs. "1.2.0: Added promo_code input because the spring campaign needed discount codes" is more useful than "edited template."
Common errors
- Editing the live copy. Always change a branch, then release.
- Skipping the changelog. The history shows what changed but not why.
- Versioning only the prompt. Schema and model changes break workflows too.
- No owner. Without a named approver, everyone edits and nobody is responsible.
Exercise
Your team renames the output field preview_text to preheader in a workflow at version 1.4.2. A scheduling tool reads that field. What should the new version be, and why?
Show answer
2.0.0. Renaming an output field breaks tools that read it, so it is a MAJOR change. The bump warns the owners of the scheduling tool to update before they adopt the new version, and the changelog should say why the field was renamed.