On This Page
Prerequisites
This is the first chapter of the course. No prior chapters are required.
However, you should have:
- Basic Python programming knowledge
- A computer with Python 3.11+ installed
- Access to a terminal/command line
- A text editor or IDE (VS Code recommended)
Goals
By the end of this chapter, you will be able to:
-
Virtual Environments - Isolation for Agent Projects
- Set up Python virtual environmentsfor isolated agent development, preventing dependency conflicts between different agent projects.
- Understanding virtual environment isolation is critical because agent development involves multiple complex dependencies from frameworks like LangGraph, CrewAI, and various LLM SDKs that frequently conflict with each other.
- In the lab exercise, you will create a virtual environment from scratch and verify that packages are installed in isolation from your system Python.
- This skill forms the foundation for all subsequent chapters, as every agent project requires proper dependency isolation to function reliably.
-
Git Version Control for Agent Projects
- Configure modern package management with Poetry, creating pyproject.toml with proper dependency groups and generating lock files for reproducible builds.
- Poetry has become the industry standard at companies like Spotify and Robinhood because it solves the fragmentation problem of managing requirements.txt, setup.py, and pip-tools separately.
- You will practice creating pyproject.toml files with separate dependency groups for development, testing, and production environments, mirroring real-world project structures.
- The lock file mechanism ensures that your team members and CI/CD systems use identical package versions, eliminating "works on my machine" issues that plague agent deployments.
-
- Master Git version controlfor agent projects, including proper configuration, branching strategies, and conventional commit messages.
- Version control is essential for tracking changes to agent prompts, tool configurations, and orchestration logic that evolve rapidly during development.
- The lab includes exercises on creating feature branches for new agent capabilities and writing conventional commit messages that enable automated changelog generation.
- These practices align with professional workflows at companies like GitHub and GitLab, preparing you for collaborative agent development in team environments.
-
VS Code Configuration for Agent Development
- Implement secure API key managementfor LLM providers using .env files, python-dotenv, and comprehensive .gitignore patterns.
- Securing API keys is non-negotiable for agent development, as exposed OpenAI or Anthropic credentials can result in thousands of dollars in unauthorized charges within minutes.
- You will implement the .env.example pattern used across the industry, which provides documentation for required environment variables without exposing actual secrets.
- The lab validates your .gitignore configuration to ensure secrets are protected before you can accidentally commit them to version control.
-
Pre-commit Hooks for Code Quality
- Configure VS Codefor professional agent development with essential extensions, workspace settings, and debug configurations.
- Proper IDE configuration dramatically improves productivity when debugging complex agent workflows that involve multiple LLM calls and tool executions.
- You will set up workspace-specific settings that enable automatic formatting, type checking, and environment variable loading for seamless development.
- The debug configurations prepared in this chapter allow you to step through agent reasoning loops and inspect state at each decision point in later chapters.
-
Project Structure for Agent Development
- Set up pre-commit hooksfor code quality with Ruff, mypy, and secret detection to maintain code quality and prevent security issues.
- Pre-commit hooks serve as your last line of defense, catching type errors, exposed secrets, and style violations before they enter your version control history.
- The lab requires you to configure and run hooks that validate code against the same standards used by production teams at companies like Netflix and LinkedIn.
- This automated quality gate ensures consistent code standards across all team members and prevents common agent development pitfalls from reaching production.
Key Terminology
Virtual Environment (venv)
An isolated Python installation that maintains its own set of packages, preventing dependency conflicts between projects
Poetry
A modern Python dependency management tool that handles virtual environments, dependency resolution, lock files, and packaging in a single workflow
pyproject.toml
The standardized Python project configuration file that defines metadata, dependencies, build settings, and tool configurations
poetry.lock
An auto-generated file that pins exact versions of all packages and their transitive dependencies for reproducible installations
.env File
A plain text file containing environment variable key-value pairs, used to store secrets like API keys outside of source code
python-dotenv
A Python library that loads environment variables from .env files into the application runtime
Pre-commit Hook
A Git hook that runs automated checks such as linting, formatting, and secret detection before each commit is finalized
Ruff
A fast Python linter and formatter written in Rust that replaces multiple tools including flake8, isort, and black
Conventional Commits
A structured commit message format using types like feat, fix, and chore that enables automated changelogs and semantic versioning
detect-secrets
A security tool that scans code repositories for accidentally committed secrets such as API keys and passwords