Skip to content

resource

Python AI Agent Exercises and Student Notebooks

Practice the drafted agent chapters with 36 student notebooks, setup guidance, hints and changed-case tasks. Save your attempt before consulting the worked solutions.

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

Work through the student notebooks, make predictions, build the missing code and test your understanding on a changed case. Answers are kept in the separate solutions book.

Set up your environment · Download this complete asset

The edition has twenty-one chapters. Each has two ninety-minute units: 42 units and 63 hours of practice. Every unit uses a supplied runtime and can be studied on its own.

ChapterTopicAvailability
1What a model call is: tokens, probabilities and Lucy's first briefAvailable draft: units A and B, 90 minutes each
2Structured output and typed tools: what a schema guaranteesAvailable draft: units A and B, 90 minutes each
3The agent loop: why reliability compounds, and a loop that stopsAvailable draft: units A and B, 90 minutes each
4Build durable SQLite stateAvailable draft: units A and B, 90 minutes each
5Memory and retrieval: what the model sees, and a memory that forgetsAvailable draft: units A and B, 90 minutes each
6Embeddings and vector search: when words are not enoughAvailable draft: units A and B, 90 minutes each
7In-context learning: why a skill's exact words must be testedAvailable draft: units A and B, 90 minutes each
8Build a durable work inbox and report outboxAvailable draft: units A and B, 90 minutes each
9Where the wait goes: prefill, decode and a phone channelAvailable draft: units A and B, 90 minutes each
10Events at random: queues, utilization and scheduled workAvailable draft: units A and B, 90 minutes each
11When to ask: calibration, oversight and spending permissionAvailable draft: units A and B, 90 minutes each
12Exactly one order: lost replies, retries and idempotencyAvailable draft: units A and B, 90 minutes each
13Slow or dead: leases, fencing and crash recoveryAvailable draft: units A and B, 90 minutes each
14External tools with MCP: the protocol connects, the application decidesAvailable draft: units A and B, 90 minutes each
15Prompt injection and isolation: words steer the model, boundaries holdAvailable draft: units A and B, 90 minutes each
16Evaluation as measurement: error bars and paired comparisonsAvailable draft: units A and B, 90 minutes each
17Optimizing against an evaluation: the winner's curse and preferencesAvailable draft: units A and B, 90 minutes each
18When a second agent pays: parallelism, errors and bounded delegationAvailable draft: units A and B, 90 minutes each
19What a model call costs, and a deployment that survivesAvailable draft: units A and B, 90 minutes each
20A whole day: reliability, honest reports and readinessAvailable draft: units A and B, 90 minutes each
21Context engineering: a budget for what the model seesAvailable draft: units 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-exercise.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.