Week 4 • Day 5Week 4

Day 5:Week 4 — Days 5 to 7: Month 1 Capstone Project — SRE Runbook Copilot CLI

Battle-tested daily lesson note • 100% runnable code, interview Q&A, test suite & interactive quiz

Week 4 — Days 5 to 7: Month 1 Capstone Project — SRE Runbook Copilot CLI

Mentor's Note (10+ YOE Staff AI Engineer POV): Welcome to Days 5–7 of Week 4 — where we build our Month 1 Capstone Project: The SRE Runbook Copilot CLI!

All code, runbooks, schemas, SQLite cost audit tables, and automated tests for Capstone 1 live in our dedicated capstone directory: 👉 capstones/month01_sre_runbook_copilot_cli/ (open the matching Capstone project in the left sidebar or use Tab 2: Codes below)

How Capstone 1 Combines Every Week of Month 1:

  • Week 1 (OS, .env, Strings, Files, OOP): Loads D:\Spark\AI_Engineer\.env (load_root_dotenv), masks API keys, parses Markdown runbooks (payments_service.md, database_failover.md), and sanitizes PII.
  • Week 2 (Pydantic v2, Generators, Decorators, Testing): Validates every LLM output against RunbookResponse (src/schemas.py) with cross-field citation consistency checks and AsyncMock / deterministic offline fallback testing.
  • Week 3 (SQL & Relational Databases): Logs every query's prompt tokens, completion tokens, latency, citation, and exact USD cost into a persistent SQLite Cost Audit Ledger (src/audit_db.py)!
  • Week 4 (HTTP/LLMs, Prompt Engineering, Cost Math & Resilience): Compiles XML-sandboxed grounded prompts (src/copilot.py), calculates exact token costs (src/cost_calculator.py), and executes batch queries in main.py!

In Simple English: What You Built in Month 1

You started Month 1 learning what RAM, Disk, and cd mean — and now you have built a real production SRE Runbook Copilot that:

  1. Reads runbook Markdown files safely and splits them into clean searchable sections.
  2. Wraps documents inside <runbook_context> XML tags and blocks prompt injection attacks before spending money on an LLM.
  3. Logs every question, latency, and exact USD dollar cost into a permanent SQLite database using parameterized queries.
  4. Refuses to guess if the runbook doesn't contain the answer (covered_by_doc = False).

Interactive Browser Sandbox Included Below!

Because you are learning directly on the web, we added a self-contained pure-Python + SQLite simulation (capstone_smoke_runner.py & test_capstone_smoke.py) in Tab 2 (Codes) and Tab 4 (Test & Troubleshooting). Click Run in Browser right now to watch the full Month 1 Capstone execute end-to-end inside your browser at $0 server cost!