Skip to content

AI Engineering Starts with the System, Not the Prompt

By Maksym Kuzmitskyi
7 min read
AI Engineering Starts with the System, Not the Prompt

AI Engineering Starts with the System, Not the Prompt

Ask a documentation assistant whether a release needs approval. It gives you a clear answer and a reference to the release policy.

The reference points to last year's policy. The answer sounds perfectly reasonable.

This is a fictional example, but it contains most of what interests me about AI engineering. The text generation worked. The feature still failed at its job.

Changing "be accurate" to "be very accurate" in the prompt, the input given to the model, doesn't establish which policy the system used or whether the reader could access it. Those are properties of the application around the model.

That application is what I want to understand and build. Preferably without needing twelve new product names before the first useful example.

Two different uses of AI

An engineer can use an AI assistant to write a perfectly ordinary search endpoint. Once deployed, the endpoint executes a database query. No model participates in serving the request.

That is AI-assisted software development: AI helped produce the software.

A documentation assistant that generates an answer for each question has a different dependency. Its deployed behavior includes a model. Someone has to decide what information reaches that model, what it may ask other services to do, and how to handle an answer that is fluent but unsupported.

For this playbook, AI engineering means application engineering around existing generative models: models that produce outputs such as text or code. The broader field includes other systems. This is a working scope, not a universal job definition.

Training changes a model's learned parameters. Inference uses a trained model to produce an output. This series concerns the application around inference, not training a general-purpose model from scratch.

An LLM, or large language model, is the text-and-code-oriented model we'll mostly work with. It can produce useful answers. Its output still needs to fit the application's requirements.

These distinctions aren't competing levels of professional seriousness. They describe different things: how software was made, and what it depends on when it runs.

Vibe coding is not the opposite of typing everything yourself

I find Simon Willison's distinction useful: accepting generated code without reviewing or understanding it is different from using a model while retaining engineering responsibility.

A disposable prototype can be a reasonable place to explore without inspecting every detail. This isn't an argument about who counts as a developer.

The boundary changes when other people depend on the result. If generated code reads private documents, sends requests or changes stored data, "it seemed to work" leaves rather a lot unexamined.

But reviewing generated code doesn't, by itself, make a deployed AI feature reliable either. You can understand every line of the application and still feed the model an obsolete policy.

That is the distinction I want to keep. AI-assisted coding concerns the development process. AI engineering also concerns the behavior of the system that remains after the coding session ends.

Give the assistant one small job

The teaching example for this series is a fictional repository-question assistant. Its first job is to answer questions from supplied documentation and say when the evidence is insufficient. It cannot change a repository or approve a release.

For now, the documents can be a small array. We don't need a specialized search service to discover that we supplied the wrong policy.

The application selects some source text and includes it with the question in a model request. The information available for that request is its context. A file existing somewhere in the repository doesn't automatically make it part of that context.

The model returns a candidate answer with source identifiers. A source identifier is just an application-assigned label connecting an answer to a supplied document. It is not proof that the document supports the answer.

That gives ordinary code something useful to check.

Check the part that doesn't require a model

Here is a deliberately small TypeScript boundary. It checks references, not truth:

type Source = { id: string; text: string; }; type CandidateAnswer = { text: string; sourceIds: string[]; }; type ReferenceCheck = | { status: 'rejected'; reason: string } | { status: 'references-checked'; candidate: CandidateAnswer }; function checkReferences( candidate: CandidateAnswer, suppliedSources: readonly Source[], ): ReferenceCheck { if (!candidate.text.trim()) { return { status: 'rejected', reason: 'Empty answer' }; } if (candidate.sourceIds.length === 0) { return { status: 'rejected', reason: 'No source references' }; } const suppliedIds = new Set(suppliedSources.map((source) => source.id)); const hasUnknownSource = candidate.sourceIds.some((id) => !suppliedIds.has(id)); if (hasUnknownSource) { return { status: 'rejected', reason: 'Reference was not supplied' }; } return { status: 'references-checked', candidate }; }

These are already-typed application values. Raw model output needs runtime validation; TypeScript doesn't inspect incoming JSON. That boundary deserves its own article, not an imaginary parser hidden behind a type cast.

Now supply one document and two candidates. This is an offline fixture, not a model response or an evaluation of model quality:

const suppliedSources: Source[] = [ { id: 'release-policy-v3', text: 'Production releases require a successful build and human approval.', }, ]; const inventedReference = checkReferences( { text: 'Approval is optional.', sourceIds: ['release-policy-v1'] }, suppliedSources, ); const unsupportedClaim = checkReferences( { text: 'Approval is optional.', sourceIds: ['release-policy-v3'] }, suppliedSources, );

The invented reference is rejected. The unsupported claim gets references-checked because its source identifier exists.

That second result is intentional. Calling it verified would make the function's name a larger claim than its implementation.

A valid reference can still support a bad answer

Our check establishes a narrow fact: each cited identifier was among the sources supplied. It doesn't establish that the answer follows from those sources, that the sources are current, or that selecting them respected the user's access rights.

Those questions need their own mechanisms. Current-document selection belongs in the data path. Access control belongs at a trusted application or service boundary. Whether an answer is supported needs a quality check that can actually examine that relationship.

An evaluation, often shortened to eval, measures behavior against explicit criteria on selected cases. For this assistant, a useful case would pair the policy above with a question and an expectation that the answer must not say approval is optional. A different case would contain no relevant policy and expect the system to decline to answer.

One passing case isn't general reliability. It gives us a result to compare when the prompt, documents or model change.

I would keep the reference check even after adding those evaluations. There is no benefit in asking a model to judge something a set lookup can reject exactly.

An agent is optional

Nothing so far requires an agent. The application can retrieve documents, make one model request and examine the result through a fixed sequence.

Anthropic's workflow/agent distinction is useful here: a workflow follows predefined code paths, while an agent lets a model direct more of the next steps and tool use. The terminology varies between products, but the control-flow question is concrete.

If the assistant can choose to search another source, examine the result and decide what to do next, we have introduced a loop with model-directed choices. A tool is an operation the surrounding application can execute on the model's request. The model doesn't gain permission to execute it merely by requesting it.

That flexibility can help. It also introduces more calls, more state and more ways to continue after the sensible stopping point. I'd add it when the task needs that flexibility, not to improve the architecture's vocabulary.

The answer is only one part of the feature

The Agent Playbook describes working with coding agents. This series starts on the other side: building the system that receives the request and owns the consequences of its answer.

Not every piece is a mandatory purchase. Some questions need a database query, some need document search, some need an agent. Plenty need less machinery than the diagram suggests.

The next question is smaller than any of those choices: what exactly does the model receive on one call? Until that is clear, context and memory are easy words to use for behavior the application hasn't actually implemented.

The release-policy answer at the beginning might still sound convincing. I would rather have a system that can show why it used that policy, notice when the evidence is missing, and leave the approval decision where it belongs. A more confident sentence is a much smaller improvement.

Where does your prototype stop being easy to trust: selecting the evidence, using a tool, or deciding that the answer is good enough? I'd be interested in the first boundary you had to make explicit.

A note from the author

I’m Maksym Kuzmitskyi, a senior software developer working mainly with React and TypeScript. I build frontend applications and design workflows for working with AI in software delivery. If this article connects with something you’re working on, I’d love to hear from you.

Telegram

More than a blog post

I share frontend news and the reasoning behind it throughout the day. Pick the language that feels natural to you.

Need to discuss your project? Get in touch.