The Builder’s Road
From using AI to making with it: what this track will have you build, what to install, how to keep your keys safe, and a first seventeen-line program that guesses the next word.
Every chat assistant you have used is, underneath, a program sending text to a model and printing what comes back. The surprising thing is how little code that takes. The hard parts — choosing what to send, checking what returns, keeping it safe and affordable — are craft, not magic. This track is where you stop being only a user and start being a builder. You do not need to be a programmer yet. You need patience, a computer, and a willingness to read error messages slowly.
Who this track is for
The Builder track is for three kinds of reader. The first has finished the Practitioner track and keeps thinking “I wish I could make it do this automatically.” The second is a developer who writes software for a living but has never trained a model or called a language-model API. The third is an analyst — finance, operations, research, public service — who lives in spreadsheets and wants to go further than a spreadsheet allows.
The first pages assume no coding at all. By the end you will have written real machine learning code and a small application built on a large language model. You will not need university mathematics here; that waits for the Advanced track.
This guide’s framing We teach classic machine learning before language-model APIs on purpose. Splitting data, measuring error and spotting overfitting are the habits that keep LLM applications honest too; skipping them is how people ship demos that fall over in real use.
What you will build
The track has eleven more pages. Here is the road, in order — tap a title to open it:
- Python essentials for AIJust enough Python — variables, lists, dictionaries, loops, functions and reading files — to follow every later page.
- Working with dataNumPy for arrays of numbers, pandas for tables, and the unglamorous art of cleaning messy, real-world data.
- The machine learning workflowSplit your data, train, evaluate on a held-out test set, and iterate — the loop behind every model.
- Classic modelsLinear and logistic regression, decision trees, nearest neighbours and clustering, using scikit-learn.
- Measuring modelsAccuracy, precision, recall and why a 99% accurate model can still be useless.
- Calling LLM APIsMessages, tokens, streaming responses and how to estimate and control cost.
- Embeddings and semantic searchTurning meaning into lists of numbers so a program can find “similar” text.
- Retrieval-augmented generationGrounding a model’s answers in your own documents, with citations you can check.
- Tool use and agentsLetting a model call functions you write — safely, with limits and logs.
- Shipping an AI appA simple interface, deployment, monitoring and guardrails.
- Builder capstoneDesign, build and ship your own small assistant from start to finish.
Each page builds on the ones before it, so work through them in order the first time.
Setting up your workshop
You need four things. None costs money.
PyPython 3The language of AI work
Python dominates machine learning because its libraries — NumPy, pandas, scikit-learn, PyTorch — are excellent and free. Install a recent Python 3 release from python.org As of 2026. On Windows, python.org now steers you to its Python install manager; if you use the traditional installer instead, tick “Add python.exe to PATH”. Either way, the command on Windows is usually py or python rather than python3. On macOS and Linux, Python 3 may already be present: try python3 --version in a terminal.
VSAn editor: VS CodeWhere you write files
Visual Studio Code is a free editor from Microsoft with a Python extension that adds colouring, error hints and a run button. Any decent editor works; this one is simply very widely used, so most tutorials assume it.
NBJupyter or Google ColabExperiment cell by cell
A notebook lets you run a few lines, see the result, and keep notes beside it. Jupyter runs on your own computer; Google Colab runs in your browser with nothing to install and offers limited free access to a GPU As of 2026. Colab is the gentlest start; local Jupyter is better once your data is private.
.venvVirtual environmentsOne box per project
A virtual environment is a folder holding the exact packages one project needs, so upgrading a library for project B cannot break project A. Make one per project; it costs seconds and saves hours.
Here is the whole set-up in a terminal. Lines beginning with # are comments.
# make a project folder and a virtual environment inside it
mkdir ai-builder
cd ai-builder
python3 -m venv .venv
# on Windows: py -m venv .venv
# switch it on (macOS / Linux)
source .venv/bin/activate
# on Windows PowerShell instead: .venv\Scripts\Activate.ps1
# (if PowerShell refuses to run scripts, see the venv documentation linked below)
# install the libraries this track uses
pip install numpy pandas scikit-learn jupyter
# store an API key for this terminal session (never in a file you share).
# Typed commands are also saved in your shell's history file, so for regular
# use keep keys in a .env file that is listed in .gitignore.
export MY_LLM_API_KEY="paste-key-here"
# Windows PowerShell: $env:MY_LLM_API_KEY = "paste-key-here"
Handling API keys safely
Later pages call language models through a paid service. The service gives you an API key: a long secret that proves who you are and charges your account. Anyone who has it can spend your money. Keys pasted into code end up on GitHub, where automated scanners find them within minutes. So follow three rules from day one:
- Keep keys in environment variables (or a
.envfile that is listed in.gitignore), never typed into your code. - Never paste a key into a chat — not into an AI assistant, not into a forum post, not into a screenshot asking for help.
- Set a spending limit on your account and revoke any key you suspect has leaked. Revoking is instant; regret is not.
Your Python code then reads the key from the environment:
import os
api_key = os.environ.get("MY_LLM_API_KEY")
if api_key is None:
raise SystemExit("Set MY_LLM_API_KEY first - never write the key in this file.")
print("Key loaded, ending in", api_key[-4:]) # show only the last 4 characters
If you build with company data, check your organisation’s rules on which AI services are approved before sending anything to an external API. Test with made-up data until you are sure.
Your first AI-flavoured program
Before touching any API, let us build a tiny language model ourselves. It is a bigram model — an n-gram model with n = 2: it learns which word tends to follow which, then guesses the next word by rolling weighted dice. This is, in miniature, the same job a large language model does: predict the next token. The difference is that an LLM looks at thousands of previous tokens with billions of parameters; ours looks at one word with a table of counts.
import random
from collections import Counter, defaultdict
text = """the cat sat on the mat . the dog sat on the rug .
the cat saw the dog . the dog chased the cat ."""
words = text.split()
followers = defaultdict(Counter)
for current, nxt in zip(words, words[1:]):
followers[current][nxt] += 1
print(followers["the"].most_common(3))
def guess_next(word):
counts = followers[word]
return random.choices(list(counts), weights=counts.values())[0]
word, sentence = "the", ["the"]
while word != "." and len(sentence) < 12:
word = guess_next(word)
sentence.append(word)
print(" ".join(sentence))
Line by line:
- Imports.
randomrolls the dice;Countercounts things;defaultdictis a dictionary that creates an empty entry the first time you mention a new key. textis our whole training data — two lines. The full stops are separated by spaces so they count as “words”, which gives the model a way to end a sentence.words = text.split()breaks the text at spaces and line breaks into a list:["the", "cat", "sat", …]. This is the crudest possible tokeniser.- The
forloop walks through every neighbouring pair.zip(words, words[1:])lines the list up against itself shifted by one, giving (“the”, “cat”), (“cat”, “sat”) and so on. For each pair we add one to the count of next after current. That loop is the entire “training”. - The first
printshows what the model learned about “the”:[('cat', 3), ('dog', 3), ('mat', 1)]. guess_nextlooks up the counts for a word and picks a follower at random, weighted by the counts — so “cat” is three times as likely as “mat”. This is sampling, the same idea as temperature in a chat model.- The
whileloop starts at “the” and keeps guessing until it produces a full stop or reaches 12 words. Run it a few times: you will get “the cat sat on the rug .” and also nonsense like “the cat saw the cat sat on the dog .”
That nonsense is the lesson. With one word of memory, the model is locally fluent and globally confused. Give it a longer memory, far more text and learned representations instead of raw counts, and you are on the road that led to GPT. Try swapping text for a few paragraphs of your own writing, or a public-domain book, and watch the output become more stylish and no more sensible.
Where should your API key live while you develop?
Code gets shared and chats get logged; environment variables stay on your machine and out of version control.
In the bigram program, what counts as “training”?
The counts are the model’s learned knowledge; sampling uses them afterwards.
Why make a virtual environment for each project?
Isolation is the point; speed is unchanged and Python runs fine without one — until two projects disagree.
How to practise
People who learn to build with AI tend to share a few habits.
- Make tiny things that work, often. A script that sorts your downloads folder, a word counter for your essays, a model that predicts house prices from a public dataset. Finished and small beats ambitious and abandoned.
- Read the error, bottom line first. Python’s traceback ends with the error type and message (
KeyError: 'cat'); the lines above show where it happened. Most beginner errors are spelling, indentation or a missing import. - Use an AI coding assistant — as a tutor, not a ghostwriter. Ask it to explain an error, suggest a test, or review your code. If it writes code for you, make sure you can explain every line before you run it; if you cannot, ask it to explain, then rewrite the code yourself. Assistants confidently invent library functions that do not exist, so run and test everything. And never paste secrets or confidential data into the chat.
- Keep a log. A plain notes file of what you tried, what broke and what fixed it becomes your personal manual.
- Use version control early. Learning Git basics lets you experiment boldly, because you can always go back.
The goal is not to type code quickly. It is to be able to look at a program — yours, a colleague’s or an AI’s — and say with confidence what it does and how you would check it.
Free resources to lean on
These pair well with this track; all are free to use.
- The official Python tutorial — terse but authoritative.
- Al Sweigart, Automate the Boring Stuff with Python — free online, built around practical everyday scripts.
- Kaggle Learn — short, hands-on micro-courses in Python, pandas and machine learning, run in the browser.
- CS50’s Introduction to Artificial Intelligence with Python (Harvard) — free lectures and projects once you are comfortable with Python.
- The scikit-learn user guide — the reference for classic models, full of clear examples.
For a longer list sorted by level, see Courses, Books and Resources.
Set up a project folder with a virtual environment, run the bigram program, then change it so it starts from a word you choose and prints five different sentences. Bonus: make followers remember the previous two words (a trigram model) and compare the output.
// Pause and reflect
- What is one small, boring task in your work or study that a twenty-line program could do for you?
- Which of the three API-key rules would you have been most likely to break, and how will you remind yourself?
- How will you use an AI coding assistant without letting it do your understanding for you?
Your notes are saved privately in this browser.
Key terms on this page
Sources & further reading
- Python Software Foundation, venv — Creation of virtual environments (Python documentation).
- Claude Shannon, “A Mathematical Theory of Communication”, Bell System Technical Journal (1948) — the first n-gram text generation experiments.
- Daniel Jurafsky & James H. Martin, Speech and Language Processing, 3rd edition draft — chapter on n-gram language models (free online).
- GitHub Docs, About secret scanning — why committed keys are found quickly.
- Al Sweigart, Automate the Boring Stuff with Python, 3rd edition (No Starch Press, 2025; free to read online).