Operations and security 5 min read Updated
AI features in production: reliability and safety
In short
A convincing prompt in a demo is easy; running an LLM feature in production means treating model outputs as untrusted data, scoping inputs strictly and capping cost and agency.
Most AI prototypes work well in a ten-minute demo and fail quietly in production. A user enters unexpected text, a retrieved document belongs to another customer, a model invents a plausible policy clause, or a runaway loop burns a monthly API budget in an afternoon. Shipping AI features reliably means applying standard systems engineering controls around a probabilistic component.
Treat the model as an untrusted subsystem
The OWASP Top 10 for Large Language Model Applications highlights three recurring failure modes in real products: prompt injection, sensitive information disclosure and excessive agency. In architectural terms, treat everything coming out of a language model the same way you treat input from an external form: validate it, escape it before rendering, and never execute state-changing actions without deterministic server-side checks.
The NIST AI Risk Management Framework frames the same discipline across four ongoing functions—Govern, Map, Measure and Manage—so risks are tracked across the life of the feature rather than once before launch.
Input scoping and data leakage prevention
- Minimise what leaves your server: strip API keys, internal tokens and unnecessary personal data before constructing a prompt. If a task only needs an order state or product SKU, do not attach the customer’s full profile.
- Enforce tenant boundaries in retrieval (RAG): filter vector or full-text search queries by the verified server-side tenant_id and user permission level before passing chunks into model context.
- Separate instructions from data: never concatenate unescaped user text or external web/email content as trusted system instructions, and limit maximum input length up front.
- Verify provider data retention terms: confirm contractual zero-retention or non-training settings with your model provider when processing customer data.
Output verification and bounded actions
| Control layer | What it prevents | What it does not solve alone |
|---|---|---|
| Strict JSON schema & type checks | Broken UI parsers, missing required fields, wrong enums | Factual accuracy or invented prices/rules inside string fields |
| Grounded retrieval with source IDs | Unsupported claims with no matching internal record | Misreading a valid record or combining two unrelated clauses |
| Explicit abstain / fallback path | Forced guessing when context is missing or ambiguous | Silent errors if evaluation thresholds are never measured |
| Human confirmation gate | Irreversible refunds, deletions or external emails (excessive agency) | Reviewer fatigue if the AI submits low-confidence drafts constantly |
Never let a model generate raw SQL, execute shell commands or issue money-moving API calls directly. Map model choices to a small, audited allow-list of typed actions on the server, and require human confirmation for anything that cannot be undone.
Logging, evaluation and cost caps
- Per-tenant and per-user rate/budget limits: combine standard request throttling (see Rate limiting) with daily token or spend caps per workspace so one misbehaving integration cannot exhaust shared quota.
- Timeouts and graceful degradation: set hard HTTP timeouts on model calls and return a deterministic fallback (for example, standard keyword search or an editable blank draft) when the provider times out.
- Structured audit logs without secret leakage: record request ID, prompt template version, model name, latency, token counts and validation errors (see Logging), while masking PII and never logging API keys.
- Regression test suite: build a small fixed set of real edge cases—including prompt-injection attempts and “no answer in sources” cases—and run it whenever you change a prompt or model version.
Transparency duties under the EU AI Act
If your product exposes a user-facing chat assistant or generates synthetic media, check Article 50 of the EU AI Act and our guide on EU AI Act transparency duties, which apply from 2 August 2026.
No prompt wording eliminates prompt injection or hallucinations completely. Treat safety as layered server-side engineering—input minimisation, tenant-scoped retrieval, typed validation, spend caps and human review—not prompt tricks.
Integrating an AI workflow into an existing product and want reliable boundaries from the start? Read our guide on AI agents and business automation or share the use case via our enquiry form.
Common questions
- How do you prevent sensitive customer data from leaking through an AI feature?
- Minimise personal data and strip secrets before sending prompts, enforce server-side tenant isolation on any retrieval index so one customer cannot retrieve another’s documents, and separate system rules from untrusted user text.
- Can schema validation alone stop AI hallucinations?
- No. Strict JSON schema validation guarantees shape and types, not factual truth. Ground answers in cited source records from your own database, provide an explicit abstain path when no match exists, and keep a human check before consequential actions.
- What cost and reliability controls belong in production?
- Set per-user and per-tenant token or request budgets, strict timeouts, fallback responses when the model provider fails, and structured audit logs that avoid storing raw secrets or unmasked PII.
Sources
- OWASP Top 10 for Large Language Model Applications, OWASP Foundation. Accessed 22 November 2026
- AI Risk Management Framework, NIST. Accessed 24 November 2026
- Article 50: Transparency obligations for providers and deployers of certain AI systems, European Commission, AI Act Service Desk. Accessed 24 November 2026
Further reading
-
The EU AI Act: transparency duties for features
Article 50 of the EU AI Act sets disclosure and marking duties for certain AI systems, and it applies from 2 August 2026.
-
Rate limiting that protects forms and logins
Rate limiting caps how often a client may repeat an action, and a 429 response with Retry-After tells honest clients when to try again.
-
What to record in logs and how long to keep them
Log the security events that help you answer what happened, keep passwords, tokens and personal data out of logs, and protect the logs you keep.
Have an idea that should exist? Or a working product that needs more customers, a new website or a complete rework? Bring us anything. Apply with your idea