Add AI capabilities to a normal application only when needed
Treat inference, model gateways, and natural-language search as replaceable modules, not prerequisites for a useful application.
Edited and verified by Orange Book Editorial Team ·
Make the application useful without a model, then add AI only where it improves a real task. SaaS tenant management, CMS publishing, image resizing, and PDF generation do not require an LLM. AI is a better fit for classification, summarization, generation, and semantic retrieval that deterministic rules cannot solve economically.
This is not an agent tutorial
Agents and chat are only two possible product shapes. This page shows how a normal application can call a replaceable model module safely and keep its core service available when that module fails.
Decide whether the capability is justified
| User task | Default | Consider AI when | Non-AI fallback |
|---|---|---|---|
| Form validation | Schema and deterministic rules | Do not replace with a model | Display field errors |
| Content classification | Rules, tags, or a human choice | Categories are fuzzy and volume is high | Save as unclassified |
| Text summary | Extract and human summary | Documents are long, numerous, and approximation is acceptable | Show original and outline |
| Content search | Keywords and filters | Users express intent in natural language | Keep keyword search |
| Copy draft | Templates | Users benefit from varied first drafts | Use a fixed template |
If output can charge money, delete data, change authorization, or publish publicly, the model can propose an action but deterministic checks or a human must approve it.
Three Cloudflare entry points
Workers AI
AI Gateway
AI Search
The products can work together, but do not enable them all by default. Define input, output, latency target, data sensitivity, and budget, then select the smallest entry point.
Integration sequence
Define a stable application interface
Business code calls your own classify(), summarize(), or search() interface instead of scattering model requests across page components. Return structured output, sources, model state, and recognizable errors.
Bound input and output
Limit text length, file type, and allowed fields on the server. Treat retrieved documents and user input as untrusted data. They cannot override system rules or request secrets.
Add timeout and fallback
Return an understandable state when a model times out or a quota is exhausted. Search falls back to keywords, summaries to the original preview, and classification to a review queue. Saving, login, and payment cannot depend on model success.
Observe cost and quality
Record calls, the applicable usage unit, latency, errors, and human corrections per feature. Do not log complete sensitive prompts and private user content by default.
Release gate
Correctness
Security
Cost
Replaceability
Next: choose a search and knowledge approach.
Primary sources
Did this page help you complete your goal?
Beta feedback is generated in this browser and is never uploaded automatically.
R2 migration playbook: Super Slurper, Sippy, or rclone
Choose an R2 migration path by downtime model, object limits, and verification requirements, then plan a gradual and reversible cutover.
From keyword search to AI Search
Choose keywords, Vectorize, or managed AI Search from user intent, data scale, explainability, and maintenance cost.