Stanford Releases Full CS329Z Agent Engineering Course Materials

Original title: 斯坦福 CS329Z 课程资料公开:讲座每天上 YouTube,两份作业开源,第一份教你花几美元从零写个“Claude Code”
78AI Score

Stanford's new CS329Z Engineering AI Agents course has published its lectures daily on YouTube and open-sourced both assignment repositories under the MIT license. The first assignment asks students to build a Claude Code-style agent harness from scratch without any agent framework, covering tool-call format design, BM25 retrieval, context compaction and a sandboxed terminal, with reference solutions running the full online test suite for about $0.05.

Full Report

宝玉 (@dotey) · 2026-11-11 05

Stanford CS329Z course materials released: lectures go up on YouTube daily, both assignments are open source, and the first one teaches you to build a "Claude Code" from scratch for a few dollars

Stanford's new course CS329Z, "Engineering AI Agents," has begun releasing all of its course materials publicly. One of the instructors, Michael Ryan, posted on November 10 that lecture videos will go up one per day on the Stanford Online YouTube channel, and the code repositories for both assignments have also been put on GitHub, both under the MIT license—other schools can use them for their own classes as long as they credit the source.

Things were different when the course started. The course page said recordings would only be posted on Stanford's internal Canvas platform for enrolled students, and people outside the university could only download the slides. Now the official channel has already posted Lecture 1, "What Is an Agent System," and Lecture 2, "LLM Knowledge for Agent Developers," with Lecture 1 past 90,000 views. The course homepage schedule has also started linking videos next to each class.

[First assignment: write your own agent harness]

A harness is the layer of software wrapped around the model: it tells the model what tools are available, parses its replies, executes commands on its behalf, and manages context. Claude Code and Codex can both be seen as a model plus a harness.

The assignment forbids using any agent framework. The course gives you only the most primitive interface: pass in a list of messages, get back a piece of text—no tool calls, no structured output. Everything else you write yourself.

The first half covers a few fixed workflows: prioritizing emails, generating daily summaries, hand-writing BM25 retrieval (a classic keyword-scoring search algorithm), and then doing multi-hop question answering over a real company's email archive. The second half has you build an internal assistant for a fictional energy company: design your own tool-calling format, hook up document retrieval, give it a terminal with sandbox restrictions, compress context when conversations get too long, remember things about the user across sessions, and require user approval or rejection before executing actions. Finally, an LLM playing a "simulated user" has a multi-turn conversation with your agent, and another model scores it.

For self-learners, the most useful part is that the full test suite is in the repository. At first all the tests fail, and your job is to make them pass one by one. Of the 88 points of automated grading, 48 come from tests that don't call the model, so you can run them as many times as you want for free. There are also several judgment-call parts where the assignment gives no reference answer—for example, how much of a command's output to show the model when it's too long, what must be preserved when compressing context, and which operations can skip user confirmation—and you're asked to write a design note explaining your choices.

Michael Ryan says you can finish it with less than $5 of API credit. The numbers in the handout are even lower: running all the online tests once with the reference solution cost $0.05, and the final simulated-user evaluation cost another $0.18. Debugging on your own means repeated runs and will cost more, but fortunately every call is cached locally, so the same request costs nothing the second time. Enrolled students use an OpenRouter key issued by the course; people outside the university have to provide their own. The default model is openai/gpt-6-luna.

[Second assignment: write an exam question for an agent]

The second assignment was designed by John Yang. He is a co-author of SWE-bench, a benchmark that uses real GitHub issues to test whether AI can fix bugs, and model makers often report scores on it when releasing coding models.

The assignment teaches you how to write a Terminal-Bench-style task: give the agent a problem description, have it work in a command-line environment, and finally use a test script to judge whether it did it correctly. The tool used is Harbor, from the Terminal-Bench team. It defines how a task is packaged (problem statement, Docker environment, verification script) and handles launching the agent, running verification, and saving results.

The assignment first walks you through running existing tasks from SWE-bench Verified and Terminal-Bench 2.1 with Harbor. The part worth 70% of the grade is writing your own task: run it five times with mini-SWE-agent (a minimal coding agent with only a bash tool) paired with Gemini 3.8 Flash, then analyze whether the task is valid, realistic, reproducible, and difficult. It requires Docker and a Gemini or OpenRouter key.

Both assignment handouts end with acknowledgments: the first was made with substantial help from Claude Fable 5.1, and the second used Claude Opus 5.5.

[What else is coming]

The course is co-taught by Diyi Yang of Stanford's Computer Science Department and two PhD students, Michael Ryan and John Yang, with more than 100 students in the first cohort. This semester's schedule also includes a fireside chat with Andrew Ng and guest lectures by the two SWE-bench authors, Carlos Jimenez and Alexander Wettig (now at Anthropic). Michael Ryan says student work will be released publicly later. The main funder is the Laude Institute, and Thinking Machines, Google Cloud, AWS, and Harbor provided API credit for students.

Note that when cloning the repository following the second assignment handout, the handout gives the repository name as assignment2-harness, but the actual address is assignment2-evals.

Course homepage: https://t.co/y7KbVMdU2r Lecture 1 video: https://t.co/Ls8MuXXJNH Lecture 2 video: https://t.co/gs46i1u5FX Assignment 1 repository: https://t.co/BzYDnPsmsN Assignment 2 repository: https://t.co/dbAzZW2Zkt Original post: https://t.co/1tVnCAIpHY

↳ Quoting @michaelryan207 (Michael Ryan): 🔊 Big Update!

All materials are now being released publicly for our NEW Stanford course CS329Z: Engineering AI Agents!

Starting with the lectures, which are going live daily on the Stanford Online YouTube channel!

Lecture 1: https://youtu.be/DGI4vucR71w

🧵 (1/5)