Skip to content

resource

Python AI Agent Worked Solutions and Explanations

Compare your saved exercise attempts with 32 worked notebooks. Follow the reasoning, inspect the implementation and use additional checks to test your understanding.

Build Your Always-On AI Agent From Scratch · nineteen-chapter edition · 9 September 2026

Study worked implementations and their reasoning after attempting the exercises. Each notebook repeats the required setup and concepts, includes the full exercise context and tests additional cases.

Set up your environment · Download this complete asset

The edition has nineteen chapter slots. Sixteen chapters currently have two ninety-minute units each: 32 units and 48 hours of available practice. Chapters 4, 7 and 13 are planned construction briefs. The finished plan calls for 38 units and 57 hours; those six additional units are not yet published. Existing units use a supplied runtime and can be studied while the new foundations are authored. No completed notebook is represented by an empty placeholder.

ChapterTopicAvailability
1Make the first model call for LucyAvailable draft — A and B, 90 minutes each
2Give the agent reliable shop toolsAvailable draft — A and B, 90 minutes each
3Build the model and tool loopAvailable draft — A and B, 90 minutes each
4Build durable SQLite statePLANNED — brief only
5Remember across conversationsAvailable draft — A and B, 90 minutes each
6Reuse a tested opening procedureAvailable draft — A and B, 90 minutes each
7Build a durable work inbox and report outboxPLANNED — brief only
8Talk to the agent from your phoneAvailable draft — A and B, 90 minutes each
9Wake up for schedules and stock eventsAvailable draft — A and B, 90 minutes each
10Ask permission before spendingAvailable draft — A and B, 90 minutes each
11Survive the ambiguous supplier orderAvailable draft — A and B, 90 minutes each
12Recover work after a process crashAvailable draft — A and B, 90 minutes each
13Build an MCP client and tool serverPLANNED — brief only
14Isolate tools and untrusted contentAvailable draft — A and B, 90 minutes each
15Measure whether the agent helpsAvailable draft — A and B, 90 minutes each
16Improve behavior with evaluated changesAvailable draft — A and B, 90 minutes each
17Delegate one bounded taskAvailable draft — A and B, 90 minutes each
18Deploy and maintain the agentAvailable draft — A and B, 90 minutes each
19Lucy leaves the shop for a dayAvailable draft — A and B, 90 minutes each

How to use this asset

Start with the setup page. Choose a chapter, then Unit A followed by Unit B. Keep predictions, source changes, failed attempts and transfer results. Each unit supplies the concepts and runtime it requires; prior specialized-library experience is not assumed. Ninety minutes is a planned dedicated-work allowance, not a measured completion guarantee.

Notebook and Markdown files contain the same cells. Core work runs offline after setup. Live-model, Telegram, container and service-operation observations remain separate from local fixture results. These materials are construction drafts; classroom outcomes and editorial quality still require human review.

Find and share a file

Every teaching file starts with profrod-sovereign-agent, followed by its chapter, topic and role. Search for ch02 to find Chapter 2 or pydantic to find its typed-tool material. For example: profrod-sovereign-agent-ch02-a-pydantic-shop-tools-solution.ipynb. The exercise, solution, educator-exercise and educator-solution endings distinguish files even when copied into one folder. Keep the original filename and source links when sharing. The matching Markdown uses the same filename with .md.

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/solutions/profrod-sovereign-agent-solutions-start-here.md