Production AI: a step-by-step guide
A fourteen-step path from a working prototype to an AI service that colleagues can rely on, built around one running example. It covers scope, capacity, security, knowledge, cost, release and review.
Production AI in 60 seconds
- What: a fourteen-step path from a working prototype to a service that colleagues can rely on, told through one running example called Store Assist.
- Core idea: the model is one part. Identity, data, limits, tools, caching, failure handling, measurement and release discipline decide whether the feature survives contact with real use.
- Order matters: requirements first, then numbers, then architecture, then each protective and performance layer, then release and review.
- Start narrow: ship the smallest safe version, measure it, and add machinery only when evidence asks for it.
- Two kinds of health: the service can be fast and wrong, or right and too slow. You must watch both.
The problem it solves
Your prototype accepts a question, passes it to a model and returns text. Perhaps it also searches a few documents or calls one API. In a demo to five people it looks finished. Then somebody asks you to roll it out to a company, and a different set of questions arrives.
- What happens when hundreds of colleagues ask something at the same minute?
- How do we guarantee that one person never sees another person's data?
- What do we show when the model provider has a bad afternoon?
- What stops a friendly assistant quietly eating the quarter's budget?
- How will we know, six weeks from now, that answers are still good?
None of these is a modelling question. All of them decide whether the launch is a success. This guide walks through them in a sensible order, with the same worked example from the first page to the last so the numbers stay comparable.
What AI system design means
AI system design is the work of specifying the whole machine that delivers an AI feature: what information it may use, which model handles which task, which actions it may take, how it is secured, how it is paid for, and how it recovers when something breaks. The model call is the visible part. The rest is what makes it dependable.
A prototype usually has three parts: an interface, a backend that forwards the question, and a model that replies. That is enough to prove an idea. A service people depend on needs more, and the extra parts are mostly ordinary engineering applied to an unusual component:
- sign-in and per-person permissions
- retrieval of approved, current knowledge
- caching of work that repeats
- usage limits per person and per team
- a choice of model for each kind of task
- queues and workers for bursts and slow jobs
- monitoring of quality, speed and spend
- a recovery plan for each dependency
Two requests, two very different designs
Consider a store colleague who types, "Why won't my handheld scanner sync since this morning's update?" The system must understand the question, find the right section of the scanner sync guide, check live device status through a management lookup, and explain the fix. A good answer is mostly a reading task.
Now the same colleague types, "Reset my till PIN." This is a different animal. It touches identity and it changes something. The system has to start a verified workflow, wait for the result and report what really happened. It must never write friendly instructions that imply the PIN has been reset when nothing has been done.
Both requests arrive in the same chat box. They need different paths behind it, and a lot of the guide is about how to tell them apart early and route them safely.
How it differs from classic system design
Most of what you already know still applies. You still need interfaces, databases, authentication, scaling, monitoring and safe deployment. Add these differences and the picture changes:
- Variable output: the same input can produce different replies, so tests describe acceptable ranges, not one exact string.
- Plausible mistakes: an answer can read well and still be wrong, so correctness needs its own measurement.
- Text costs money: prompts, history and retrieved passages are all billed by size, so a design choice becomes a cost choice.
- Uneven ability: models differ by task, so one model rarely suits every request.
- External limits: the provider sets its own speed, availability and rate ceilings, and you inherit them.
- Hostile text: a document or a message can carry instructions meant to steer the model, so input is not merely data.
- Behaviour must be evaluated: uptime tells you the service answered, not that the answer was good.
That last point has a practical edge. A service can be perfectly healthy while giving wrong answers, which no uptime chart will reveal. The reverse also happens: the model writes excellent replies, but the surrounding system is so slow or so expensive that nobody can use it. You design and measure for both failures from the start.
Meet Store Assist
The running example is Acme Retail, which has 400 stores and 12,000 store colleagues. Store Assist is an AI assistant inside the store app and on handheld scanners. It answers procedure questions, searches approved store manuals, checks live stock and order status, raises store incident tickets, and hands sensitive issues to the store support desk.
| Fact | Value used throughout |
|---|---|
| Trading day | 10 hours, 08:00 to 18:00, 7 days a week, 30 trading days a month |
| Usage | 3 questions per colleague per trading day, so 36,000 requests a day |
| Average load | 36,000 requests over 36,000 seconds is 1.0 request per second |
| Peak assumption | 10 times the average, so 10 requests per second, to be validated by load tests |
| Tokens per request | 1,000 input and 250 output |
| Illustrative model bill | £864 a month before embeddings, retries, infrastructure and observability |
| Headline targets | First token p95 under 1.5 s, full answer p95 under 8 s, 99.9% availability in trading hours, cost under £0.03 per resolved question, no cross-colleague data exposure |
Every later page uses these facts exactly, so you can see how each decision moves the same numbers.
The fourteen steps
- Step 1: Requirements and scope: decide what Store Assist must do, how well, and what it must never do alone.
- Step 2: Capacity and cost: turn usage into requests per second, concurrency, tokens and a monthly bill.
- Step 3: Reference architecture: name the layers and the path each kind of request takes.
- Step 4: Identity, access and limits: know who is asking, what they may see, and how much they may use.
- Step 5: Guardrails and privacy: treat text as untrusted and keep personal data where it belongs.
- Step 6: Knowledge and retrieval: feed the model current, permitted knowledge and keep the index honest.
- Step 7: Semantic caching: reuse answers safely and know what must never be cached.
- Step 8: Model selection and routing: send each task to the cheapest model that does it well.
- Step 9: Tools and human approval: let the system act without giving it unlimited power, and hand over to people when needed.
- Step 10: AI gateway and resilience: put one controlled door in front of providers and plan for their failures.
- Step 11: Queues, scaling and streaming: absorb bursts, scale the right things and show progress while the answer forms.
- Step 12: Observability and evaluation: see inside the system and measure answer quality continuously.
- Step 13: Release engineering: ship changes in a reviewable, testable, recoverable way.
- Step 14: End-to-end design and checklist: trace one request through everything, plan the build order and review the whole.
Who owns what
A system with this many layers fails in the gaps between teams unless ownership is written down. The table below is a starting split for Store Assist. Adjust it, but make sure every row has exactly one accountable name.
| Area | Accountable group | Typical responsibilities |
|---|---|---|
| Product and scope | Product | Use cases, risk tiers, targets, acceptance criteria, launch decisions |
| Platform and runtime | Platform engineering | Entry layer, scaling, queues, gateway, deployment pipeline, recovery |
| Model behaviour and quality | ML engineering | Prompts, routing, retrieval quality, evaluation sets, regression gates |
| Security and privacy | Security | Identity model, data classification, injection testing, retention, audit |
| Store operations content | Store operations | Manuals, procedures, freshness, withdrawal of outdated material |
| Support desk handover | Store support | Escalation queue, response times, feedback on poor handovers |
Defining done for an AI feature
For ordinary software, done often means the tests pass and the feature is deployed. For an AI feature that definition is too thin. A useful working definition has five parts, each with a named owner and a number.
- The feature meets its quality targets on a golden evaluation set that reflects real questions.
- It meets its speed and availability targets under a load test at the assumed peak.
- Its cost per resolved question sits inside the budget, with headroom for retries.
- Its worst realistic failure, such as a provider outage or a poisoned document, has been rehearsed and the behaviour is acceptable.
- There is a named owner, a dashboard, an alert route and a rollback path.
A production-readiness gate
Before each widening of access, such as one region to all regions, hold a short review. It is a gate, not a ceremony: a one-page record where every line is either evidence or an accepted, owned risk. The review asks whether requirements are signed off, capacity is validated by a test, identity reaches retrieval and tools, injection tests run in the pipeline, the knowledge index has a freshness target, spend is capped, handover works, rollback has been practised and on-call knows what to do.
Treat an unchecked line as a decision, not an oversight. Somebody with authority writes down "we accept this for two weeks, owned by this person". That small habit prevents most unpleasant surprises.
How to use this guide by role
- Developers: read every step in order once, then keep the code sketches and checklists beside you while you build. Steps 3, 9, 10 and 11 hold most of the moving parts.
- Architects: focus on steps 2, 3, 8, 10 and 14, and use the design decision sections as review prompts.
- ML engineers: go to steps 6, 7, 8 and 12, and keep step 5 close for injection testing.
- Product managers: start with steps 1, 2 and 14, read the trade-off tables on every page, and use the checklists to ask better questions.
- Security and privacy leads: read steps 4, 5, 9 and 12, then check the data classification set in step 1.
Store Assist, worked through
Here is the whole guide compressed into one example. A colleague opens Store Assist at 08:05 and asks about a scanner that stopped syncing. The request reaches the entry layer with a signed identity. The system classifies it as a read-only troubleshooting question, retrieves the relevant guide sections that this colleague may read, calls a device lookup, builds a prompt of about 1,000 tokens, and streams a 250 token reply. First words arrive in under 1.5 seconds, and the whole answer lands inside 8.
At 08:10 a regional till outage sends thousands of colleagues to the same question. Identical requests are served from a scoped cache, the queue absorbs the rest, and the gateway keeps provider calls inside their limits. At 08:20 someone types, "Reset my till PIN". That request leaves the generative path completely and enters a verified workflow. Every one of these paths is a step in this guide.
from dataclasses import dataclass
# Each gate item needs evidence and an owner. Missing either one blocks the launch.
@dataclass
class GateItem:
name: str
owner: str | None = None
evidence_url: str | None = None # link to a test run, dashboard or sign-off
accepted_risk_until: str | None = None # ISO date, only for knowingly accepted gaps
REQUIRED = [
"requirements_signed_off", "load_test_at_peak", "cost_within_budget",
"identity_reaches_retrieval_and_tools", "injection_suite_in_ci",
"freshness_target_defined", "spend_cap_set", "handover_tested",
"rollback_practised", "on_call_runbook",
]
def review(items: list[GateItem], today: str) -> list[str]:
"""Return a list of blocking problems. An empty list means the gate passes."""
problems = []
by_name = {i.name: i for i in items}
for name in REQUIRED:
item = by_name.get(name)
if item is None or item.owner is None:
problems.append(f"{name}: no owner")
continue
has_evidence = item.evidence_url is not None
risk_ok = item.accepted_risk_until is not None and item.accepted_risk_until >= today
if not (has_evidence or risk_ok):
problems.append(f"{name}: no evidence and no live risk acceptance")
return problems
Design decisions
- Scope of the first release: choose one region and read-only answers first. Live lookups, actions and scale come later, each behind its own gate.
- Ownership map: assign each layer to one accountable group and write the interfaces between them.
- Shared vocabulary: agree names for request types, risk tiers and targets so dashboards, tickets and contracts use the same words.
- Evidence standard: decide what counts as proof for each gate item, for example a dated load test, not a verbal assurance.
- Change control: decide which changes need the full gate and which can pass a lighter review.
Measuring it
- Gate pass rate: the share of launches that clear review first time. A very low rate means requirements are being written too late.
- Quality trend: groundedness and escalation accuracy on the golden set, tracked per release.
- Cost per resolved question: against the £0.03 target, split into model, retrieval and platform cost.
- Incident count by cause: retrieval, provider, injection, stale data, capacity and release, so effort follows evidence.
- Time to detect and recover: how long a quality fall goes unnoticed, and how long recovery takes.
When to use it, or a lighter path
| Situation | Path | Why |
|---|---|---|
| Internal prototype for one team of ten, read-only, no personal data | Light: steps 1, 2 and 5 only | The blast radius is small and rollback is trivial. |
| Company-wide assistant answering from approved manuals | Steps 1 to 8 and 12 | Scale, freshness and quality now matter, while actions are still absent. |
| Assistant that reads live stock or ticket data | Add steps 4 and 9 | Identity must reach every data source and every tool. |
| Assistant that changes records or starts workflows | The full guide, with approvals | A wrong action costs money or trust, so every layer earns its place. |
| Feature with a regulator or contractual audit duty | The full guide plus audit design | Evidence and retention become requirements, not extras. |
Trade-offs
| Dimension | Effect | What to do about it |
|---|---|---|
| Speed to launch | The full path adds weeks before the first user sees anything. | Phase the work and ship the narrowest safe slice early. |
| Cost | Each layer adds build and run cost, from gateways to evaluation sets. | Add a layer when a measured problem asks for it. |
| Risk | Skipping layers lowers cost today and raises incident cost later. | Match depth to risk tier, and write down accepted gaps. |
| Team load | More layers mean more owners and more coordination. | Keep the ownership map short and the interfaces explicit. |
What this means for your role
Common mistakes
Step checklist
- A named owner exists for each layer in the ownership table.
- The first release is scoped to one use case, one region and one risk tier.
- A definition of done with five numbered parts has been agreed.
- The readiness gate exists as a template, and its first run is scheduled.
- Everyone reading the guide knows the Store Assist facts above.
Further reading
- AI overview: where production design sits in the wider AI picture.
- Harness engineering: the structure that surrounds a model.
- Agentic failure modes: what goes wrong, and how to contain it.
- Evaluation and observability: measuring answer quality.
- Key trade-offs: the general vocabulary behind many choices here.
The lesson underneath all fourteen steps is simple. Pick a small, sharply defined problem, set the security and quality bars up front, measure the first version, and add heavier machinery only when the evidence calls for it. The best system is not the one with the biggest model or the busiest diagram. Look instead for steady delivery on the stated problem, protection for its users, respect for its limits, and room to improve safely. The model supplies intelligence. The system around it is what makes that intelligence usable.