AI Prototype to Production: What Has to Change
Meera said go at the week-5 gate, but the Nimbus Assure assistant is still a script on your laptop reading past claims. From the week-10 pilot, handlers will rely on it for live claims daily, even when the model provider is slow. This lesson covers what changes from AI prototype to production, and what stays.
Home kitchen vs restaurant kitchen
As lesson 3 said, production is the live system real users rely on. The prototype asked whether checking a draft beats re-typing; production asks whether it keeps working, safely, on every claim, even on days a part fails.
The recipe stays: the prompt, the pinned model version and lesson 12's eval set, which every change must still pass. Around them, lesson 10's fakes list becomes real: the live inbox, staff logins and the claims system.
The aha: only the model and prompt carry over, wrapped in a timeout and retries; most production work is around them.
Reliability: retries, timeouts and fallbacks
Real connections fail: providers slow down, refuse requests or go down. Three tools keep the system safe when they do:
- Timeout: the longest you wait for a reply. Python's
requestswaits forever unless you set one. - Retry: sending a failed request again, only for brief failures: a timeout, a dropped connection, a 5xx server error or
429 Too Many Requests, the provider's rate limit on how often you may call. A 400 (bad request) will fail again. - Fallback: what runs when retries run out. At Nimbus, the claim reaches the handler queue with no draft, typed as before. A second model could stand in only after passing the same eval set.
Space retries with exponential backoff, a longer wait before each try, plus jitter, a random extra wait so many requests don't retry in step (see What Is a Message Queue?). Here is the shape with requests, as in Call an LLM API from Python; timeout=(5, 30) allows 5 seconds to connect and 30 to read the reply, illustrative values:
import random, time
import requests
RETRY_ON = {408, 429, 500, 502, 503, 504}
def call_model(url, body, tries=3):
for n in range(1, tries + 1):
try:
r = requests.post(url, json=body, timeout=(5, 30))
if r.status_code == 200:
return r.json()
if r.status_code not in RETRY_ON:
return None
except (requests.Timeout, requests.ConnectionError):
pass
if n < tries:
time.sleep(2 ** n + random.random()) # about 2 s, then 4 s
return None
Returning None lets the caller fall back instead of crashing. A production version would also wait as long as a 429's Retry-After header asks. Check your SDK, the provider's own library, first: OpenAI's Python SDK already retries some errors twice and waits up to 10 minutes, so three tries around it make up to nine requests.
The common mistake is retrying a step that isn't safe to repeat: if a save times out after it worked, the retry saves a second record. Make saves idempotent, safe to repeat, by keying each record to the email's unique Message-ID header, so a repeat finds it already saved. Test the fallback by switching the model off.
Guardrails for inputs and outputs
Guardrails, lesson 3's automatic checks on the AI's input and output, are built in code in LLM Guardrails. For Nimbus, decide what each does when it fires: block (no draft), fix (set a field to MISSING) or flag (a warning beside the draft).
- Is it a claim? A complaint about a late payout is blocked (lesson 12's "not a claim" row).
- Safe files: only PDF and image attachments, under size and page limits; anything else is blocked.
- Orders to the AI: the email goes to the model marked as data, and text aimed at the AI, such as lesson 12's £9,000 note, is flagged.
- Valid JSON: the reply must be valid structured JSON with all seven fields; if not, it counts as a failed try.
- Formats and dates: a policy number is NA- plus six digits, so the old claim number CL-55190 can't land there; amounts carry a currency; the date of loss is not after the email was sent. A failing field becomes MISSING, flagged.
Guardrails don't replace lesson 7's human in the loop: only a handler's save reaches the claims system. They point the handler at the field most likely to be wrong, as the flowchart of one claim shows.
The aha: any failure's worst outcome is the old way, a handler typing the claim, which Nimbus already does every day.
Monitoring quality, not just uptime
Uptime, the share of time a service works, says the assistant answered, not that it was right: a draft with the wrong date arrives as fast as a right one. So watch two kinds of signal:
- Health: claims drafted, time from email to draft, and the fallback share (Monitoring and Alerting Basics).
- Quality: how often handlers edit each field, and how often each guardrail fires. Every draft is checked, so an edit usually marks an AI mistake.
Count them from one log line per claim, as in Observe Your LLM App: request id, model and prompt version, checks fired, tries, time, tokens and fields edited, but not the claim's text, since logs copy personal data. Then compare live numbers with the eval set's; p95 is the time within which 95 in 100 claims are drafted:
Nimbus assistant, pilot day 3 (illustrative figures)
Health Today Target
Claims drafted 98.8% 98% or more
Email to draft, p95 41 s 60 s or less
Quality Today Eval set
Drafts saved unedited 71% 84%
date_of_loss edited 14% 4% ALERT
Every health number is on target, yet handlers fix the date in one draft in seven. Reading those drafts might reveal a broker's form that writes dates month first, lesson 12's 02/11/2026 trap. The fix is lesson 12's loop: new eval rows, a prompt change, a rerun.
Edits also fall when handlers stop checking. Automation bias is trusting an automatic answer without checking it, so each week one of Lin's senior handlers re-checks a random sample of saved records. Alerts go to a named owner at Nimbus, not to you.
A production-readiness checklist
A production-readiness checklist lists what must be true before real users rely on a system, each item shown by evidence. Agree it with Nimbus IT, the owner from lesson 8, since they run it after you leave.
| # | Item | Ready means |
|---|---|---|
| 1 | Eval set | Targets met; runs on every change |
| 2 | Timeouts, retries, fallback | Set; fallback tested |
| 3 | Safe saves | A retry can't duplicate a record |
| 4 | Backup model | Passed the same eval set |
| 5 | Input checks | Claim, files, orders to the AI |
| 6 | Output checks | Valid JSON, formats, dates |
| 7 | Human in the loop | Nothing saved without a handler |
| 8 | Logs | One line per claim, no claim text |
| 9 | Dashboard and alerts | Alerts reach a Nimbus owner |
| 10 | Spot checks | Weekly expert re-check |
| 11 | Approvals | Security passed; company logins |
| 12 | Switch-off and runbook | Both in place |
| 13 | Budgets | Cost and latency agreed |
Items 11 to 13 come later: security, logins, rollback, the runbook and budgets. "Not needed" is fine, with a reason.
Check yourself
The model provider is down for an hour on Monday morning. What do Nimbus's handlers notice?
Claims arrive without drafts, and they type them as before. Retries run out and each claim falls back to the queue, so nothing is lost.
An output check finds CL-55190 in the policy number field. Why fix and flag rather than block the draft?
The other six fields are probably right. Blocking means re-typing everything; MISSING plus a warning points the handler at the one problem.
Two months in, handler edits have fallen almost to zero. Is the assistant nearly perfect?
Not necessarily: handlers may have stopped checking (automation bias). Weekly expert spot checks of saved records tell the two apart.
Go deeper
- LLM Root Cause Analysis: Correlate Logs, Metrics, Traces: when an alert fires, start from what changed, using your logs and metrics.