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’ssystem_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.
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:writescope. - 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 /agentsaccepts 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_knowledgedoes 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.POST /agents/:id/retrieval-benchmark/runs— score its recall on the query set you pin as baseline.GET /agents/:id/retrieval-benchmark— read the latest persisted run.
3. Define guardrails
The policy decides what the agent must and must not say, regardless of prompt.GET /guardrail-policies— list the built-in library.POST /agents/:id/guardrail-policy— apply a named policy to the agent.GET /agents/guardrail-analytics— see what the policy is firing on in practice, by rule and by conversation.
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: pass rate, mean score, per-tool calls, per-scenario verdict.
Shadow comparison
POST /agents/:id/shadow fires a side-channel comparison run, answering
the same conversation with both the production and the candidate prompt,
without exposing the candidate to the customer.
GET /agents/:id/shadow-comparison?days=7— side-by-side review of what the candidate would have said.POST /agents/:id/shadow/promote— take the shadow candidate directly into production if it wins on both quality and cost.
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.
GET /agents/:id/canary-rollout— read the current stage and its live scorecard verdict.POST /agents/:id/canary-rollout/evaluate— compare the running scorecard against the stage gates; the decision (advance, hold, rollback, complete) is applied and persisted.POST /agents/:id/canary-rollout/rollback— operator kill-switch to pull the candidate regardless of gates.POST /agents/:id/canary-rollout/cancel— void 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=20computes the resolved rate, latency, cost, and customer-sentiment index from the conversation-outcomes ledger. - Fairness evaluation.
GET /agents/:id/fairness-eval/packlists the built-in paired-testing probes;POST /agents/:id/fairness-eval/runreplays them against a chosen attribute, flagging biased tracks before the rollout reaches 100%. - Loop detection.
POST /agents/conversations/:conversationId/loop-checkanswers whether the agent is stuck repeating itself on a live conversation. - Human oversight.
GET /agents/oversight/sessionslists live voice / chat with an oversight state; supervisor takeover and release endpoints bind a human to a problematic conversation.
8. Route to a human fallback
Some conversations should not stay with the agent at all.POST /conversations/:id/handoff— escalate the current chat conversation to a support queue.GET /agents/crm-tools/internal/active-providers— list the CRM providers your account can dispatch to.POST /agents/crm-tools/internal/dispatch— dispatch a ticketing or CRM tool call without leaving the agent runtime.
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.- Save the candidate prompt as a version (
PUT /agents/:idwith the newsystem_prompt, orPOST /agents/:id/versionsif you pin by id). - Run
POST /agents/:id/persona-simulationon the refund scenario set — all pass or you stop here. - Run
POST /agents/:id/shadowagainst recent conversations and reviewGET /agents/:id/shadow-comparison?days=7for tone regressions. - Start the rollout:
POST /agents/:id/canary-rolloutwithstages: [5, 25, 100]. - After the first tick, read
GET /agents/:id/canary-rolloutand runPOST /agents/:id/canary-rollout/evaluate. A decision ofadvancetells you the 5% stage’s gates passed; hold means more sample is needed; rollback means the gates failed and the candidate is off live. - Run
POST /agents/:id/regression-tests/run-allat each stage; the candidate must pass the saved gate set before advancing. - Watch
GET /agents/:agentId/quality-scorecardandPOST /agents/:id/fairness-eval/runat each stage. - When the evaluator reports
complete, the candidate is serving 100%. If any tick returnsrollback, the server pinned the baseline back;POST rollbackperforms the same pull manually.
Troubleshooting
See also
- Build a WhatsApp and SMS AI Agent — the messaging form this pipeline rolls out.
- AI Voice Agent Handback — return an escalated voice call to the agent after a human step.
- Creating Agents — full agent configuration reference, including guardrails and escalation triggers.
- Agent versions — saved prompt configurations these rollout endpoints move between.
- Handoff targets — the destination conversations route to when the agent hands off.