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

Clone the course, profrodai-resources, and work in its courses/sovereign-agent-book folder. In this book, the repository root means that folder: it holds each chapter's checkpoint, learner examples and experiments under book/textbook/, the receipts they read, and a locked environment with the course's only dependencies: Pydantic and the notebook tools. Every chapter builds on your own code; the finished agent, sovereign-agent, is the result to compare yours with, not a dependency. Copying one file alone does not install those dependencies. Keep pyproject.toml, uv.lock, book/, docs/ and scripts/ together.

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

bash
git clone https://github.com/profrodai/profrodai-resources.git
cd profrodai-resources/courses/sovereign-agent-book
uv sync --locked
uv run python book/textbook/checkpoints/profrod_sovereign_agent_ch01_first_model_call_checkpoint.py

uv sync creates the project environment; --locked uses the checked-in dependency resolution. uv run executes inside that environment. Every notebook, and every chapter's code, runs on Python 3.12, the version Google Colab runs; the course's chapter-code notebook runs any chapter's checkpoint there. 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 16 deliberately exposes a correct tool trace paired with a false explanation. Preserve failing cases and the exact source revision alongside successful results. From the course folder, make test runs every chapter's checkpoint, and make verify also checks the course's layout, notebooks and receipts.

Use Lucy's units and authority consistently

Stock quantities are whole tubs. Monetary records use integer cents, displayed as dollars 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.