Stanford CS 329Z · Engineering AI Agents

AI Agents, from first principles

These are self-study lessons built on the lectures of the Stanford course CS 329Z “Engineering AI Agents”. Every lesson starts from first principles. Each new term is explained where it first appears, and each formula is first worked by hand on small numbers.

Note: This is not an official Stanford site. These are personal notes made while studying the course. The slides and ideas belong to the course, and each lesson credits them at the bottom.

What you can read now

Lecture 3 · 18 lessons

RAG + Agents

How to give an LLM the right information at the right time, and where that approach breaks. The lessons build these ideas one at a time: retrieval, vectors, probability, the RAG model, chunking, BM25, DPR, measuring a retriever, hybrid search, ColBERT, agentic RAG, Search-R1, and the ways RAG fails.

Open Lecture 3 · in Hindi

Lessons for the other lectures will be added later.

Four versions of every lesson

Every lesson is written at two levels, and both exist in Hindi and English. A switch at the top of each lesson changes the level or the language at any time.

EasyDense
What it isThe core idea, step by step, with small numbersThe whole easy lesson, followed by steps that reach the level of the Stanford slides
For whomA first readingWhen you want every line and symbol on the slides
MathsAs much as the core calculation needsAll the maths on the slides, explained from school level

Who these lessons are for

The lessons assume you read code and know school maths, but that ML and statistics terms are new to you. There are no analogies. Each idea is explained on a small version of the real system, such as 3 passages and vectors of 4 numbers, so the arithmetic can be done by hand.

How to read

How these lessons were written

The lessons follow a fixed set of rules, and each rule rests on research about teaching and writing. Every number was recomputed by a script. Read the full method: the teaching rules, their sources, and how each lesson was checked.