Each file below is the completed comparison implementation for one chapter's construction. Work in your own checkout, and retain your attempts before replacing them with a comparison.
| Chapter | File | What it builds |
|---|---|---|
| 1 | profrod_sovereign_agent_ch01_model_call_learner.py | Byte-pair encoding, a bigram model, softmax with temperature, sampling, entropy and perplexity |
| 2 | profrod_sovereign_agent_ch02_pydantic_shop_tools_learner.py | Tool schemas, handlers and dispatch |
| 2 | profrod_sovereign_agent_ch02_constrained_decoding_learner.py | Validity over length, logit masking, and masked decoding against conditioning on a toy model |
| 3 | profrod_sovereign_agent_ch03_agent_loop_learner.py | The owned model and tool loop, its adapter, and the reliability arithmetic |
| 4 | profrod_sovereign_agent_ch04_state_store_learner.py | The durable state store |
| 5 | profrod_sovereign_agent_ch05_retrieval_learner.py | BM25, cosine similarity, precision@k, recall@k, reciprocal rank and a context packer |
| 6 | profrod_sovereign_agent_ch06_embeddings_learner.py | One-hot vectors, the lookup as a matrix product, skip-gram with negative sampling, pooling, exact search, reciprocal rank fusion, ranking metrics and a small-world graph |
| 7 | profrod_sovereign_agent_ch07_prompt_sensitivity_learner.py | Labels from free text, accuracy, spread across prompts, case-sampling noise and agreement |
| 8 | profrod_sovereign_agent_ch08_work_queue_learner.py | The durable work queue |
| 9 | profrod_sovereign_agent_ch09_latency_learner.py | A least-squares line, prefill as b n + c n², time to first token and to the whole reply, and conversation prefill with and without a cache |
| 10 | profrod_sovereign_agent_ch10_queueing_learner.py | Service-time moments, utilization, the Pollaczek–Khinchine wait, the rate for a target wait, Poisson arrivals and rescan delay |
| 11 | profrod_sovereign_agent_ch11_calibration_learner.py | The reorder rule, expected calibration error, auto-approval coverage and error, agreement confidence and the approval threshold |
| 12 | profrod_sovereign_agent_ch12_retries_learner.py | Attempts and duplicate effects of retries, capped attempts under timeouts, percentiles and a stable operation key |
| 13 | profrod_sovereign_agent_ch13_leases_learner.py | False expiry from turn lengths, the shortest safe lease, detection delay and the fencing rule |
| 15 | profrod_sovereign_agent_ch15_injection_learner.py | Attempted-action checks, attack success rates with intervals, and spotlighting |
| 16 | profrod_sovereign_agent_ch16_evaluation_statistics_learner.py | Wilson intervals, clustered standard errors, McNemar's test, sample size, pass@k and kappa |
| 17 | profrod_sovereign_agent_ch17_optimization_learner.py | The expected maximum of k normals, the winner's curse, and Bradley–Terry ratings fitted from preferences |
| 18 | profrod_sovereign_agent_ch18_delegation_learner.py | Amdahl's law, composed success, majority-vote accuracy and delegation token counts |
| 19 | profrod_sovereign_agent_ch19_inference_economics_learner.py | Decode ceilings, arithmetic intensity, KV-cache memory, latency, percentiles, Little's law and loop cost |
| 20 | profrod_sovereign_agent_ch20_reliability_learner.py | Series success, per-step reliability, the Wilson interval, and checks of a report's amounts and names |
Each chapter's checkpoint loads its file, so changing a function's essential behavior changes the executable result. The live adapters still use supplied bounded HTTP transport, and later reference checkpoints import other supplied runtime components. See code ownership and the construction roadmap before treating these files as a finished twenty-chapter agent.
Keep building with Prof Rod
Found this material through a colleague, classroom or shared download? Get the complete book at profrod.ai/book and join the Prof Rod learner community. Bring one result, one question or one failure you learned from. Share this resource with another learner and keep its source links with it so they can find the full course and future updates.