CourseAI System Design: The Complete Course · Module 4: Architecture Selection · part 32 of 107
Part 32 · Module 4: Architecture Selection

Lab: The model port, the ladder and ADR-001

102 min read·
Module 4 · Lab · About 60 minutes · Needs: lessons 1 to 3 of this module, and the Module 3 lab (or nothing: Step 1 rebuilds Modules 1 to 3)

What you are building

CODE TOUR One wiring module, one decision LESSON FILES THIS LAB CHECKED AGAINST IT rungs/ Lesson 1 routing Lesson 2 contracts, port Lesson 3 ladder.py wires, reruns llm.py setup cell, ask() ADR-001 Ask and Cases rungs design step 4 boundaries table test_ports.py the port's contract
The lab's piece: the lessons' files (grey) feed a thin wiring module (blue) that calls models only through llm.py and the port (amber); ADR-001, design step 4 and the tests check against it (green).

Three lessons chose an architecture in three notebooks: Lesson 1 climbed the ladder for Ask, Lesson 2 routed Cases, Lesson 3 drew the lines between components. Helen wants one decision she can sign, and Gareth wants to rerun its evidence himself. This lab puts the lessons' 16 files into the repository unchanged and adds three of its own: northdesk/llm.py, the setup cell and ask() written once; northdesk/ladder.py, which wires the chosen rungs and reruns each lesson's experiment; and tests/test_ports.py, the port's contract. The evidence goes into docs/adr/ADR-001-architecture-rung.md.

Every number comes from a scripted stand-in or the shared data, so you need no key. One optional cell sends two questions to your own provider through the port.

Open a new Colab notebook, call it module-04-lab.ipynb, and run each cell in order.

The rest of this course is yours to keep

This course is bought on its own, once, and stays readable afterwards, including the parts added to it later.

Or open everything with a plan