Skip to content

front matter

How to Use the Python AI Agent Book and Exercises

Prepare the Python environment, follow the book’s code and notation, and keep exercise evidence. Identify supplied runtime components before claiming independent construction.

Updated: 2026-09-09 · Status: DRAFT

Read the preface first. You need basic Python functions and classes, a terminal and a text editor. JSON, Pydantic, SQLite and each later library are introduced where they become useful; the planned foundations must be completed before this edition can claim an uninterrupted from-scratch path.

Install the matching source environment

Download or clone the complete repository at the source revision supplied with your course. The textbook directory contains its manuscript, checkpoints, learner examples and appendix assets; Python dependencies and the supplied reference runtime live at the repository root. Copying this directory alone does not install those dependencies. Keep the root pyproject.toml, uv.lock, src/, reference_organizations/, tests/ and scripts/ with it.

Install Python and the dependencies from the committed lock, then run the first offline checkpoint from the repository root:

bash
uv sync --frozen --python 3.14 --group dev
uv run --python 3.14 python book/textbook/checkpoints/profrod_sovereign_agent_ch01_first_model_call_checkpoint.py

uv sync creates the project environment; --frozen uses the checked-in dependency resolution. uv run executes inside that environment. Python 3.14 is required by some later listings. Chapter 1 walks through the model setup separately. Do not substitute the published package for the source checkout that accompanies this manuscript.

The first fixture should report the three stock items without contacting a model. Only run a chapter's --live, --telegram or container commands after completing the corresponding setup. No core checkpoint places a real supplier purchase.

Keep reading, practice and answers separate

Read a textbook chapter before its matching Exercise Book unit. Unit A builds and connects; Unit B diagnoses, repairs and transfers. Each unit budgets ninety minutes of dedicated work. Preserve your predictions and result before opening the Solutions Book. The Educator Guide provides timing, demonstrations and assessment; it is not an extra prerequisite for self-study.

The completed learner/profrod_sovereign_agent_ch02_pydantic_shop_tools_learner.py and learner/profrod_sovereign_agent_ch03_agent_loop_learner.py files are supplied comparison copies. Save your own work at the paths named in those chapters, in your own checkout. The Chapter 3 checkpoint loads those definitions. Later reference checkpoints still import substantial supplied runtime code; OWNERSHIP.md identifies that boundary. A learner-owned cumulative package and its empty-workspace acceptance remain on the construction roadmap.

Read evidence labels literally

A code listing may depend on earlier definitions in the same chapter. Adjacent output states the expected observation; it does not make every fence a standalone program. Run examples from the repository root so relative fixture paths resolve. The checkpoint index lists the sixteen executable checkpoints and the three planned additions without pretending that a missing checkpoint ran.

EvidenceEstablishesDoes not establish
Deterministic model fixtureAuthored dispatch and failure pathsLive model choices or language quality
SQLite plus controlled supplierLocal state and independent simulated receiptsA different supplier's recovery contract
Real Telegram observationThe documented account and handset exchangeContinuous availability or fixture equivalence
Linux or container experimentBehavior on the recorded host and configurationA universal operating-system guarantee
Passing automated checksThe particular assertions executedReader comprehension or editorial acceptance

A high score cannot change DRAFT to READY. Chapter 15 deliberately exposes a correct tool trace paired with a false explanation. Preserve failing cases and the exact source revision alongside successful results. Run uv run python scripts/verify_book_assets_v2.py --textbook for this manuscript's examples and checkpoints. The full repository gate is make verify; it also checks the other active assets and preserved historical material.

Use Lucy's units and authority consistently

Stock quantities are whole tubs. Monetary records use integer pence, displayed as pounds only at the presentation boundary. Physical stock, pending replenishment, reserved spend and confirmed expenditure are distinct values. A remembered sentence is not an inventory record; an approval is not a purchase receipt.

Use synthetic shop data and the controlled supplier. Operator-owned configuration supplies credentials; keep tokens out of source, transcripts and evidence bundles. A skill grants no authority. An MCP child process has host privileges unless a separate execution boundary restricts it. Read the chapter's precise scope before interpreting a green result.

For each mechanism: predict the outcome, reproduce it, introduce the stated failure, repair it and change one constraint. Explain the changed behavior from the resulting records. Reproducibility explains how to retain that evidence.

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.

SOURCE PROVENANCE

Derived from github.com/profrodai/sovereign-agent/blob/5b825f3a58461bce8aba1173acf0b6d175c44b64/book/textbook/profrod-sovereign-agent-textbook-conventions.md