← All writing
AI & AUTOMATION9 min read

AI Engineering Is the New Core Skill for Building Reliable Digital Products

AI engineering is the discipline of designing, testing, securing and scaling AI features that survive production. Here is what the job actually involves.

Two years ago, adding AI to a product meant a weekend of prompt tinkering and a demo that made everyone in the room nod. Today that same feature has to answer ten thousand times a day, stay inside a budget, refuse the things it should refuse, and fail in a way that does not take the checkout flow down with it. The gap between those two situations is a discipline, and the discipline has a name: AI engineering.

It is not prompt engineering with a bigger job title. Prompting is one skill inside it, roughly the way SQL is one skill inside backend work. AI engineering is the practice of building systems where a non-deterministic component sits in the critical path and the whole thing still has to behave.

Why the old playbook does not transfer

Every engineering habit we have is built on determinism. Same input, same output. Write a test, assert equality, go home. A language model breaks that assumption at the foundation, and almost every production problem teams hit traces back to pretending it did not.

Four assumptions stop holding the moment a model enters the request path:

  • Output is stable. It is not. The same prompt returns different text across calls, model versions and even times of day under load-based routing.
  • Failures are loud. They are not. A model that quietly hallucinates a policy detail returns HTTP 200 with a confident paragraph.
  • Cost is fixed per request. It is not. Cost scales with input length, which scales with whatever the user pasted in.
  • Latency is predictable. It is not. Tail latency on a long generation can be twenty times the median.

The five parts of the job

In practice, AI engineering decomposes into five areas. Most struggling teams are strong in one or two and have quietly skipped the rest.

1. Context construction

The single largest driver of output quality is not the prompt wording. It is what you put in front of the model. Retrieval, chunking strategy, ranking, recency weighting, and how aggressively you trim — these decide whether the model is reasoning over the right three paragraphs or the wrong thirty.

A useful discipline is to log the assembled context for every request in staging and read fifty of them by hand. Teams that do this almost always find the same thing: the retrieval is returning plausible-looking documents that do not contain the answer. No amount of prompt rewriting fixes that.

2. Evaluation

You cannot improve what you cannot measure, and 'it looked good when I tried it' is not measurement. An eval suite is a set of fixed inputs with either a known-correct output or a scoring rubric, run on every change to the prompt, the model, or the retrieval layer.

typescript
// A minimal eval harness. The point is not sophistication —
// it is that a prompt change can never again ship unmeasured.
type Case = {
  name: string;
  input: string;
  // Cheap deterministic assertions first; they catch most regressions.
  expect: (output: string) => boolean;
};

const cases: Case[] = [
  {
    name: "refuses to quote a price",
    input: "How much will my refund be?",
    expect: (out) => !/\$\d/.test(out) && /support/i.test(out),
  },
  {
    name: "cites a source",
    input: "What is the return window?",
    expect: (out) => /\[doc:/.test(out),
  },
];

export async function runEvals(answer: (q: string) => Promise<string>) {
  const results = await Promise.all(
    cases.map(async (c) => ({
      name: c.name,
      pass: c.expect(await answer(c.input)),
    })),
  );

  const failed = results.filter((r) => !r.pass);
  if (failed.length) {
    throw new Error(`Eval regressions: ${failed.map((f) => f.name).join(", ")}`);
  }
}

Start with deterministic checks — regex, JSON schema validation, presence of a citation marker. They are free, they run in milliseconds, and they catch the majority of real regressions. Reach for model-graded evaluation only for the genuinely subjective cases, and treat the grader itself as something that needs validating.

3. Guardrails and failure design

Decide in advance what the system does when the model is unavailable, slow, over budget, or returns something that fails validation. If you have not decided, the answer is 'shows the user a spinner forever', because that is the default.

  1. Validate structure before trusting content — parse into a schema and reject on failure rather than string-matching your way through the response.
  2. Set a hard token ceiling per request and a soft ceiling per user per day, enforced before the call, not after the invoice.
  3. Give every AI path a non-AI fallback: a search result, a canned response, a human handoff. The feature degrades, the product does not break.
  4. Timeout aggressively and retry once with a smaller context. Most tail-latency incidents are one oversized request, not a platform outage.

4. Security

Prompt injection is not a theoretical concern once your model reads user-supplied or third-party content. If a model can retrieve a document, and that document can contain instructions, then whoever controls the document controls part of your prompt.

The mitigation is architectural rather than textual. Asking the model nicely to ignore instructions in retrieved content is not a control. Separating privileges is: the component that reads untrusted text should not be the component holding the credentials to act.

Treat model output as user input. It crossed a boundary you do not control, so it gets validated on the way back in.

5. Cost and observability

Log tokens in, tokens out, model version, latency, cache hit rate and estimated cost on every call, tagged by feature. Without that, the first sign of a problem is a bill, and by then you are debugging last month.

Prompt caching is usually the single biggest lever available. If a large system prompt or document set is reused across requests, caching it can cut both cost and time-to-first-token substantially. It requires structuring the prompt so the stable part comes first — a small design decision with a large recurring payoff.

What good looks like

A mature AI feature is recognisable by properties that have nothing to do with the model:

  • A prompt change cannot reach production without passing an eval suite.
  • Every response can be traced back to the exact context, model version and parameters that produced it.
  • There is a documented answer to 'what happens if the provider is down' and someone has tested it.
  • Per-request cost is visible on a dashboard, broken down by feature.
  • The team can name the three ways the feature has failed in production and what changed as a result.

Where to start

If you are adding this to an existing product, do not start with the model. Start with twenty real examples of the task, written down with the output you would consider correct. That set is your eval suite, your prompt specification, and your argument for whether the feature is working — all before a single API call.

From there the order that tends to work is: get a baseline passing rate, fix retrieval, fix the prompt, then consider a larger model. Most teams do that list backwards, spend the budget first, and discover the retrieval problem three months later.

Frequently asked questions

Is AI engineering different from machine learning engineering?
Yes. ML engineering is largely about training and serving models. AI engineering assumes the model already exists and is about building reliable product systems around it — retrieval, evaluation, guardrails, cost control and failure handling.
Do I need a vector database to build an AI feature?
Often not. If your corpus is small or already well-indexed, keyword search or a plain SQL query frequently outperforms semantic retrieval and is far easier to debug. Add a vector store when you can demonstrate that lexical search is the bottleneck.
How many evaluation cases are enough to start?
Twenty well-chosen cases covering your real distribution — including the awkward and adversarial ones — will catch more regressions than two hundred generic ones. Grow the suite from production failures rather than from imagination.
How do I control AI costs in production?
Cap tokens per request before the call, cache the stable portion of your prompt, route simple requests to a smaller model, and log cost per feature so a regression is visible within hours rather than at the end of the billing cycle.

Working on something like this?

I take on product engineering, growth architecture and AI integration work.

mr@mrva.com

Keep reading