Skip to main content
NewEpisode 3a is out: Carry the conversation onWatch →
AI agents · Course

Engineering AI Agents, Self-Study

Build an agent harness by hand, one mechanism per episode: output contracts, prompts, retrieval, tool calls, the agent loop, context and memory, guardrails and evaluation. Follows the public syllabus of Stanford CS 329Z; not affiliated with Stanford.

7 parts out1.4 h of video22 episodes plannedEN · 中文
What you get
  • A video for each part, with chapters
  • Slides to read at your own pace (PDF)
  • A code index with every file:line shown
  • Practice questions answered from real runs
Good fit
  • Engineers who have called an LLM API and want to know what goes around the call
  • People working through CS 329Z on their own
  • Anyone who wants to understand agents without tying it to one model vendor
Not for
  • Answers to the CS 329Z assignments: the course has none
  • Training or fine-tuning models
  • No-code agent builders

Syllabus

FreeFree with accountMembersPlanned

Retrieval

1 parts · 11 min
3aBM25 A: IDF, why a rare word is worth more10:52
3bBM25 B: term saturation and length normalization (k1, b)
3cBM25 C: tokenizing and the inverted index
4aMulti-hop A: retrieve, then answer with sources
4bMulti-hop B: where the second hop's query comes from
4cMulti-hop C: saying "not found" when it isn't there

Tools

Planned
5The tool registry: tools a model can read
6aTool protocol A: rendering tools into the prompt
6bTool protocol B: parsing a call (malformed, cut off)
6cTool protocol C: formatting the result back
7aThe agent loop A: call, act, observe
7bThe agent loop B: errors are observations
7cThe agent loop C: when to stop
8aRetrieval as a tool A: search returns snippets
8bRetrieval as a tool B: reading a document in windows
9aThe terminal A: allowlist and timeout
9bThe terminal B: isolation, the sandbox and a scrubbed environment
9cThe terminal C: when the output is huge

Context & memory

Planned
10aCompaction A: how the context fills up
10bCompaction B: what to drop, what must survive
10cCompaction C: when to trigger it
11aMemory A: memory as tool actions
11bMemory B: file-system memory and recall
11cMemory C: memories that get corrected

People & safety

Planned
12aThe interactive layer A: modes
12bThe interactive layer B: approval and "denied"
12cThe interactive layer C: steering mid-run
13aGuardrails A: deny rules
13bGuardrails B: prompt injection hidden in tool output
14aSimulated users A: building a persona
14bSimulated users B: checks, judges and reading transcripts

Beyond HW1

Planned
15DSPy: abstracting what you wrote by hand
16Multi-agent: orchestration and handoffs
17Prompt optimization: GEPA and MIPRO
18Data flywheels: from traces to data
19The eval 4-tuple: designing a benchmark
20LLM-as-judge and pass^k
21Coding agents: SWE-agent and the ACI
22Proactive agents and open problems