Skip to main content

Safely Roll Out an AI Agent

Prompt and model changes are production changes. The same discipline you apply to a code deploy — test offline, inspect against a stop list, roll a slice of traffic, watch the quality numbers, keep a one-call rollback — applies to an agent’s system_prompt, model, or knowledge-base update. Orbit already ships each stage; this guide wires them into one pipeline. The endpoint paths below are relative. Send them against https://api.orbit.devotel.io/api/v1.

What the pipeline covers

  • Choosing a model/runtime profile (chat vs voice vs retrieval).
  • Grounding the agent in your knowledge sources, before launch.
  • Defining the guardrail policy that shapes what can be said.
  • Offline comparison of the candidate against the prompt in production.
  • Graduated rollout that shifts one small traffic slice at a time.
  • Automatic regression runs on every publish.
  • Live scoring, drift detection, and a human-in-the-loop when you want it.
  • A clean fallback to a person on a queue when a conversation needs one.
  • The console surfaces for the same gates: gate settings, blocked-promotion alerts, the prompt diff, and the canary panel.

Prerequisites

  • An agent you already have running, with an active production prompt. Build a WhatsApp and SMS AI Agent covers the messaging form end to end.
  • An API key with agents:read / agents:write scope.
  • The agent’s version-aware runtime — canary, regression, and comparison endpoints all operate on saved versions, so read the agent versions surface first.

1. Choose the models — chat vs voice vs retrieval

A single agent seldom uses one model for everything. A chat surface tolerates a long reasoning model; voice needs one with a fast first-token; retrieval benefits from a cheaper reranker. Pick per surface.
  • Chat (SMS / WhatsApp / widget). POST /agents accepts any Claude model. WhatsApp and SMS AI Agent covers the full build.
  • Voice. First-token latency matters more than depth. The voice handback guide is the pattern to copy, and it still applies here.
  • Retrieval. Where you point search_knowledge does most of the answering. Tune it with the retrieval benchmark below.

2. Load knowledge sources

The prompt is one input. The knowledge base is a second — bigger and more volatile. Create it, attach it to the candidate agent, then score retrieval before you spend time tuning the prompt.
A successful create is 201 and returns the standard response envelope:
Attach the returned id to the candidate agent. This is a PATCH even though the route accepts the agent resource path:
Before you ship a prompt change, run POST /agents/:id/retrieval-benchmark/runs over your golden question set and read GET /agents/:id/retrieval-benchmark. The run result contains recall_at_k for each scenario, so the CI gate can reject a candidate that stops retrieving the documents its questions require.
The response is an envelope. scenarios keeps the per-question gate visible:
Read the persisted history with GET /agents/:id/retrieval-benchmark before promoting. If recall is off, tune the knowledge sources first.

3. Define guardrails

The policy decides what the agent must and must not say, regardless of prompt. List policies, attach one to the candidate, then inspect its firing counts:
Analytics uses the standard { data, meta } envelope. Read data.by_rule for counts such as total, refused, escalated, and error:
Guardrails run on every live turn. Keep the selected policy attached throughout the rollout and treat an unexpected spike in a rule’s counts as a hold signal.

4. Test offline

Never let a new prompt meet a live channel first.

Persona simulation

POST /agents/:id/persona-simulation replays a scripted customer persona against the candidate prompt and grades the whole conversation against a rubric. Use the same scenarios on every candidate so the pass rate and mean score are comparable.
A passing 200 response is an envelope. Gate on the aggregate values, then inspect each scenario before allowing traffic:
A scenario that fails here never reaches traffic. The endpoint is rate-limited tighter than a normal run, so use a short, curated set.

Gate it in CI

Run the same two checks on every candidate version. These scripts deliberately fail closed: a missing field, a failed request, or a value below the pinned threshold exits non-zero. Set ORBIT_AGENT_ID, ORBIT_VERSION_ID, and ORBIT_API_KEY in your CI secret store.
Node.js (TypeScript)
Python
Only advance to shadow comparison when both aggregate gates and every scenario pass. The shadow workflow compares candidate and production without exposing the candidate to customers:
Promote from shadow only when the new prompt behaves better on the conversations that matter, and only after persona simulation passed.

5. Roll out gradually

POST /agents/:id/canary-rollout starts a staged rollout for the candidate version. The default ladder is 5% → 25% → 100%; override the per-stage array to stay in your budget/error tolerance.
The lifecycle operations keep the rollout observable and reversible:
GET returns the current stage and its live scorecard verdict. evaluate compares the running scorecard against the stage gates and persists the decision (advance, hold, rollback, complete). rollback is the operator kill-switch; cancel voids a rollout started by mistake.

6. Verify with regression tests

POST /agents/:id/regression-tests saves replayable conversations, and POST /agents/:id/regression-tests/run-all runs them after each deploy.
Save the hard cases. A test is a scripted conversation with expected outputs; the run-all endpoint replays every saved test against the candidate and reports pass/fail per test. If any of the saved tests miss production gates, the rollout should halt or roll back — and the canary policy knows that.

7. Monitor in production

Three surfaces together tell you how the live rollout is doing:
  • Quality scorecard. GET /agents/:agentId/quality-scorecard?window=7&min_sample=20 computes the resolved rate, latency, cost, and customer-sentiment index from the conversation-outcomes ledger.
  • Fairness evaluation. GET /agents/:id/fairness-eval/pack lists the built-in paired-testing probes; POST /agents/:id/fairness-eval/run replays them against a chosen attribute, flagging biased tracks before the rollout reaches 100%.
  • Loop detection. POST /agents/conversations/:conversationId/loop-check answers whether the agent is stuck repeating itself on a live conversation.
  • Human oversight. GET /agents/oversight/sessions lists live voice / chat with an oversight state; supervisor takeover and release endpoints bind a human to a problematic conversation.
Pipeline the scorecard once per stage, parity once before completion — the loop detector and oversight console run on demand.

8. Route to a human fallback

Some conversations should not stay with the agent at all.
The same handoff target appears at the end of the WhatsApp agent guide because it is the safe destination for anything the confidence score or guardrails block.

Worked example — promoting a WhatsApp support agent from 5% to 100%

You built the agent in WhatsApp/SMS form and want a more specific prompt that deflects refunds without sacrificing tone.
  1. Save the candidate prompt as a version (PUT /agents/:id with the new system_prompt, or POST /agents/:id/versions if you pin by id).
  2. Run POST /agents/:id/persona-simulation on the refund scenario set — all pass or you stop here.
  3. Run POST /agents/:id/shadow against recent conversations and review GET /agents/:id/shadow-comparison?days=7 for tone regressions.
  4. Start the rollout: POST /agents/:id/canary-rollout with stages: [5, 25, 100].
  5. After the first tick, read GET /agents/:id/canary-rollout and run POST /agents/:id/canary-rollout/evaluate. A decision of advance tells you the 5% stage’s gates passed; hold means more sample is needed; rollback means the gates failed and the candidate is off live.
  6. Run POST /agents/:id/regression-tests/run-all at each stage; the candidate must pass the saved gate set before advancing.
  7. Watch GET /agents/:agentId/quality-scorecard and POST /agents/:id/fairness-eval/run at each stage.
  8. When the evaluator reports complete, the candidate is serving 100%. If any tick returns rollback, the server pinned the baseline back; POST rollback performs the same pull manually.
Each numeric path in the example is the live route of that subsystem — nothing is staged manually once the rollout exists.

9. Run the same gates from the console

Everything above has a console surface on the agent’s Versions tab (Agents → your agent → Versions), so the pipeline can be run without leaving the dashboard. The tab is split into the version list, a Promotion gate tab, and the canary rollout panel. The mental model carries over one-to-one: a promotion (the per-version Restore action, the console equivalent of POST /agents/:id/versions/:vid/promote) is refused while the gate is failing, so a candidate that regresses your pinned checks never becomes live. The gate has two independent corpora, and either one can block a promote:
  • Saved regression tests — the deterministic, hand-written conversations from the Testing tab. Same semantics as the scripted regression gate: a fixed script replays the identical conversation on every run, so a failing result means the candidate changed behaviour, not the input. Block conditions: any test fails, a test cannot run, or none are saved yet.
  • Pinned golden sets — judge-scored golden sets from the eval-suite runner, compared against the thresholds you set.

Set the gate up

In the Promotion gate tab, the Pre-promotion regression gate card holds the whole configuration:
  • Enable promotion gate — the master switch. Off by default; an agent that never opts in promotes exactly as before.
  • Require saved regression tests — attaches the Testing tab suite to the gate with the block conditions above.
  • Pinned golden sets — pick up to ten golden sets created in the eval-suite runner; each row shows its case count.
  • Max P95 regression (0–10) — tolerated fraction slower than the baseline, e.g. 0.2 = 20% slower.
  • Max pass-rate regression (0–1) — tolerated judge pass-rate drop vs the prior run, e.g. 0.1 = a 10-point drop.
  • Minimum pass rate (0–1) — absolute floor that bites even on a candidate’s first run.
Leave a threshold blank for no limit on that metric. Save gate settings persists the card (owner/admin only; other roles see a refusal on save), and a Gate configured badge then appears next to each version’s promote action. If you switch the gate on without pinning anything, the card warns that promotions still run unchecked; enabling either corpus clears the warning and arms the gate.

Read a blocked promotion

With the gate armed, attempt a promote that regresses, and the promote action for that version turns into a blocked notice instead of a button:
  • Blocked by the promotion gate: … — a regression or pass-rate floor breach, with the failing detail in the reason (which suite regressed, by how much).
  • Blocked by the red-team safety gate: … — the adversarial safety pack fired; the reason names the failing category.
The notice is keyed to the version you attempted, so switching candidates clears a stale verdict. For the result taxonomy behind those reasons (pass/fail per test, red-team categories, soak verdicts), read Agent hardening runs: regression, red-team, and soak. Fix the failing set, re-run it, then attempt the promote again.

Review the prompt diff before you promote

Select a candidate in the version list and open its diff. The viewer compares the candidate against the previous version or live (production) via the selector, and covers the full versioned shape: the system prompt as a line-level split pane with added/removed highlights and a change count, configuration fields (model, temperature, max tokens) as a before/after table, and tools, knowledge bases, safety config, and the config bag as side-by-side JSON. Read it before every promote: the gate catches regressions in behaviour, but only the diff shows you what changed — a prompt edit you did not expect is a reason to stop regardless of scores.

Promote with a rollback path

The staging arm of the pipeline lives in the same tab. The Canary rollout panel ramps a challenger version’s traffic share stage by stage (default ladder 5, 25, 50, 100) while a quality scorecard (pass rate, sentiment, latency, thumbs-down, errors) grades each stage. From an active rollout:
  • Check now — runs the stage evaluation: advance, hold, or roll back.
  • Roll back — pulls the challenger off traffic immediately, whatever the scorecard says; the confirmation dialog warns it cannot be undone.
  • Cancel — voids a rollout started by mistake.
Keep the distinction in mind: a canary only widens or pulls the challenger’s traffic share, and a completed rollout leaves the candidate proven but not live. Flipping the live configuration is always the explicit per-version Restore action, and that is exactly the action the promotion gate police — which is what keeps a human in the loop on the actual config flip. If you promote directly and need to undo it, restore the prior version from the list.

Console vs API — division of labor

The console is the day-to-day surface: configure the gate once, attempt promotes, read block reasons, review diffs, and ride the canary panel. The API flow above is the automation surface: scripted persona simulation, shadow comparison, and regression runs wired into CI, plus everything the console wraps (GET|PUT /agents/:id/promotion-gate/settings, the canary endpoints, and the promote/rollback calls). Both drive the same persisted gate configuration and the same saved versions, so a gate armed in the console enforces an API promote too. Author the regression tests and golden sets in Agent evals: datasets, runs, and pass-rate gates; for the QA grounding behind the rubrics, see Run your first QA evaluation, from rubric to coaching plan.

Troubleshooting

See also