# Agent Shipping
<!--
ref: @protocol/agent-shipping
type: protocol
tags: [versioning, rollout, evaluation, rollback, agent prompts]
triggers: [update prompt, deploy new version, rollback prompt, evaluate prompt]
trigger_prompt: When a team is preparing to update or deploy a new prompt version and wants to ensure quality and quick recovery from potential issues.
category: ship
last_reviewed: 2026-04-30
complements: [@protocol/eval, @protocol/dev-checklist, @protocol/devloop, @protocol/loop]
audience: [agent-author, claude-code-user, openclaw-user, terminal-only]
version: 6
updated_at: 2026-07-14T23:23:50.864Z
-->

Establish a disciplined approach for shipping agent prompts with version control and staged rollouts.

This protocol gives you the discipline: version your prompts, gate on eval, roll out in stages, roll back fast.

---

## Why Agents Need Their Own Shipping Discipline

Code changes fail loudly. A type error throws an exception. A missing field crashes a handler. The CI run turns red. You know immediately that something is broken.

Prompt changes fail quietly. A subtly changed instruction produces plausible-looking but wrong outputs. Users don't always report it. Metrics may not catch it for days. By the time you notice, you've shipped the change to 100% of traffic and the "rollback" is another full deploy cycle.

Three properties make this worse:

1. **Prompts are usually not in git.** They live in a database field, an environment variable, or someone's head. You can't diff them, you can't bisect them, you can't pin a version.
2. **Prompt changes interact with model versions.** A prompt that worked on `gpt-4-turbo` may behave differently on `gpt-4o`. A prompt fine-tuned for Claude 3 Sonnet may degrade on Claude 3.5 Sonnet. Without versioning, you can't isolate which variable changed.
3. **Rollback is slow if it requires re-deploy.** A re-deploy takes minutes to hours. A config flag flip takes seconds. Designing for fast rollback means designing for config-flag control of which prompt version is active.

The fix is the same one engineering figured out for code: version it, gate on tests, stage the rollout, make rollback instantaneous.

---

## Versioning

**Prompt files belong in git.** One file per agent (or per logical prompt unit), named and versioned like code.

```
prompts/
  summarizer/
    v1.md          # original
    v2.md          # current production
    v3.md          # candidate (under eval)
  classifier/
    v1.md
    v2.md
```

**Semantic-ish versioning.** You don't need strict semver. You need a convention that tells you how significant a change is:

| Change type | Version bump |
|-------------|-------------|
| Typo fix, whitespace, punctuation | Patch (v2.0 → v2.1) |
| Reworded instruction that changes behavior | Minor (v2 → v3) |
| New tool added, persona changed, format changed | Major (v2 → v3.0) — treat like a breaking API change |
| System prompt replaced or restructured | Major |

A "minor" change that looks small can shift model behavior significantly. When in doubt, treat it as major and run the full eval suite.

**One config flag per material change.** The flag says which prompt version is live. A config change (not a code deploy) is enough to switch versions. This is what makes rollback fast.

```yaml
# agent config
summarizer_prompt_version: v2
classifier_prompt_version: v1
```

When v3 is ready to roll out, you change the flag, not the code. When you need to roll back, you change the flag back.

---

## The Eval Gate

No prompt version moves forward without passing eval. This is the gate. It applies at every stage of the rollout.

**Before any rollout begins:**

```bash
make eval PROMPT_VERSION=v3   # run golden dataset against the candidate
# must exit 0 before proceeding
```

See `@protocol/eval` for the full harness. The short version: run your golden dataset (real failures turned into test cases) against the candidate prompt version, assert all cases pass, fail the gate if any case regresses.

**Gate position in the pipeline:**

```
prompt change in git
  → eval gate (must pass)
  → 1% rollout
  → eval gate on 1% traffic sample (must pass)
  → 10% rollout
  → eval gate on 10% traffic sample (must pass)
  → 100% rollout
```

The eval gate on live traffic is different from the golden dataset gate: you're sampling real requests, running them through both the old and new version, and comparing outcomes. This requires logging infrastructure — see `@protocol/observability`.

---

## Staged Rollout

Don't go from 0% to 100%. Traffic-split the rollout and measure at each stage.

**Stage 1: 1% of traffic**

Route 1% of real production requests to the new prompt version. Everything else stays on the current version.

**What to measure at 1%:**

| Metric | Signal |
|--------|--------|
| Task completion rate | Is the new version completing tasks at the same rate as the old? |
| Tool call error rate | Are tool calls succeeding at the same rate? |
| Latency (p50, p99) | Did the prompt change affect response time? |
| User-reported errors | Any spike in error reports or negative feedback? |
| Model cost per task | Did the prompt change token usage significantly? |

Hold at 1% for at least 24 hours, long enough to capture diurnal traffic patterns. If all metrics look healthy, run the eval gate on a sample of the 1% traffic, then proceed.

**Stage 2: 10% of traffic**

Same metrics, same hold period (24-48 hours). At 10% you have enough volume to see statistically significant signals in most error rates.

**Stage 3: 100%**

Full rollout. The old version is still available via config flag for 48 hours in case you need an emergency rollback.

**Decommission the old version** after 48 hours at 100% with no incidents. Archive the prompt file; don't delete it.

---

## Rollback

**Fast rollback: config flag flip.** Change the prompt version flag in your config. The change takes effect on the next request. No deploy, no downtime.

```bash
# rollback in 30 seconds
set_config summarizer_prompt_version=v2
# verify
run_smoke_test
```

**What makes rollback fast:**
- Prompt version is controlled by a config flag, not hardcoded
- Config change does not require a service restart
- The old prompt version file is still in git (you didn't delete it)
- You have a smoke test that confirms basic functionality in under 60 seconds

**What makes rollback slow:**
- Prompt is embedded in the code; rolling back requires a git revert and re-deploy
- Config requires a restart to take effect
- You deleted the old prompt file
- You have no smoke test and have to manually verify

Design for fast rollback before you ship v2. If you can't flip a config flag and confirm basic functionality in under 2 minutes, your rollback story is too slow.

**When to roll back:**

| Signal | Action |
|--------|--------|
| Eval gate fails at any stage | Roll back immediately, do not proceed |
| Task completion rate drops > 5% | Roll back, investigate |
| Tool error rate spikes | Roll back, investigate |
| p99 latency increases > 30% | Roll back, investigate |
| User error reports spike | Roll back, investigate |
| Any metric looks wrong and you don't know why | Roll back, then investigate from a stable baseline |

Roll back first, investigate second. Don't investigate a live incident on 100% traffic.

---

## Anti-Patterns

**Silent prompt edits**
Someone edits the prompt in the database UI, no git commit, no version bump, no eval. This is the most common failure mode. Fix: prompts are read from files in git, not directly from a database field. The database field stores the version name; the file stores the content.

**YOLO production prompts**
"It looks good, let's ship it to everyone." No staged rollout, no eval gate, 0% → 100% in one move. Fine for internal tools with 3 users. Not fine for anything real. Fix: staged rollout, even if your stages are just "1 user, then everyone."

**Versioning the agent code but not the prompt**
You tag your agent releases with git tags and have a rollback plan for the code. The prompt lives in an environment variable that doesn't appear in any release artifact. Fix: prompt content in git, prompt version in your release artifact, same rollback discipline as the code.

**Eval only on the happy path**
Your golden dataset is 20 clean, well-formed examples. Every new prompt passes. Meanwhile, edge cases — empty inputs, adversarial inputs, inputs with typos — are never tested. Fix: at minimum, add one malformed input, one empty input, and one off-topic input to your golden dataset.

**No eval before expanding rollout**
You rolled out to 1%, everything looks fine, so you go straight to 100% without re-running eval on the live traffic sample. Fix: run the eval gate before each stage expansion, not just before the first stage.

**Treating prompt changes as lower-stakes than code changes**
They're not. A bad prompt at 100% traffic causes the same blast radius as bad code at 100% traffic. Apply the same rigor.

---

## Minimal CI Configuration

For teams using GitHub Actions or equivalent:

```yaml
# .github/workflows/agent-eval.yml
name: Agent Eval Gate

on:
  pull_request:
    paths:
      - 'prompts/**'

jobs:
  eval:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run eval harness
        run: make eval
        env:
          AGENT_API_KEY: ${{ secrets.AGENT_API_KEY }}
```

This fires on any PR that touches a file under `prompts/`. It runs the golden dataset, fails the PR if any case regresses. The PR cannot merge until eval passes. That's the entire CI gate for prompt changes.

---

*Related: `@content/web/xinyadu/2026-11-29-claude-code-task-framing-study` · `@protocol/eval` · `@content/youtube/sequoia/how-companies-are-building-their-own-intelligence-sonya-huang-sequoia-capital` · `@content/youtube/langchain/managed-deep-agents-conceptual-video` · `@content/youtube/cole-medin/google-s-agents-cli-the-cli-skills-combination-to-ship-ai-agents-easily`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*