🧠

AI Engineering

Build the deterministic engineering around language models — tokenizers, retrieval, MCP tool routers, and agents — all running for real in your browser.

📚 53 lessons 🧩 10 phases ▶ Runs real JavaScript code
Start learning →

A hands-on AI engineering course for the era after 'how do I call the API' became free. Instead of watching a model generate text, you build the infrastructure that makes AI features shippable: a tokenizer, a retrieval pipeline, a Model Context Protocol router, an agent loop, a token budgeter, and an eval harness. Every exercise is deterministic JavaScript that actually runs and is verified — no live model, no faked output, no per-token bill.

Module 1 · Why AI Engineering Is Engineering

What large language models did and did not commoditise, and why the durable, hireable skill in 2026 is the deterministic system you build AROUND the model — not the prompt you type into it.

  1. What AI Commoditised — and What It Did Not 18 min
  2. The Shape of a Real AI System 18 min
  3. The Deterministic Shell Around a Non-Deterministic Core 18 min
  4. When NOT to Use a Language Model 19 min
  5. Your First Cost & Latency Budget 19 min

Module 2 · Tokens, Context Windows & Cost

The unit of everything in generative AI is the token. Build a tokenizer, count context, model a bill, and see why 'it worked in the playground' and 'it is affordable in production' are different sentences.

  1. What a Token Actually Is 19 min
  2. Build a Byte-Pair-Encoding Tokenizer 19 min
  3. Context Windows and What Falls Off the Edge 19 min
  4. Modelling the Bill: Input vs Output Tokens 16 min
  5. Lost in the Middle: Position Matters 16 min

Module 3 · Embeddings & Semantic Search

Before retrieval, meaning must become geometry. Build vector similarity, a tiny index, and the chunking decisions that quietly determine whether search finds the right thing.

  1. What an Embedding Is 18 min
  2. Cosine Similarity from Scratch 16 min
  3. Build a Tiny Vector Index 18 min
  4. Chunking: The Decision That Makes or Breaks Retrieval 19 min
  5. Where Semantic Search Silently Fails 18 min

Module 4 · Retrieval-Augmented Generation (RAG)

RAG is the workhorse pattern of production AI. Build the full pipeline — index, retrieve, rerank, cite — and study the failure modes that make naive RAG return confident nonsense.

  1. The RAG Pipeline, End to End 18 min
  2. Retrieve, Then Rerank 18 min
  3. Grounding and Citations 18 min
  4. Why Naive RAG Returns Confident Nonsense 18 min
  5. Measuring Whether Retrieval Actually Works 18 min

Module 5 · Prompting & Context Engineering

Prompt engineering became context engineering: the job is assembling the right information, in the right order, within a budget. Build the packer, the structured-output validator, and the guards.

  1. From Prompt Engineering to Context Engineering 17 min
  2. Making Models Return Parseable Structure 17 min
  3. Packing a Context Window Under Budget 17 min
  4. Few-Shot Examples and Prompt Templates 18 min
  5. Conversation Memory and Summarisation 18 min

Module 6 · The Model Context Protocol (MCP)

MCP is how agents get a clean, versioned set of tools in 2026 — and it is just JSON-RPC. Implement the message framing, the handshake, and a working router, then reason about the two transports and where each belongs.

  1. Why MCP Exists 18 min
  2. JSON-RPC: The Wire Format Under MCP 18 min
  3. The Initialize Handshake and Capability Negotiation 18 min
  4. Tools, Resources, and Prompts: What a Server Offers 18 min
  5. Build a Working MCP Message Router 18 min
  6. The Two Transports: stdio vs Streamable HTTP 18 min

Module 7 · Tools, Skills & Plugins

How you actually extend a model: tool schemas, discovery, dispatch, and the sandboxing that stops a tool call from becoming an incident. Build the dispatch loop and the guards around it.

  1. The Anatomy of a Tool Definition 18 min
  2. The Tool-Dispatch Loop 18 min
  3. Discovery: Finding the Right Tool 18 min
  4. Skills and Progressive Disclosure 17 min
  5. Sandboxing: Least Privilege for Tools 17 min
  6. Tools Across Environments 17 min

Module 8 · Agents & Multi-Agent Orchestration

An agent is a state machine with tools and a stopping condition — not magic. Build the loop, then coordinate several agents with supervisor-worker handoffs, failure recovery, and loop-guards.

  1. An Agent Is a State Machine 18 min
  2. Build the Agent Loop with a Stop Condition 18 min
  3. Supervisor-Worker Orchestration 18 min
  4. Handoffs and Shared State 18 min
  5. Failure Recovery and Retries 18 min
  6. Excessive Agency: The Senior-Level Failure Mode 18 min

Module 9 · Token Economics: Caching, Routing & Savings

Cost work is what keeps AI features alive in production. Build a cache, a model router, and the savings math that turns a feature that gets killed into one that ships.

  1. Where the Money Actually Goes 18 min
  2. Caching: Don't Pay Twice for the Same Answer 18 min
  3. Model Routing: Right-Sizing Each Call 18 min
  4. Batching, Truncation, and Compression 18 min
  5. Proving the Savings 18 min

Module 10 · Safety, Evaluation & Capstone

Ship responsibly: filter injection, measure with evals instead of vibes, and assemble everything into a graded, deterministic AI system you built end to end.

  1. Prompt Injection: Direct and Indirect 19 min
  2. Guardrails: Validating Inputs and Outputs 19 min
  3. Evaluation: If You Can't Measure It, You Can't Ship It 19 min
  4. Observability: Tracing an AI Request 18 min
  5. Capstone: A Deterministic Mini Agent Platform 18 min