Free guide · Beyond the LLM Call: one AI agent, from demo to system Get it →

Retrieval Engineering with Python

In development. No start date or price yet. Join the interest list below to hear when there is.

An agent is only as good as what it can retrieve, and that's the layer where most agents break. This course is about that layer only.

You build askrepo, a command-line coding assistant that indexes a software repository and handles three kinds of question: how does this error propagate, where is this contract defined and who implements it, and add this validation as a patch that already passes the tests. Every answer cites the chunks behind it. An answer without provenance fails a test.

The thesis: a retrieval system is designed by measuring it. You build a golden set first, CI checks against it from week one, and each design decision is settled by your own measurements, not by a blog post.

The arc

  1. Baselines: a golden set, three baselines, cost and accuracy measured.
  2. Idempotent ingestion: filesystem and Git adapters, content hashing, change detection.
  3. Stable chunking: structural and AST chunking that survives a three-line edit.
  4. Vector index: embeddings, pgvector, your own recall-versus-latency curve.
  5. Hybrid retrieval: BM25, rank fusion, reranking, routing by query type.
  6. Evaluation: recall@k, MRR, nDCG, faithfulness, failure analysis.
  7. Agent with tools: search, read, list symbols, run tests, with a token budget.
  8. Propose and verify: patches applied in isolation and checked by the target repo's tests.
  9. Freshness: incremental reindexing, and the cost of stale answers.
  10. Security and observability: injection through retrieved content, least privilege, per-request cost.

Stack: Python 3.13, uv, Typer, Postgres with pgvector, SQLite FTS5, RAGAS, OpenTelemetry, pytest.

Who it's for: developers who have built an agent with tools and hit the wall where it retrieves the wrong thing or degrades as the codebase grows. The Expense AI Agent course is the natural first step.