Skip to main content

Appendix F. Companion Code Repository Index

The companion code is not currently published with this draft site. The paths and commands below describe the companion source tree when it is available.

Companion labs are organized under code\. Each is a Python cell script, usually named lab_*.py, that you can run from the repository root. Unless noted, labs use synthetic fixtures and make no provider calls; some framework workflows may require a model key.

F.1 Chapter labs

Chapter Lab file Main exercise
1 code\ch01\lab_juniper.py; code\ch02\lab_four_surfaces.py Agent evaluation and observable system surfaces
2 code\ch03\lab_scorecard.py; code\ch04\lab_uncertainty.py Quality scorecards and stochastic measurement
3 code\ch05\lab_ground_truth.py Test data and review queues
4 code\ch06\lab_harness.py Repeatable harnesses
5 code\ch07\lab_deterministic_graders.py; code\ch10\lab_trajectory.py Deterministic outcomes, trajectories, and recovery
6 code\ch09\lab_annotation_ops.py Synthetic annotation operations and disagreement
7 code\ch08\lab_framework_adapters.py; code\ch08\lab_judge_calibration.py Framework boundaries and judge calibration
8 code\workflow\lab_workflow.py Synthetic offline cases, attempts, grading and gates
9 code\ch19\lab_benchmarks.py; code\ch21\lab_tooling.py Benchmark reliability and portable tooling envelopes
10 code\workflow\lab_workflow.py Matched synthetic candidate comparison
11 code\ch22\lab_lifecycle.py Release gates and lifecycle evidence
12 (no companion lab yet) Reward modeling and preference learning
13 (no companion lab yet) Causal and counterfactual evaluation
14 code\ch23\lab_production_trace_pipeline.py; code\ch23\lab_trace_to_decision.py Synthetic collection, sampling, privacy limitations, and case-to-decision records
15 code\ch23\lab_monitoring.py Production monitoring
16 code\ch20\lab_architecture.py; code\workflow\lab_workflow.py Referential integrity and in-memory service lifecycle
17 code\ch24\lab_flywheel.py Failure prioritization for review
18 (end-to-end lab pending) Release integrity
19–20 code\workflow\lab_workflow.py Synthetic shadow/canary and fixed-horizon experiment
21 (no companion lab yet) Longitudinal and temporal evaluation
22 code\ch11\lab_tools.py; code\ch15\lab_computer_agents.py Tool use, coding/computer-agent checks, and decision records
23 code\ch12\lab_multimodal.py; code\ch12\lab_generative_metrics.py Modality-specific evaluation signals and shared decision record
24 code\ch13\lab_rag.py; code\ch13\lab_memory_eval.py Retrieval, grounding, and memory lifecycle, privacy, and workflow-state metrics
25 code\ch14\lab_dialogue.py Conversational flow, slots, completion, and shared decision record
26 code\ch16\lab_autonomy.py; code\ch17\lab_multiagent.py Autonomy budgets, milestones, approvals, and handoffs
27 code\ch18\lab_safety.py Offline authorization, canary checks, and shared decision record
28 (no companion lab yet) Human–AI collaboration metrics
29 (no companion lab yet) Cross-lingual and cross-cultural evaluation
30 (no companion lab yet) Scientific agent evaluation
31 code\ch25\lab_economics.py Cost per success and Pareto frontier
32 code\ch26\lab_reporting.py Audience-oriented stakeholder summary
33 (no companion lab yet) Evaluation integrity and publication bias
34 code\ch27\lab_oversight.py Evidence-reference checks for evaluator claims
35 code\ch28\lab_capstone.py; code\workflow\lab_feedback_loop.py Synthetic capstone recommendation and versioned feedback-loop handoffs

Run an individual lab, for example:

python code\ch23\lab_monitoring.py

The test-data pipeline lab, code\ch05\lab_ground_truth.py, retains its original code-directory name and is listed under Chapter 3. It writes generated artifacts to the ignored build\ch05\ directory. Inspect AI and DeepEval examples are integrations; check the installed version’s API before adapting them.

F.2 Setup and tests

From the repository root, create a virtual environment and install the companion package:

python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install -e code

The package declares bookkit, Inspect AI, and DeepEval dependencies. For DeepEval on Windows, set UTF-8 mode as described in the repository README and framework documentation. The core offline labs do not need a model key.

Run the unit tests with:

python -m unittest discover -s code\tests -v

Shared helpers are in code\bookkit\, and synthetic data are in code\data\. Appendix D documents the fields for bookkit.system_eval.evaluation_record. Before reusing a lab’s assumptions, inspect its comments and output. The mock LLM is a skill-profile simulator; its scores do not estimate real-model quality.