Stanford's Free AI Agents Lecture (CS329Z): What to Skip and the 4 Parts Worth Your Time
Stanford just posted Lecture 1 of CS329Z, "Engineering AI Agents", free on YouTube. It's 70 minutes, about one episode of whatever you were going to watch tonight. The catch: it's a graduate class, and it's easy to get lost if you just press play.
So here's the map. Skip the first seven minutes, watch four parts, and draw one diagram. Professor Diyi Yang says every agent you will ever build "is some kind of version of this diagram." Below is what's in each part, with the minute to jump to and her own words.
The whole lecture on one line
The first seven minutes are class rules and grading. Skip them, with one exception we cover next. After that the lecture has four parts:
| Part | Starts at | What it covers |
|---|---|---|
| 1 | 7:40 | Where agents came from |
| 2 | 22:00 | What's inside an agent: the five boxes. The heart of the lecture. |
| 3 | 53:40 | The difference between a workflow and an agent |
| 4 | 61:00 | How agents go wrong |
Her warning: homework up, exams down
The one thing worth catching in the opening minutes is a chart. Before she teaches anything, Yang shows homework scores for two groups: people who use AI and people who don't. With AI, she says, "everyone's homework scores are just so great." Then she shows exam scores for the same students. With AI, "we have way more people with worse in their exams."
So here's rule one for tonight. Don't ask a chatbot to summarize this lecture. Watch it with a pen.
Part 1: where agents came from (7:40)
The idea is older than you'd guess. The word agent comes from Latin and means "one who acts." In 1973, researchers were already describing software that waits for a message, then acts on it. Years later, agents learned to win at games like Go, but each one could only do one thing.
Then chatbots arrived and picked up two tricks: thinking step by step, and using tools. In 2023, people wired those two together and said, go. Her honest review of those early agents: "The reality is that none of them actually really worked very well. But they got people's attention and really opened our imagination about what's possible."
They didn't work because the model underneath wasn't strong enough yet. Now it is. On one test of real coding work, agents went from about 30 percent to very high scores in a year and a half. That's why you hear the word agent everywhere.
Part 2: what an agent is (22:00)
If you only watch one part, watch this one. Different companies use different words for agents, but Yang says they "point to the same architecture." Her definition: a language model that "reasons, remembers and uses tools and acts in a loop within its environment."
The 5 boxes inside every agent
Let's make that simple. Say you ask an agent to book dinner for four on Friday.
- The model. It sits in the middle. That's the brain.
- Planning. It breaks the job into steps: find a place, check the time, book it.
- Memory. It remembers that you don't eat seafood, and what it already tried.
- Tools. A search engine, a map and the booking site.
- The world it works in. It acts, the world answers back, and it looks at what happened.
Pause the lecture here and draw them. In her words, what differs between agents is "how each box is implemented and how well the pieces fit together."
Why a smart model needs tools
Yang reminds the class that there was a time when GPT-4, as good as it was, could not solve a three-digit times three-digit multiplication. A model that could write essays couldn't multiply. So you hand it a calculator. That's all a tool is.
She also shows what happens inside a single tool call. Four steps: pick the tool, fill in the details, check them, then run it and read the result. And then there's MCP. Think of it as one standard plug: build a tool once, and any AI app can use it.
One pass vs a loop
This is the idea the whole lecture hangs on. A plain chatbot answers in one shot. If it's wrong, it's confidently wrong. An agent thinks, acts, looks at what came back, and then thinks again. Yang's point: "in this way, the model actually can revise its own errors or get new information."
In the study she shows, made-up facts caused 56 percent of the one-shot failures. For the loop, zero. That loop is the difference between a chatbot and an agent.
3 kinds of memory
She gives three kinds. A diary that keeps everything that happened. Notes that keep only the important facts. And recipes: the skills it learned and can use again.
The agent that deleted an inbox
Memory sounds harmless. Then a student asks a question, and Yang tells this story. Earlier this year, some people were using an agent called OpenClaw to manage their email. For one user, it suddenly started deleting email. The user said please stop. "It still continues."
The user had said at the very beginning: whenever you do such actions, please confirm with me. So why didn't it listen? Yang says it was a failure at the memory compression stage. To store memory efficiently, the model decides what counts as important and keeps only that. "Confirm before you do action," she says, was "not perceived as important from the agent perspective."
Think about that. The agent wasn't being evil. It was tidying its notes, and the one rule that mattered got thrown out. Our takeaway: for anything you can't undo, don't trust a rule you typed once in a chat. Use the app's permission settings, and keep a backup.
Part 3: workflow vs agent (53:40)
This part clears up the most confusing word in AI right now with one question: who decides the next step?
Picture a train and a taxi. A workflow is the train. A person lays the track, and the AI just does the work at each stop. Yang's example is a tool that fixes a software bug in fixed stages: find the file, write the fix, run the tests. The model works inside each stage, "but they never pick the next one."
An agent is the taxi. You name the place, and it picks the route. In the agent setting, she says, the model "decides for itself" which files to open, what to run and when it's done. That is more flexible, and it "gives more responsibility to the model underneath it." More freedom, and more ways to get lost.
She also makes a point people miss: the train can be extremely good. Our take: if your task is the same steps every time, build the train.
The debugging tip: 3 layers
When an agent isn't working as expected, Yang says a good first question is "which layer the problem may occur. Is it in the system? Is it in the data? Or is it in the evaluation?" In plain words: how it's built, what you gave it, and how you check it. Ask which layer broke before you blame the model.
Part 4: how agents go wrong (61:00)
The last part is stories, and they're the fun bit. One comes from a user of Operator, the computer-use agent OpenAI introduced in January 2025. The user asked it to help buy groceries on Instacart and expected a few basic questions: where do I live, which store do I use, what do I want? "It didn't ask me any of that." Instead, it opened Instacart and began searching for milk in grocery stores located in Iowa.
It never asked. It guessed. Agents can click and buy, but they still assume too much. And it gets stranger: researchers added one harmless pop-up to a web page, and agents failed their task 87 percent of the time.
The catch: most powerful is not most reliable
This is the line we would put on a sticky note. Yang shows a chart where accuracy lines up neatly with how strong the model is, but reliability scores "do not have a trend." Her conclusion: "The most powerful agent may not be the most reliable agent."
So before you trust an agent with real work, give it the same task five times. If you get five different results, it isn't ready.
Your watch plan for tonight
- Skip to 7:40 and watch the history.
- At 22:00, slow down and draw the five boxes.
- At 53:40, pick one task from your job and write down: train or taxi.
- From minute 61, just enjoy the stories.
That's about an hour, and you'll understand agents better than most people who talk about them. The full Stanford lecture is here.
Get the Five-Box Agent Map
We put all of this on a free map: the five boxes, the timestamps, what to skip, and three exercises to do while you watch. Comment BOXES on the video, or grab it below.
Source: "What Are AI Agents? Agentic Systems Explained | Stanford CS329Z Lecture 1 with Diyi Yang", Stanford Online. Quotes are from the public lecture and lightly trimmed for reading; numbers are as shown in the lecture. Independent, not affiliated with Stanford University, Stanford Online or Anthropic.
Free PDF: The Five-Box Agent Map
The Five-Box Agent Map: the 5 boxes, the timestamps, what to skip, and 3 exercises to do while you watch the lecture.
Join 26,000+ readers of the Hyperautomation AI Report
Quick answers
Is Stanford CS329Z free to watch?
Lecture 1 is. Stanford Online posted "What Are AI Agents? Agentic Systems Explained | Stanford CS329Z Lecture 1 with Diyi Yang" on YouTube for free. It runs about 70 minutes, roughly one episode of a show.
What is an AI agent, in simple terms?
Professor Diyi Yang's definition in the lecture: a language model that "reasons, remembers and uses tools and acts in a loop within its environment." In plain words, it is a model with a plan, a memory and tools, working in some world, and checking the result of each step before taking the next one.
What are the 5 parts of an AI agent?
The model (the brain), planning (breaking the job into steps), memory (what it knows about you and what it already tried), tools (search, maps, a booking site) and the world it works in. Yang says every agent, whether it writes code, browses the web or runs a terminal, is some version of this diagram.
What is the difference between a workflow and an agent?
It comes down to one question: who decides the next step? In a workflow, a person fixes the order of the steps and the model only does the work inside each one. In an agent, the model decides for itself what to do next and when it is done. That gives it more freedom and more ways to get lost.
Why did an AI agent delete a user's inbox?
In the story Yang tells, the user had told the agent at the start to confirm before taking actions like that. When the agent compressed its memory to save space, it kept only what it judged important, and the "confirm first" rule was not kept. So it deleted the email and kept going even when the user said stop.
Which parts of the lecture should I watch?
Skip the first seven minutes of class rules and grading, except the homework and exam chart. Then watch the history from 7:40, slow down at 22:00 for the five boxes, watch workflow vs agent at 53:40, and enjoy the failure stories from minute 61. That is about an hour.