CourseAI System Design: The Complete Course · Module 12: Trust Boundaries · part 86 of 107
Part 86 · Module 12: Trust Boundaries

Lab: The trust map, one policy and control tests

381 min read·
Module 12 · Lab · About 60 minutes · Needs: lessons 1 and 2 of this module, and the Module 11 lab (or nothing: Step 1 rebuilds Modules 1 to 11)

What you are building

The trust boundary after this lab Controls around the model Active flow 1 Processing step number Inputs documents and tool text Context gate policy.py context gate Model Layer model Ask or Cases Output validation validate_output answers, cache Tool-call check policy.check_call grant, identity, host Control tests control_checks.py scores the decisions 1 2 3 4 docs/trust-boundaries.md records every flow and its control
Northdesk's controls (teal) around the model (blue): a gate on what enters a context, a check on every proposed tool call, and validation of answers, cached ones included. The control tests (purple) score what each control decides; no model is called.

This lab joins the lessons' parts into Northdesk's trust boundary. northdesk/policy.py is one decision point: what may enter a model's context, and which proposed tool calls may run. northdesk/validate_output.py checks answers, including the cached answers Module 10 replays unchecked. evals/control_checks.py scores what those controls decide, and docs/trust-boundaries.md records every flow and its control.

The lab is defensive only. No model is called, nothing in it is attack text, and the planted notes appear by ID and flag only. Every request and answer the checks use is a hand-written, labelled stand-in built from values already in the shared data (the salary-band canaries) or reserved .example placeholders. Open a new Colab notebook, module-12-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