QAO // QUANT AGENTIC ORCHESTRATION
APPENDIX B · COURSE REFERENCE

Appendix B · Lab environment

Full environment setup: dependencies, APIs, paper trading, and lab conventions.

READ ~8 MIN LEVEL INTERMEDIATE-ADVANCED EDITION JUL 2026

This appendix defines the reproducible environment in which every example in the course has been executed and verified. The philosophy is the one the ecosystem itself imposes: LangChain's release cadence is minors every 1–2 months and weekly patches (questdb.com) , so the only real defense against version drift is strict pinning and an environment that can be recreated from scratch. Python 3.12 is assumed (LangChain v1 requires ≥3.10), pip or uv, and Docker for the Postgres service.

14.1 Reproducible setup

14.1.1 Pinned versions, environment variables, Docker Compose with Postgres for the checkpointer, course datasets

Pinned dependencies. The table below lists the versions against which the material has been validated. The LangChain stack versions were verified against the PyPI JSON API on 29-Jul-2026 (questdb.com) ; the quantitative and data packages are the ones tested in the lab (Riskfolio-Lib 7.0.0 per the PyPI registry (DataDrivenInvestorDataDrivenInvestor) ).

Table B.1 — Pinned versions of the course environment (verified against PyPI on 29-Jul-2026)

Package Version Purpose in the course
langchain 1.3.14 create_agent, init_chat_model, middleware (cross-cutting: modules 2–12)
langchain-core 1.5.2 Runnables/LCEL, content blocks, messages
langchain-openai 1.4.1 GPT models (batch analysis, structured output)
langchain-anthropic 1.5.3 Claude models (thesis, reasoning)
langgraph 1.1.3 State graphs, checkpointers, HITL (modules 3, 7, and 12)
langsmith 0.4.27 Tracing, datasets, evaluation (module 11)
langgraph-checkpoint-postgres 3.0.1 AsyncPostgresSaver for durable memory
langchain-mcp-adapters 0.4.0 MultiServerMCPClient for market data via MCP
pydantic 2.12.4 Validated signal/thesis schemas
numpy 2.3.2 Core numerical computing
pandas 2.3.1 Price and fundamentals time series
scipy 1.16.1 Auxiliary statistics and optimization
cvxpy 1.7.3 Convex portfolio optimization engine
PyPortfolioOpt 1.5.6 Efficient frontier, Black-Litterman, HRP
riskfolio-lib 7.0.0 Optimization with 24 risk measures, HERC/NCO
vectorbt 0.28.0 Vectorized backtesting and parameter sweeps
yfinance 0.2.66 OHLCV download (lab only, not production)
ragas 0.4.2 RAG metrics: faithfulness, relevancy, precision, recall
datasets 4.1.0 Management of the FinanceBench-style evaluation subset
chromadb 1.2.0 Local vector store for the filings RAG
rank-bm25 0.2.2 Lexical retrieval for hybrid search
matplotlib 3.10.5 Plots of equity curves and efficient frontiers

requirements.txt

langchain==1.3.14
langchain-core==1.5.2
langchain-openai==1.4.1
langchain-anthropic==1.5.3
langgraph==1.1.3
langsmith==0.4.27
langgraph-checkpoint-postgres==3.0.1
langchain-mcp-adapters==0.4.0
pydantic==2.12.4
numpy==2.3.2
pandas==2.3.1
scipy==1.16.1
cvxpy==1.7.3
PyPortfolioOpt==1.5.6
riskfolio-lib==7.0.0
vectorbt==0.28.0
yfinance==0.2.66
ragas==0.4.2
datasets==4.1.0
chromadb==1.2.0
rank-bm25==0.2.2
matplotlib==3.10.5

Environment variables (.env.example). The real .env is never committed; the repository only includes this template.

# LLM providers
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...

# LangSmith observability
LANGSMITH_API_KEY=lsv2_pt_...
LANGSMITH_TRACING=true
LANGSMITH_PROJECT=langchain-quant-course

# Market data (Massive, formerly Polygon)
MASSIVE_API_KEY=...

# SEC EDGAR — required by the SEC's fair access policy:
# format "First Last [email protected]"
SEC_USER_AGENT="Ana García [email protected]"

# Alpaca paper trading (never live keys in the lab)
ALPACA_API_KEY=PK...
ALPACA_API_SECRET=...

# Postgres checkpointer (must match docker-compose)
POSTGRES_URI=postgresql://quant:quant@localhost:5432/checkpoints

Docker Compose for the checkpointer. The durable-memory agents in modules 3 and 12 use AsyncPostgresSaver, which requires a reachable Postgres. A minimal service is enough:

services:
  postgres:
    image: postgres:16
    container_name: quant-postgres
    environment:
      POSTGRES_USER: quant
      POSTGRES_PASSWORD: quant
      POSTGRES_DB: checkpoints
    ports:
      - "5432:5432"
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U quant -d checkpoints"]
      interval: 5s
      timeout: 5s
      retries: 5

volumes:
  pgdata:

Initialization note: no table needs to be created by hand. On the first run, the checkpointer creates its schema by invoking await checkpointer.setup() once (the notebooks for modules 3 and 12 already do this idempotently). The pgdata volume preserves checkpoints across container restarts; delete it with docker compose down -v only if you want a clean state.

Course datasets. Three datasets, all of them regenerable, underpin the examples:

  1. Daily OHLCV prices: 10 liquid U.S. tickers (mega-caps and sector ETFs), 5 years of history (Jul-2021 to Jul-2026), downloadable via the Massive API or, as a free fallback, via yfinance. The notebooks cache the result in data/ohlcv.parquet so that the backtesting modules are deterministic and do not depend on the network. yfinance is declared for lab use only: no SLA, a changing schema, and subject to rate limiting; in production you use a vendor under contract.
  2. Corpus of 3 earnings calls: transcripts (plain text) of three quarterly earnings calls from issuers in the universe above. They feed the RAG pipeline in module 5 (chunking, indexing in ChromaDB, hybrid retrieval with BM25) with no licensing costs: they are synthetic documents curated for the course that mimic the structure of a real transcript (operator opening, CEO/CFO prepared remarks, analyst Q&A).
  3. FinanceBench-style evaluation subset: 20 open-ended questions with a reference answer and associated evidence, built on the corpus above following the methodology of Patronus AI's FinanceBench benchmark (open-book QA over financial documents, numeric tolerance in scoring) (API EvangelistAPI Evangelist) . It is used in module 11 as a golden dataset to evaluate the RAG agent with RAGAS and with numeric exact-match, and as the seed of the CI regression dataset.

Environment verification. After pip install -r requirements.txt, the minimal check is:

python -c "import langchain; print(langchain.__version__)"
# Expected output: 1.3.14

It is also advisable to bring Postgres up (docker compose up -d) and run the repository's 00_smoke_test.ipynb notebook, which validates the checkpointer connection, the LangSmith key (a trace should appear in the langchain-quant-course project), and the download of a sample ticker.

Final warning. All versions, API prices, and vendor terms cited in the course are verified as of July 2026 (questdb.com) . The LangChain ecosystem's weekly patch cadence and the frequent repricing of data and LLMs make it essential to re-verify versions and costs before any production use, and to run the repository's integration test suite after every dependency update.


Appendix B of 3 — LangChain for Quantitative Trading. Data and versions verified as of July 2026; market prices and figures subject to change. LangChain 1.3.14 / langchain-core 1.5.2.