Prerequisites
Before you begin, ensure you have the following:- Chrome browser (recommended for the best experience)
- Python 3.12 or 3.13 - See Python version management below
- Package manager: uv (recommended) or pip
Installation
Clone the repository
Download the course repository using a shallow clone to get only the latest code:
Configure API keys
Edit the Where to get API keys:
.env file to include your API keys:- LangSmith API Key - Create a free account
- OpenAI API Key
- Anthropic API Key (optional)
Install dependencies
Create a virtual environment and install dependencies:
Using
uv is recommended as it automatically manages Python versions and creates optimized virtual environments. It will install a compatible Python version (3.12 or 3.13) in the .venv directory when running uv sync.Verify setup
Run the verification script to ensure everything is configured correctly:The verification script checks:
- ✅ Python executable location and version (must be 3.12 or 3.13)
- ✅ Virtual environment is properly activated
- ✅ Required packages are installed with correct versions
- ✅ Packages are in the correct Python version’s site-packages
- ✅ Environment variables (API keys) are properly configured
Running Scripts
This course uses Python scripts (not notebooks). Here’s how to run them:When using
uv, you don’t need to manually activate the virtual environment. The uv run command automatically uses the correct Python version and environment.Python Version Management
Managing your Python version is best done with virtual environments. This allows you to select a Python version for the course independent of the system Python version.Using uv (recommended)
uv will automatically install a version of Python compatible with the versions specified in the pyproject.toml file. When you run uv sync, it installs the correct Python version in the .venv directory and uses it automatically with uv run.
For more information, see the uv documentation.
Using pyenv + pip
If you’re using pip instead of uv, you can use pyenv to manage your Python versions:Environment Variables
This course uses the dotenv module to read key-value pairs from the.env file and set them in the environment. They do not need to be set globally in your system environment.
LangSmith Configuration
LangSmith is required for evaluation and tracing in this course:Create account
Sign up for a free LangSmith account
If you’re on the EU instance of LangSmith, uncomment and use
LANGSMITH_ENDPOINT=https://eu.api.smith.langchain.com in your .env file.Troubleshooting
ImportError when running env_utils.py
If you see an error likeModuleNotFoundError: No module named 'dotenv', you’re likely running Python outside the virtual environment.
Solution:
- Use
uv run python xxx.py(recommended), or - Activate the virtual environment first:
- macOS/Linux:
source .venv/bin/activate - Windows:
.venv\Scripts\activate
- macOS/Linux:
Environment Variable Conflicts
If you see a warning about “ENVIRONMENT VARIABLE CONFLICTS DETECTED”, you have API keys set in your system environment that differ from your.env file.
Solutions:
- Unset the conflicting system environment variables (commands provided in warning)
- Use
load_dotenv(override=True)in your scripts to force .env values to take precedence - Update your
.envfile to match your system environment
LangSmith Tracing Errors
If you see “LANGSMITH_TRACING is enabled but LANGSMITH_API_KEY still has the example/placeholder value”, you need to set a valid LangSmith API key in your.env file.
Solution:
Replace the placeholder value in .env with your actual LangSmith API key from smith.langchain.com.
Wrong Python Version
If you see a warning about Python version not satisfying requirements (must be 3.12 or 3.13): Solutions:- If using
uv: Runuv syncwhich will automatically install the correct Python version - If using pip: Install Python 3.12 or 3.13 using pyenv or from python.org
Model Providers
The course primarily uses OpenAI’sgpt-5-nano model, which is very inexpensive. If you don’t have an OpenAI API key, sign up here.
You can optionally obtain an Anthropic API key here for the question generator.
Development Environment
This course uses Python scripts that you can edit and run in any editor, including:- VSCode
- Cursor
- Windsurf
- Any text editor with a terminal