Skip to content

resource

Your Python AI Agent Learner Workspace

Save the shop tools and agent loop you construct, run the selected checks and compare with supplied implementations. Keep the ownership of each component explicit.

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.

ChapterFileWhat it builds
1profrod_sovereign_agent_ch01_model_call_learner.pyByte-pair encoding, a bigram model, softmax with temperature, sampling, entropy and perplexity
2profrod_sovereign_agent_ch02_pydantic_shop_tools_learner.pyTool schemas, handlers and dispatch
2profrod_sovereign_agent_ch02_constrained_decoding_learner.pyValidity over length, logit masking, and masked decoding against conditioning on a toy model
3profrod_sovereign_agent_ch03_agent_loop_learner.pyThe owned model and tool loop, its adapter, and the reliability arithmetic
4profrod_sovereign_agent_ch04_state_store_learner.pyThe durable state store
5profrod_sovereign_agent_ch05_retrieval_learner.pyBM25, cosine similarity, precision@k, recall@k, reciprocal rank and a context packer
6profrod_sovereign_agent_ch06_embeddings_learner.pyOne-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
7profrod_sovereign_agent_ch07_prompt_sensitivity_learner.pyLabels from free text, accuracy, spread across prompts, case-sampling noise and agreement
8profrod_sovereign_agent_ch08_work_queue_learner.pyThe durable work queue
9profrod_sovereign_agent_ch09_latency_learner.pyA 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
10profrod_sovereign_agent_ch10_queueing_learner.pyService-time moments, utilization, the Pollaczek–Khinchine wait, the rate for a target wait, Poisson arrivals and rescan delay
11profrod_sovereign_agent_ch11_calibration_learner.pyThe reorder rule, expected calibration error, auto-approval coverage and error, agreement confidence and the approval threshold
12profrod_sovereign_agent_ch12_retries_learner.pyAttempts and duplicate effects of retries, capped attempts under timeouts, percentiles and a stable operation key
13profrod_sovereign_agent_ch13_leases_learner.pyFalse expiry from turn lengths, the shortest safe lease, detection delay and the fencing rule
15profrod_sovereign_agent_ch15_injection_learner.pyAttempted-action checks, attack success rates with intervals, and spotlighting
16profrod_sovereign_agent_ch16_evaluation_statistics_learner.pyWilson intervals, clustered standard errors, McNemar's test, sample size, pass@k and kappa
17profrod_sovereign_agent_ch17_optimization_learner.pyThe expected maximum of k normals, the winner's curse, and Bradley–Terry ratings fitted from preferences
18profrod_sovereign_agent_ch18_delegation_learner.pyAmdahl's law, composed success, majority-vote accuracy and delegation token counts
19profrod_sovereign_agent_ch19_inference_economics_learner.pyDecode ceilings, arithmetic intensity, KV-cache memory, latency, percentiles, Little's law and loop cost
20profrod_sovereign_agent_ch20_reliability_learner.pySeries 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.