Code samples from learning how to create and orchestrate AI agents from Agentic Design Patterns.
This project contains the code samples from the book (modified by me and various coding agents!) with a key addition: a shared common library for standardized logging across all sub-projects.
- Numbered Folders (
1-prompt-chaining, etc.): Each folder is a standaloneuvproject corresponding to a chapter or pattern from the book. common/: A shared Python library that provides common utilities, primarily a sophisticated logging setup powered by therichlibrary.
-
Install Prerequisites:
- Install Python 3.13+. (
asdf install python 3.13.5) - Install
uv. (curl -LsSf https://astral.sh/uv/install.sh | sh)
- Install Python 3.13+. (
-
Work on a Sub-Project:
- Navigate to a project directory:
cd <project_name> - Install its dependencies:
uv sync
- Navigate to a project directory:
-
Enable Shared Logging (Recommended):
- To use the shared logging library, link it to the project:
uv add ../common --editable - This only needs to be done once per sub-project.
- To use the shared logging library, link it to the project:
-
Run the Code:
uv run main.py(or similar).- Use the
-vor-vvflags to increase log verbosity.
The common library provides standardized logging with colored output.
Add this to scripts by running uv add ../common --editable in the project directory.
The template.py script has a minimal setup implementation so from your project directory:
cp ../template.py your_script.pyAfter setting it up (step 3 above), modify your main script to use the logging helpers. There are three main levels:
logger.notice(): For essential user-facing messages. Always visible by default.logger.info(): For detailed diagnostic messages. Visible with-v.logger.debug(): For verbose debugging messages. Visible with-vv.