# Stanford Open-Sources AI Agent Engineering Course: Build Agents From Scratch

> Stanford has publicly released the course materials for CS329Z "Engineering AI Agents," covering agent architecture, RAG, tool calling, harness design, multi-agent systems, evaluation, optimization, and safety. Slides and videos are included, making it a practical starting point for anyone building AI agents from scratch.

- Source: https://www.waytoagi.com/en/kb/learning-path/stanford-cs329z-ai-agent-course
- Original (Feishu, Chinese): https://waytoagi.feishu.cn/wiki/Cvscwr3qdiU6dXk5ZZqclrqlnPh
- Updated: 2026-11-21

---

> 🔗 Original link: [https://mp.weixin.qq.com/s/bQ6xEgRT90Rja...](https://mp.weixin.qq.com/s/bQ6xEgRT90RjaEmlUHErpA)

> Mojibake · WeChat Official Account · Xixiaoyao Tech Talk · 2026-11-19 15:07

> 📌 This article is a repost; copyright belongs to the original author. The full text is subject to the original link.

Over the past two years, when people talk about AI agents, the conversation has shifted from “Can the model answer questions?” to “How do we get it to call tools, handle tasks, and manage context?”

Harness is also being mentioned more and more often.

Good news for anyone who wants to learn how to build AI agents: help is here.

Stanford launched a new course this fall called CS329Z: Engineering AI Agents, specifically teaching people how to build agent systems.

The course starts with the most basic components and teaches you how to get models to look up information, call tools, and remember information, and how to combine these capabilities so that an agent can complete tasks step by step.

These concepts sound a bit abstract, so we can understand them through a familiar product.

When you give Claude Code a task, it looks at files, runs commands, and then decides what to do next based on the results. What supports these actions is not only the large language model (LLM) itself, but also the program outside the model that connects tools and manages the execution process.

This layer of software is what people commonly call the Harness.

This course teaches exactly how to put these pieces together.

In addition to lectures, the course also includes two hands-on assignments and a semester-long project. Students need to build agents themselves and learn how to evaluate how well they actually perform.

> Course website: https://cs329z.stanford.edu/

## ◈ Course Content: From Agent Architecture to Data, Optimization, and Evaluation

This course is taught by Diyi Yang, Michael Ryan, and John Yang from Stanford’s Department of Computer Science.

![](https://www.waytoagi.com/api/kb-media/VpsFbI6kAoreasxkZcucJBsJnPb)

According to the calendar published on Stanford’s official website, CS329Z officially began on September 23 of this year, with regular classes running through December 2, so the course is still being updated on the official website.

Overall, the course can be divided into four stages.

The first stage starts with the fundamentals of agents and introduces core technologies such as RAG (Retrieval-Augmented Generation) and tool calling. The focus is on helping students understand how an agent acquires external information, uses tools, and decides its next action based on execution results.

![](https://www.waytoagi.com/api/kb-media/Mbsmb741VooIFMx48Xjcdruyn5P)

> **Course Materials**
**September 23 | Agent Systems Fundamentals**
Slides: https://web.stanford.edu/class/cs329z/slides/lecture01.pdf
Video: https://youtu.be/DGI4vucR71w
**September 28 | LLMs for Developers**
Slides:
https://web.stanford.edu/class/cs329z/slides/lecture02.pdf Video: https://youtu.be/Vr1NzH8bT44
**September 30 | Retrieval-Augmented Generation (RAG)**
Slides:
https://web.stanford.edu/class/cs329z/slides/lecture03.pdf Video: https://youtu.be/psLc-46GqY0
**October 5 | Tool Use and Function Calling**
Slides:
https://web.stanford.edu/class/cs329z/slides/lecture04.pdf
Video: https://youtu.be/s0S38lz6O7M

The second stage introduces how to build agent systems. By introducing frameworks such as Agent Harness, DSPy, and LangGraph, the course discusses how to manage task workflows, context, and memory, as well as how multiple agents divide work and collaborate. Simply put, it enables agents to not only call tools but also complete complex tasks in an organized manner.

![](https://www.waytoagi.com/api/kb-media/QSIzbpS1Yo6w9rxAfHncKNk5nNg)

> **Course Materials**
**October 7 | Frameworks and Orchestration**
Slides:
https://web.stanford.edu/class/cs329z/slides/lecture05.pdf
Video: https://youtu.be/q0Q-Hy8TTps
**October 12 | Agent Design Patterns**
Slides:
https://web.stanford.edu/class/cs329z/slides/lecture06.pdf Video: https://youtu.be/JC_pLC5EX_w
**October 14 | Agent Memory Architecture**
Slides:
https://web.stanford.edu/class/cs329z/slides/lecture07.pdf
Video: https://youtu.be/qh5tP6PBZ6U
**October 19 | Multi-Agent Systems**
Slides:
https://web.stanford.edu/class/cs329z/slides/lecture08.pdf
Video: https://youtu.be/TlX_ft_PQIM

The third stage focuses on agent evaluation. The course introduces how to use optimization algorithms, fine-tuning, reinforcement learning, and feedback from execution data to enable agents to complete tasks more efficiently and reliably.

![](https://www.waytoagi.com/api/kb-media/ElYyb35ydoKlz6xk2sIcuretnVc)

> **Course materials**
**October 21 | Agent Optimization**
Slides:
https://web.stanford.edu/class/cs329z/slides/lecture09.pdf
Video: https://youtu.be/e_m99aR7_3Q
**October 26 | Terminal-Bench Guest Lecture**
Slides:
https://web.stanford.edu/class/cs329z/slides/lecture10.pdf Video: Not yet available on the official website
**October 28 | Data for Agent Systems**
Slides:
https://web.stanford.edu/class/cs329z/slides/lecture11.pdf
Video: Not yet available on the official website
**November 2 | Data Selection and Quality**
Slides:
https://web.stanford.edu/class/cs329z/slides/lecture12.pdf
Video: Not yet available on the official website

The final stage focuses on evaluation, security, and real-world applications of agents. How do you tell whether a coding agent has actually fixed a bug? How do you measure its success rate in real work environments? And once an agent can read files and operate a computer, how do you prevent security risks such as privilege abuse and prompt injection?

![](https://www.waytoagi.com/api/kb-media/X9OHbFhzmoEZkpxWHi3cFZumn8g)

> **Course materials**
**November 4 | Evaluation Fundamentals and Benchmark Design**
Slides:
https://web.stanford.edu/class/cs329z/slides/lecture13.pdf
Video: Not yet available on the official website
**November 11 | LLM-as-Judge and Evaluation Infrastructure**
Slides:
https://web.stanford.edu/class/cs329z/slides/lecture15.pdf
Video: Not yet available on the official website
**November 18 | Agent Security and Safeguards**
Slides:
https://web.stanford.edu/class/cs329z/slides/lecture17.pdf
Video: Not yet available on the official website

To help learners get hands-on experience starting from real projects, the course also invites the creators of well-known agent evaluation projects such as Terminal-Bench and SWE-bench to teach sessions.

From tool use and system building to performance optimization, evaluation, and security, this course covers essentially the key stages of agent development. For learners who already understand the fundamentals of LLMs and want to go further and build agents hands-on, it offers a relatively complete learning path.

## ◈Two Core Assignments: First Build an Agent, Then Set Exam Questions for the Agent

Beyond the lectures, there are two hands-on assignments that map directly onto the two most critical questions in Agent development.

**The first assignment is about how to actually build an Agent; the second is about how to prove it is good enough.**

The first assignment is called build an agentic harness, and it asks students to develop an enterprise internal AI assistant from scratch.

![](https://www.waytoagi.com/api/kb-media/CCf1bTgfMoXywLxBQ3gcoEN0nre)

> Assignment code: https://github.com/cs329z/assignment1-harness

The course provides an enterprise email archive and internal document environment, on top of which students gradually build the system.

For example, having the AI judge whether an email is important, summarize emails from a specified date, or answer employee questions based on internal company documents.

The assignment also comes with a clear restriction: **students may not rely directly on off-the-shelf Agent frameworks.** They may only use basic model-calling APIs and their own code to implement the core logic.

The assignment also includes automated tests, plus model-call caching, token cost tracking, and budget control mechanisms. Students must not only consider whether the system works, but also confront the cost, fault tolerance, and debugging issues of real-world development.

The second assignment, evaluate an agent, no longer asks students to build an Agent from scratch. Instead, an existing Agent is provided, and students design a complete evaluation scheme.

![](https://www.waytoagi.com/api/kb-media/JPRAbYrTOoWdkAxH5yUct8gGnNh)

> Assignment code: https://github.com/cs329z/assignment2-evals

This time, students shift from developers to testers. They must construct evaluation tasks based on a four-tuple framework, specifying the Agent's execution environment, task objective, stopping condition, and scoring rules.

Scoring methods include code-based graders that can automatically judge results, and students are also required to use at least one LLM-as-Judge method — that is, having a language model participate in evaluating task results.

Students must also analyze the Agent's errors and determine whether the problem stems from task understanding, tool use, environment limitations, or the scoring method itself.

Beyond the two assignments, the course also requires students to develop a complete agent, either independently or in collaboration. Students may also choose to build a Coding Agent targeting a specific codebase, or even skip building a new system and instead conduct an in-depth evaluation of existing Agents' failure modes.

But whichever direction they choose, the course requires more than just a demo that runs — they must prove the system's actual effectiveness.

Students need to define in advance the evaluation tasks, data sources, and success criteria, compare their results against baseline methods, and analyze when the system succeeds and why it fails.

## ◈ From "Making an Agent Run" to "Proving an Agent Is Reliable"

Looking at how the course as a whole is organized, two features stand out very clearly.

**First, it emphasizes building from scratch rather than relying directly on ready-made frameworks. Second, it elevates evaluation to a position just as important as development.**

Unlike a plain LLM answering a single question, an Agent's tasks often involve multiple steps, and its execution process is non-deterministic.

And to build a successful, reliable Agent, developers also need to know what its success rate is, how high its operating costs are, whether results can be reproduced, and which tasks are most likely to fail.

There is also an interesting detail: the course explicitly allows students to use generative AI to assist with programming, debugging, and understanding concepts, but requires them to be able to explain and verify the code they submit.

From choosing a problem and designing the architecture, to organizing tools, collecting data, optimizing the system, and building evaluations, developers are responsible for how well the entire system performs.

For engineers currently developing Agent applications, this course offers a learning path worth referencing: **first figure out why an Agent can work, then understand why it fails, and finally learn how to make it complete tasks more reliably.**

One caveat: this course assumes learners have some foundation in computer science and NLP, so it is not suitable for complete beginners with no programming experience to dive straight into.

However, even if you don't plan to develop Agents yourself for now, this course syllabus still lets you feel an important technological shift:

**The competition in AI Agents is not just about how many tasks a model can complete, but also about whether developers can organize these capabilities into genuinely usable, controllable, and verifiable engineering systems.**

![](https://www.waytoagi.com/api/kb-media/KsdDb60bYowKVSxJDeIcvhKYnXg)

References

[1] Course website: `https://cs329z.stanford.edu/`

[2] Course requirements and grading: `https://cs329z.stanford.edu/logistics.html`

[3] `https://cs329z.stanford.edu/project.html`

[4] Assignment 1 (Agent Harness): `https://github.com/cs329z/assignment1-harness`

[5] Assignment 2 (Agent Evaluation): `https://github.com/cs329z/assignment2-evals`
