Module 11A: Projects

Production1 projects0 of 1 complete

Starter projects are guided step by step and suit freshers. Stretch projects are open-ended, add production concerns, and suit experienced readers.

One project: an optional stretch, the operations pack. It runs keylessly. The module's code is pure Python: traces go to JSONL files and metrics to an in-memory backend, and the operations scripts are standard-library files that read the documents you write. No provider keys, no GPU, no cloud account, no services started. The starter project that wires this module's tracing and metrics into a service is in Module 11C's projects.

The building blocks. The pack uses the artefacts and scripts that the day-2 lesson 11C.4 ships, beside your llm-service project (uv init llm-service --bare --python 3.13, as in lesson 03.1, Part 4):

  • From 11C.4: the ops/ artefacts and the severity.py, incident_metrics.py, oncall.py and readiness.py scripts
  • From 11A.2: the metrics catalogue and the worked SLO document that the pack's ops/slo.md builds on

Do the pack after Module 11C (specifically 11C.4), when you know what the inventory, runbooks and checklist are protecting.


Stretch (optional)

Stretch (optional): Operations pack#

Goal: Write the day-2 operating system for your llm_service (or docs_qa): runbooks for the incident classes LLM services actually see, the system inventory, retention and deletion schedules, vendor files, the SLO document, and a filled production-readiness checklist — all keyless, all runnable.

What you'll practise:

  • What pages you and what doesn't; the incident lifecycle with contain-first ordering (lesson 11C.4, 1.2, 1.3)
  • The severity classifier and incident-command roles (11C.4, 1.4)
  • Writing runbooks for the nine incident classes: provider outage, rate-limit exhaustion, cost spike, quality regression, retrieval failure, prompt injection, PII leak, runaway agent, leaked key (11C.4, 1.5)
  • Kill switches, feature flags and degraded modes — and testing them before you need them (11C.4, 1.6)
  • Blameless postmortems with the LLM-specific contributing factors, and incident metrics (MTTR, repeat incidents) (11C.4, 1.7, 1.8)
  • Governance: the ai_inventory.yaml schema, change tiers, access control, audit logs, data classification, vendor files with DPAs/subprocessors/exit plans (11C.4, Part 2, 2.7)
  • The data lifecycle: retention per store, deletion across logs/traces/caches/index/backups/provider-side, residency and access reviews (11C.4, Part 3, 3.3)
  • Cost and quality governance cadences, reliability practices (SLO reviews, game days, DR RPO/RTO), team roles, on-call rotation and the LLMOps maturity model (11C.4, Parts 4–6)
  • The production-readiness checklist and launch review as a gate (11C.4, Part 7, 7.2)

Setup: Python 3.11+ stdlib only — severity.py, incident_metrics.py, oncall.py, readiness.py are self-contained scripts saved under scripts/ (or ops/scripts/). The artefacts live under ops/ beside your service, matching 11C.4's consolidated layout. Do this after the starter project so the inventory and SLO doc describe a real system.

Steps:

  1. Inventory first. Write ops/ai_inventory.yaml with one entry per AI artefact in your service: every prompt/template version, model alias and resolved snapshot, tool, retrieval index, eval suite and provider key — each with owner, purpose, data classes, provider, version, eval result and status (11C.4, 2.2). Anything you can't fill in is a governance gap; note it.
  2. Write the runbooks. For each incident class your service can actually hit, fill the lesson's skeleton — trigger, severity, owner, the eight steps — using your dashboards, flags and kill switches by name (11C.4, 1.5). Start with the three most likely (provider outage, cost spike, quality regression) plus leaked-key; aim for five to nine total. Where you must write "check with the team", that's a runbook gap to fix.
  3. Wire the kill switches. For each feature, tool, tenant and model route, name the flag that disables it and the degraded path that serves instead (cached answer, smaller model, retrieval-only, honest queue) (11C.4, 1.6). Then test each switch once — an untested kill switch is a hypothesis.
  4. Data lifecycle. Write ops/retention_schedule.yaml: for every store your system writes user data to — request logs, traces, feedback, eval datasets, vector index, caches, prompt registry, backups, provider-side storage — the retention period and the mechanism that enforces it (11C.4, 3.2). Write the deletion runbook covering all of them (3.3) — hashed user IDs still count.
  5. Vendor files. For each provider/gateway/observability vendor, fill the file: contract/DPA status, certifications actually seen, subprocessors, data posture (training/retention/ZDR/regions), SLA, exit plan, review cadence (11C.4, 2.7). Answer the exit question honestly: can you leave your most critical vendor in 30 days?
  6. SLO and cost governance. Write ops/slo.md from your 11A.2 metrics: SLIs, targets, error-budget policy, page-vs-ticket routing. Add the cost section: budgets, per-tenant caps, unit economics review cadence, price-change monitoring (11C.4, 4.1, 4.2).
  7. Run the scripts. Create incidents.jsonl (real or plausible incidents), run python3 scripts/severity.py incident.json on three crafted incidents (one SEV1, one SEV3, one borderline) and python3 scripts/incident_metrics.py incidents.jsonl; run python3 scripts/oncall.py --people ... --weeks 4 for your team size and check the coverage output (11C.4, 1.4, 1.8, 6.2).
  8. Tabletop and gate. Walk one scenario from the lesson's exercise library against your runbooks, timed, and record where you got stuck (11C.4, 5.2). Then fill ops/readiness_checklist.json honestly — gate items block, track items need owner+date — and run python3 scripts/readiness.py ops/readiness_checklist.json (7.1). Hold the launch review using the 7.2 template and score your LLMOps maturity (6.4).

Verify it, and what you should see:

bash
python3 scripts/severity.py incident.json      # suggested severity + the human-confirm prompt
python3 scripts/incident_metrics.py incidents.jsonl  # MTTR, MTBF, repeat-incident table
python3 scripts/oncall.py --people "ada,grace,linus" --weeks 4   # rotation + coverage check
python3 scripts/readiness.py ops/readiness_checklist.json        # gate/track verdict

Expected: each script prints real analysis of the files you wrote — a severity suggestion that may under-triage by design (the human confirm is the safeguard), incident stats with the class-level repeat view, a rotation with no gaps, and a checklist score that tells you honestly whether the service could launch.

Done when:

  • ai_inventory.yaml covers every prompt, model alias, tool, index, eval suite and key — with owners and data classes filled.
  • At least five runbooks exist in the shared skeleton, each naming real dashboards/flags/kill switches, and one tabletop exercise is logged with its findings.
  • Every kill switch has been triggered once deliberately, and the degraded path was observed serving.
  • retention_schedule.yaml covers every store including backups and provider-side, and the deletion runbook reaches all of them.
  • Vendor files exist per provider with an honest exit plan; the SLO doc has SLIs, targets and a page/ticket split.
  • The readiness checklist is filled with gate/track honesty — na only with reasons — and the maturity assessment names your level and the single highest-leverage next move.

Stretch ideas: Add the postmortem archive (ops/postmortems/) and write one for a real or imagined incident hunting the LLM contributing factors — silent quality failure, unpinned alias, console prompt edit, missing eval case (11C.4, 1.7). Design the DR plan with RPO/RTO per store — the vector-index rebuild is usually the RTO long pole (5.3). Write the complaint→eval-case loop: how a user report becomes an evalkit example (11C.4, 4.2).

Common problems:

  • Runbooks that say "investigate" — a runbook with no named dashboard, flag or command is a wish list; the lesson's skeleton forces the specifics (11C.4, 1.5).
  • Inventory drift — prompts edited in a provider console never touch git; the inventory must include console-side artefacts and the audit log must capture who changed what (11C.4, 2.3, 2.5).
  • "The vendor handles retention" — retention promises are per-endpoint and per-feature; files, batch and abuse logs often differ (11C.4, 2.7).
  • Checklist theatre — marking items done that aren't, or na without reasons; the checklist exists so "ready" is a claim with evidence (11C.4, 7.1).
  • On-call coverage that isn't — a rotation that looks balanced on paper but has no tested escalation path; run oncall.py and actually call the escalation contact once (11C.4, 6.2).
Esc
02.2Tokens and TokenizationHow LLMs Work · 21k wordsLesson
02.3EmbeddingsHow LLMs Work · 18k wordsLesson
07Retrieval-Augmented Generation (RAG)11 lessons · Everyone who will build LLM features that must answer from knowledge the model doesn't have in its weights: internal handbooks and help centres, contracts, ticket histories, product docs, or any corpus that changes faster than a training run. The module covers the full RAG stack — architecture, retrieval strategy, query understanding, grounded generation, citations, conversation, managed services, advanced patterns, evaluation, debugging and production operation — and shows where each major provider's managed retrieval and citation features fit (OpenAI, Anthropic, Google Gemini and OpenRouter). All code is Python.Overview
08E.1The Model Context Protocol (MCP)Protocols and Extensibility · 12k wordsLesson
↑ ↓ navigate↵ openesc close