AI engineering is the discipline of building production systems on top of foundation models. This is the practitioner's view: retrieval, context engineering, evals, guardrails, cost and latency tuning, and LLMOps - the work that separates demos from systems that survive real traffic.
Search for "AI engineering" and you get book recommendations, certificate programs, and salary surveys. Useful, but none of it describes the job. The job is what happens after the demo works: the retrieval index that goes stale, the eval suite that catches a regression before your users do, the guardrail that blocks a prompt injection at 2am, the invoice that triples because an agent loop retried itself into oblivion.
The gap between the two is measurable. MIT's Project NANDA found that 95% of enterprise GenAI pilots show no measurable P&L return, and the report blames integration and workflow gaps, not model quality. The models are fine. What's missing is engineering. This post lays out what AI engineering means when systems are live: the stack, the development loop, the constraints, and the operations work that keeps a GenAI system worth its bill.
What AI engineering is (and what it isn't)
AI engineering is the discipline of building production software systems on top of pre-trained foundation models - selecting models, wiring them to retrieval and tools, engineering their context, evaluating their outputs, and operating the result under real cost, latency, and safety constraints. The model is a component you call, not an artifact you train.
That framing comes from Chip Huyen's AI Engineering (O'Reilly, 2025), which draws the line cleanly: ML engineering builds and deploys models developed in-house; AI engineering builds applications with models someone else trained. You'll also hear "LLM engineering" for the subset focused on language models specifically. The titles matter less than the shift in where the work lives:
| ML engineering | AI engineering | |
|---|---|---|
| Core artifact | A model you trained | A system around a model you call |
| Starts with | Data collection and labeling | A working base model |
| Core loop | Train, validate, deploy | Compose, evaluate, iterate |
| Quality lever | Architecture, features, training data | Retrieval, context, prompts, orchestration |
| Typical failure | Drift between training and serving data | Hallucination, retrieval misses, cost blowups |
| Ops discipline | MLOps | LLMOps |
The inversion trips up experienced ML teams. In classic ML you spend months getting to a first working model and the product grows around it. With foundation models you get a working demo in a day, and then spend months making it accurate, safe, fast, and affordable. The effort didn't shrink. It moved.
The production stack: retrieval, context, and orchestration
In a production GenAI system, the model call is a few lines of code. Everything around it is where the engineering hours go:
- Data ingestion and indexing - parsing, chunking, and embedding your documents into a vector or hybrid search index, and keeping that index fresh as sources change.
- Retrieval - hybrid lexical plus vector search, filtering by permissions and recency, reranking. This is the layer that decides what the model gets to know, and it's where most quality problems originate. The RAG architecture is standard because injecting knowledge at query time beats retraining for anything that changes weekly.
- Context assembly - deciding what goes into the window and in what order: retrieved chunks, tool outputs, conversation history, instructions. Context engineering has replaced prompt-tweaking as the core skill; a well-built context pipeline outperforms a clever prompt on a weak one every time.
- Orchestration - the control flow: routing between models, chaining calls, executing tools, handling retries and fallbacks. AI orchestration is where agentic behavior lives, and where it goes wrong. Gartner predicts over 40% of agentic AI projects will be canceled by end of 2027, citing escalating costs and unclear value - mostly projects that reached for autonomy before nailing the basics. A constrained workflow with explicit steps beats an open-ended agent for most business processes; know what you're signing up for before you build one.
- Serving - streaming, caching, rate limiting, multi-tenancy. Ordinary backend engineering, with token-shaped edge cases.
The common mistake is treating layers 1-3 as plumbing and spending all the design effort on layer 4. In practice the ranking is reversed: teams we work with fix more production quality issues in chunking and retrieval than anywhere else in the stack.
Evaluation is the development loop
LLM evaluation is the practice of measuring model and system output quality against defined criteria - correctness, groundedness, format compliance, safety - using a mix of programmatic checks, LLM-as-a-judge scoring, and human review. In production AI engineering, evals replace the compile step: they are how you know a change didn't break something.
Without them you're guessing. Model outputs are non-deterministic and quality regressions are silent; a prompt tweak that fixes one case breaks three others, and nothing throws an exception. The industry knows this and still under-invests: LangChain's State of Agent Engineering survey (1,340 respondents, late 2025) found 52.4% of teams run offline evaluations, 37.3% run online evaluations, and 29.5% run no evaluation at all - even as 57% report agents in production. A meaningful slice of the industry is shipping blind.
The working pattern is layered, not a single score:
- Assertions first. Deterministic checks - valid JSON, required fields, no leaked PII, citations resolve - catch a large share of failures for near-zero cost.
- A curated eval set of 50-200 real cases with expected outcomes, run on every prompt, model, or retrieval change, like a test suite.
- LLM-as-a-judge for open-ended quality dimensions, calibrated against human labels before you trust it.
- Online signals - user feedback, edit rates, escalations - feeding new failure cases back into the offline set.
We covered the framework landscape and metric design in depth in our LLM evaluation guide. The tooling matters less than the habit: every incident becomes an eval case, so the suite grows into a regression net that encodes everything the system ever got wrong.
Guardrails, cost, and latency: the constraints that shape the design
A production system earns its keep under constraints a demo never faces. Three of them dominate AI engineering decisions.
Safety. Guardrails are validation layers that sit outside the model: input-side checks for prompt injection and off-topic use, output-side checks for grounding, PII, and policy violations. The model's own alignment is not a security boundary - anything reachable through the context window is attacker-controllable, so you filter before and after the call, the same way you validate user input in any other system. Implementation patterns are in our AI guardrails guide.
Cost. Token spend scales with traffic and with sloppiness, and the two compound. The levers are caching what repeats, routing requests to the cheapest model that clears the quality bar, and compressing what you send and receive - trimming retrieval payloads, capping agent iterations, shortening outputs. Layered, these routinely cut spend by well over half; the full playbook is in our LLM cost optimization guide. Latency follows the same knobs: fewer tokens and smaller models are also faster, which is why cost and latency tuning are usually one exercise.
The trade-off triangle. Quality, cost, and latency pull against each other - a bigger model or more retrieved context helps quality and hurts the other two. AI engineering in production is mostly the act of picking a point on that triangle per use case, then defending it with evals so the next change doesn't silently move it.
LLMOps: observability and the feedback flywheel
LLMOps is the operational discipline for LLM-backed systems: tracing every request end to end, monitoring quality and spend, managing prompt and model versions, and closing the loop from production failures back into development. It extends MLOps to systems where the "model" is an API call and behavior changes without a deploy - a provider model update can shift your outputs overnight.
Teams have gotten the message on visibility: in the same LangChain survey, 89% of respondents have observability for their agents, and 94% of production teams do, with 71.5% running full tracing. The signals worth watching:
- Per-request traces covering retrieval results, assembled context, tool calls, and model outputs - without the trace, "why did it say that?" is unanswerable.
- Token and cost metrics per feature and per tenant, so a runaway loop shows up in a dashboard before it shows up on the invoice.
- Quality drift via online eval scores and user feedback trends, which catch both your regressions and the provider's silent model changes.
- Retrieval health - index freshness, hit rates, and the fraction of queries retrieving nothing useful.
The flywheel is the point. Traces surface failures, failures become eval cases, eval cases gate the next change, and the system gets more reliable with every incident instead of accumulating mystery. That loop - not any single framework choice - is what the 5% of teams on the right side of MIT's divide have in common.
Key takeaways
- AI engineering builds systems around foundation models; the model is a component, not the deliverable. Quality lives in retrieval, context, and orchestration - not in the model call.
- Evals are the development loop. A curated eval set plus cheap assertions, grown from production failures, is what makes iteration safe. About 30% of teams still run no evaluation; don't be one of them.
- Guardrails belong outside the model. Treat the context window as an untrusted input channel and validate on both sides of the call.
- Cost, latency, and quality form a triangle. Cache, route, and compress to pick your point on it - then defend it with evals.
- LLMOps closes the loop: trace everything, meter tokens per feature, watch for drift, and feed every incident back into the eval suite.
Most of this work is systems engineering on top of your own data, which is exactly why the pilots that fail tend to fail at integration rather than at the model. If you're taking a RAG, semantic search, or agentic system to production and want a team that has shipped this stack before, our AI engineering services cover the path from working demo to a system you can operate.