Skip to content

Latest commit

 

History

History
136 lines (90 loc) · 4.11 KB

File metadata and controls

136 lines (90 loc) · 4.11 KB

Deep Agents

You can find the course at Deep Agents.

Setup

Prerequisites

Installation

Clone the repository and move to the python directory:

git clone --depth 1 https://github.com/langchain-ai/lca-deepagents.git
cd lca-deepagents/python

Make a copy of .env.example:

cp .env.example .env

Insert API keys directly into .env — LangSmith (required) and your model provider (required):

# LangSmith — tracing and observability
LANGSMITH_API_KEY=lsv2_...
LANGSMITH_TRACING=true
LANGSMITH_PROJECT=lca-deepagents
# Non-US region? Uncomment your endpoint (else your API key won't authenticate):
# LANGSMITH_ENDPOINT=https://eu.api.smith.langchain.com    # GCP EU
# LANGSMITH_ENDPOINT=https://apac.api.smith.langchain.com  # GCP APAC

# Model provider API keys — set the one you're using
ANTHROPIC_API_KEY=your-anthropic-api-key
# OPENAI_API_KEY=your-openai-api-key
# GOOGLE_API_KEY=your-google-api-key

# OpenRouter: optional, for trying free hosted open-source models (used in the Models lesson)
# Get a free key at https://openrouter.ai/keys
# OPENROUTER_API_KEY=sk-or-v1-...

# Tavily web search — for the research labs (Module 4 and the Module 5
# newsletter). Leave blank to run those labs without web search.
# Get a free key at https://app.tavily.com
TAVILY_API_KEY=

This course uses load_dotenv(override=True).env values always win over OS environment variables.

Install dependencies:

uv sync

Setup Verification

After completing the steps above, run the following to verify your environment:

cd python
uv run python env_utils.py

You should see masked values for each key in your .env file. If anything shows <not set>, see Setup Verification Issues.


Setup Details

Setup Verification Issues

ImportError when running env_utils.py

If you see ModuleNotFoundError: No module named 'dotenv', you're likely running Python outside the virtual environment.

Solution: Use uv run python env_utils.py (recommended), or activate the virtual environment first:

  • macOS/Linux: source .venv/bin/activate
  • Windows: .venv\Scripts\activate
A key shows <not set>

The key exists in .env.example but has no value in your .env file.

Solution: Open python/.env and fill in the missing value.

LangSmith tracing errors

If you see tracing errors at runtime, check that both LANGSMITH_TRACING=true and a valid LANGSMITH_API_KEY are set in your .env file. If you don't have a LangSmith account yet, set LANGSMITH_TRACING=false to disable tracing until you do.

Wrong Python version

The course requires Python 3.11–3.14.

Solution: If using uv, run uv sync — it will install the correct Python version automatically. If using pip, install Python 3.11–3.14 from python.org.

Getting Started with LangSmith

  • Create a LangSmith account
  • Go to Settings → API Keys and create a new API key

Installing uv

See the uv installation docs for full instructions. Common options:

# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# macOS with Homebrew
brew install uv

# Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"