AI engineering / Beginner / 01.01
What is an AI Engineer?
An AI engineer builds products on top of ready-made AI models. Meet the job, and build your first safe wrapper around a model.
10 min readFree
Welcome to the course
Welcome. This is the first lesson of a free course on AI engineering, and you do not need any machine learning background to follow it. If you can read a little Python, you are ready.
Here is where we are headed. By the end of the course you will be able to build a small product that uses an AI model: it takes a question, finds the right facts in your own notes, asks the model, checks the answer, and stays safe when something goes wrong. You will also know how to test it and how to keep its cost and speed in hand.
This first lesson is the map. We will look at what the job is, what an AI engineer is responsible for, how AI changes the way products get built, and how this job differs from its close cousin, the machine learning engineer. Then you will run your first piece of code.
Key words
- AI model
- A program that was trained on lots of examples and can now answer, write or predict. A chat model is one kind.
- Prompt
- The written instructions and question you send to a model.
- API
- A set of agreed doors one program uses to talk to another. Your app sends a request through the API, and the model's service sends back an answer.
- Token
- A small piece of text, often a word or part of a word. Models read and are charged for text in tokens.
- Hallucination
- A confident answer from a model that is simply wrong or made up.
- Fallback
- A safe plan B that your product uses when the main step fails.
Introduction: what an AI engineer does
An AI engineer builds products on top of ready-made AI models. Think of a chef in a restaurant who buys flour instead of growing wheat. The model is the flour. The AI engineer turns it into a meal people can order.
KDnuggets draws the line like this: for an AI engineer the model "already exists, usually a large model someone else trained and exposed through an API". The job is to connect that model to a real product, such as a support tool, a search feature inside a company, or an agent that completes a task with several steps.
It is not a new idea that a model can be used just by asking it. Wikipedia describes prompt engineering as "the process of structuring natural language inputs (known as prompts) to produce specified outputs from a generative AI model". An AI engineer goes much further than writing one good prompt, though. They build the whole product around it. In daily life, the prompt is the order you give the waiter, and the engineer designs the kitchen.
Five jobs fill most of the day. Each one is a topic in this course.
- 1
Call a model
Send a prompt to a model and read the answer, through code instead of a chat window.
- 2
Give it the right context
A model only knows what you put in front of it. You choose which facts, notes and instructions go in with each question.
- 3
Check its answers
Never trust a reply blindly. You test it before users see it, and again once it is live.
- 4
Keep cost and speed in hand
Every call takes time and uses tokens that cost money. You watch both.
- 5
Ship it safely
Plan for failure, wrong answers and people who try to trick the system.
Tip
Tokens are the unit of cost, so they matter early. The Tokenization lesson in Machine Learning Foundations goes deeper. Here, just remember that more text in means more tokens, and more tokens means more cost.
Quick check
What is the main job of an AI engineer?
Roles and responsibilities
Dataquest, a learning site for data skills, lists what a typical week looks like for an AI engineer. We keep its four groups here, and add what Chip Huyen's essay on building generative AI platforms says about the pieces around a model.
Design the system
Choose a model, write prompts, define structured outputs (answers in a fixed shape, so code can read them), and decide when the model should call tools or look up information.
Ground it in real data
Build retrieval pipelines that pull the right documents from a vector database, so answers come from the company's own documents instead of guesswork.
Evaluate and operate it
Build test sets and use a second model to grade the first one's answers, then ship the system, handle cost and latency (how long a reply takes), and defend against prompt injection.
Huyen's essay, from July 2024, describes a common set of building blocks around a model: added context, guardrails, a cache to cut latency and cost, and observability, which means being able to see what the system is doing. She notes that you do not need to follow the exact same order, and a component can be skipped if the system works well without it. She also says evaluation is "necessary at every step of the development process".
A word of honesty from KDnuggets: people often take the job expecting to train models, then spend most of their time fixing data pipelines and rewriting prompts. That is the real job, and it is a good one.
Impact on product development
Ready-made models change how a product team works. Three changes stand out.
Faster first versions
The Latent Space essay "The Rise of the AI Engineer" says tasks that took five years and a research team in 2013 "now just require API docs and a spare afternoon in 2023". A prototype can exist by the end of a day.
New ways to fail
Wikipedia says large language models can produce text that seems fluent and natural but is factually incorrect or unfaithful to the source. It also describes prompt injection, where a user writes messages that appear to come from the developer, and some safeguards can be overcome.
Answers that can change
Wikipedia notes prompts are brittle: small changes in wording, punctuation or word order can produce dramatically different outputs, even when the meaning is the same. Your tests have to expect that.
Think of ordinary software as a vending machine: press B4 and you get the same snack every time. A model is closer to asking a helpful stranger. Usually the answer is great, but now and then it is odd, and you cannot predict which time. So an AI engineer adds checks around the model, the way a shop adds a manager who looks at things before they leave the building.
Your first wrapped model
Let us build a tiny product feature the way an AI engineer would. A shop wants a one-line summary of each customer review, to show at the top of the page.
Important: the code below does not use a real model. It has a stand-in called fake_model that follows fixed rules, so the code runs for free and gives the same answer every time. A real model is slower, costs money for every token, can give a different answer each run, and can fail or refuse. The stand-in only lets us practise the wrapper, and the wrapper is the part you will keep when you plug in a real one.
- 1
Check the input
Stop at once if the review is empty, or too long for what we are willing to pay for.
- 2
Call the model
Wrap the call so that a crash does not break the page.
- 3
Check the answer
Reject a blank answer or one that is too long to be a summary.
- 4
Fall back safely
If any check fails, show a plain safe message instead of an error.
MAX_INPUT = 200
MAX_SUMMARY = 60
FALLBACK = "Summary not available. Please read the full review."
def fake_model(review):
# Stand-in: fixed rules, no real AI. It keeps the first sentence
# and cuts it to 12 words.
first = review.split(".")[0]
words = first.split()
return " ".join(words[:12])
def summarise(review):
text = review.strip()
if not text:
return FALLBACK, "input was empty"
if len(text) > MAX_INPUT:
return FALLBACK, "input too long"
try:
answer = fake_model(text)
except Exception:
return FALLBACK, "model call failed"
if not answer.strip():
return FALLBACK, "answer was blank"
if len(answer) > MAX_SUMMARY:
return FALLBACK, "answer too long"
return answer, "ok"
reviews = [
"The jacket fits well and the zip feels strong. Delivery took a week though.",
" ",
"Great sound. Battery lasts all week. The case is a bit loose.",
]
for r in reviews:
summary, status = summarise(r)
print(status + " | " + summary)Output
ok | The jacket fits well and the zip feels strong input was empty | Summary not available. Please read the full review. ok | Great sound
Read the three lines of output. The first review passed every check, and the stand-in kept its first sentence, cut to 12 words. The second review was only spaces, so the wrapper stopped before the model was ever called, which saved a call that would have cost money. The third passed too, though the stand-in gave a very short summary, "Great sound", because the first sentence is short. The checks cannot tell whether a summary is good, only whether it is usable. That is why later lessons cover testing.
Now a made-up sum, to see why the input check matters. Say a call costs 3 coins for every 1,000 tokens. These coins are invented for the sum, not a real price. If a shop sends 100,000 tokens a day, that is 100 times 3, so 300 coins a day. Blocking empty and oversized reviews cuts that bill without changing the product.
Tip
Notice what the code does not do: it never trusts the model. Every call is followed by a check. This habit is the heart of the job.
AI engineer vs ML engineer
A machine learning engineer trains models and serves them: they gather data, train, test, deploy and retrain. KDnuggets says this engineer builds and trains a model from data. The ML Engineer vs AI Engineer lesson in Machine Learning Foundations walks through this side by side, so we will not repeat it here.
An AI engineer mostly builds with models that already exist. Dataquest sums up the difference in a line: if a job post asks for LLM APIs, RAG (finding facts and handing them to the model) and vector databases, it is an AI engineering role. If it asks for model training, feature engineering and PyTorch, it is an ML engineering role, whatever the title says.
What this course covers
Here is the path, in plain words. Each stop is a skill you will use in the wrapper above.
- 1
Models and tokens
What a language model is, how it reads text in tokens, and what limits how much it can read at once.
- 2
Prompts and context
How to write clear instructions, and how to choose what goes in with each question.
- 3
Retrieval from your own notes
How to let a model answer from your documents instead of its memory.
- 4
Tools and agents
How a model can use tools and take several steps toward a goal.
- 5
Testing and safety
How to check answers, spot failures early, and defend against tricks.
Quick check
In the wrapper, why was the empty review stopped before the model call?
Next: AI vs AGI, and why today's tools are narrow.
Sources
Last updated on 16 November 2026
Learn with me
Every lesson is free. I add new ones as I learn. Have a question, or want help with your own work? Book a short call.