How To Build Self-Improving AI Agents with Claude (Stanford's Method) — Transcript
Full transcript
- 0:00So, Stanford just released a course on
- 0:01how to build self-improving AI agents.
- 0:03But the problem is it's over 10 hours
- 0:04long. It's extremely technical, and it's
- 0:06the type of video you bookmark, but
- 0:08never actually get around to watching.
- 0:10And I put together a four-step playbook
- 0:11that will help anyone, technical or not,
- 0:13build self-improving AI agents. And for
- 0:15each step, you're going to build
- 0:16alongside me, so make sure to pay
- 0:17attention. But before we do anything, we
- 0:18need to have a clear understanding of
- 0:20some key terms. So, the first is what
- 0:22are AI agents? You've likely heard this
- 0:24term a lot, but most people don't
- 0:25fundamentally understand what this is.
- 0:27And Stanford had an explanation that
- 0:28really made it click for me.
- 0:30>> It has a goal, and it will go and
- 0:31interact with the environment, collect
- 0:33feedback, and use that feedback to
- 0:35correct its steps. So, they're basically
- 0:37systems that can direct their own
- 0:39processes, use tools, and then
- 0:41accomplish a goal.
- 0:42>> In plain English, an AI agent uses an AI
- 0:45model, tools, and any context it has at
- 0:47its disposal to get a job done, not just
- 0:50answer questions. And as we go into
- 0:522027, almost every tool you interact
- 0:54with is already some form of AI agent.
- 0:56So, when you chat with Claude, you're
- 0:57talking to the main agent. It has memory
- 0:59of the conversation, tools it can use,
- 1:01and a model that helps it do its
- 1:02thinking. Then if that's the main agent,
- 1:04you can create sub-agents with different
- 1:06tools and different permissions. So,
- 1:08that's AI agents, but the other piece to
- 1:09understand is skills. Think of these
- 1:11like a recipe you can hand the agent.
- 1:12So, if you type something like slash
- 1:14draft email, your agent follows a slash
- 1:16draft email skill recipe to complete the
- 1:18task. Skills can call agents, and agents
- 1:21can use skills, but ultimately a skill
- 1:22is the guide and the agent follows it.
- 1:25Okay, great. So, those are some key
- 1:26terms you need to understand, but how do
- 1:27we make one of these agents self-improve
- 1:29itself? Well, in Stanford's course, they
- 1:31cover two ways. The first is retraining
- 1:33the model itself through fine-tuning and
- 1:35updating the weights. And I personally
- 1:36know people who are doing this, but if
- 1:38you're watching this, you're likely a
- 1:39business owner or a high-level operator,
- 1:41and you do not fall in this category.
- 1:43And the second way is update what the
- 1:44model reads. And this is much simpler,
- 1:46and this is the approach that we're
- 1:47going to cover in this video. Now, in
- 1:48practice, you can actually do this in
- 1:50three ways. The first is you improve the
- 1:52tools the AI agent has access to. The
- 1:54second is you improve the context it
- 1:56has, and the third is improve the skills
- 1:58it has to work with. But order to have
- 2:00any sort of self-improving system, first
- 2:02you have to create the agent that
- 2:04actually does the job. And Stanford
- 2:05calls this the generator. So step one of
- 2:07the four-step process is build the
- 2:09generator. This first agent we're
- 2:11creating, the generator, it has a very
- 2:12specific job description that it's going
- 2:14to then execute. Generally for AI
- 2:16agents, the more specific and
- 2:18well-defined that job description is,
- 2:20the better. So for today's video, we're
- 2:21going to be building an agent that
- 2:22answers questions exactly how you would
- 2:25answer them. Basically, we're going to
- 2:26create an AI agent that's a clone of
- 2:28yourself. And this is the pattern that
- 2:29I've taught hundreds of operators and
- 2:31founders. And there's a reason that I
- 2:32picked this as what we're going to cover
- 2:33today. The best self-improving systems
- 2:35have a concrete, verifiable way to check
- 2:38an output. And so from Stanford's
- 2:39course, why is a subject like math so
- 2:42easy for AI?
- 2:43>> Now, why does this work? So math is a
- 2:44domain in which there is verifiability.
- 2:46So we had a whole lecture on robust
- 2:48verification. So you have the ability to
- 2:51know which outputs are correct and which
- 2:53ones are not correct. So you have some
- 2:54ability to actually choose the correct
- 2:56outputs that that can then feed into
- 2:58chain time scaling. So this works better
- 3:00in domains where there is verifiability.
- 3:03>> Now, extending from math to engineering,
- 3:04engineering is also very easy. You have
- 3:06to find ways to verify the output. And
- 3:09one of the easiest source of truths is
- 3:10yourself. You can verify if that's how
- 3:12you would analyze an input. So we're
- 3:14going to create a clone of ourselves and
- 3:16I'm going to build one called Austin
- 3:17GPT. So here's a prompt that you can use
- 3:20to have Claude interview you and write
- 3:21the agent file. And all you have to do
- 3:23is answer questions and it'll create the
- 3:25agent which is the generator in our
- 3:27larger system. So at this point, we have
- 3:29the generator, but an agent that can
- 3:30produce its own work can't necessarily
- 3:32tell you whether the work is any good.
- 3:34And fixing that is step two, which is a
- 3:35part that most people skip. But before
- 3:37we get to that, we just built an agent
- 3:39that does one job really well. But the
- 3:41one job that every business needs help
- 3:42with is finding customers. Which brings
- 3:45us to today's video sponsor, Clay.
- 3:46Finding customers used to require a full
- 3:48sales department. You'd have somebody
- 3:49who finds the leads, another person who
- 3:51figured out how to contact them, and
- 3:53another person actually reaching out.
- 3:54But now it's one sentence. You open
- 3:56Claude code and type something like,
- 3:58build me an email campaign that targets
- 4:00service businesses with a job opening
- 4:02for AI integrators in the last 90 days
- 4:05and is located within 50 miles of me.
- 4:07And then the Clay CLI will build the
- 4:08whole outreach campaign. It'll find the
- 4:10companies, find the founder or decision
- 4:12maker, pull their contact info, research
- 4:14each one so you know who's actually
- 4:16worth reaching out to, and then I'll
- 4:18draft the outreach. And what makes Clay
- 4:20so powerful is the data it has access to
- 4:22and the granularity I can go into. See,
- 4:25[music] Clay connects to over 250 data
- 4:27providers, and by pairing that data with
- 4:28these providers together, Clay has
- 4:30access to the best data in the world all
- 4:33in one place. So in this case, I asked
- 4:34for a service business with AI job
- 4:36openings around me, which is signal that
- 4:38they're looking to hire for the problem
- 4:40I solve. And this is how you can be
- 4:41precise with your outreach without it
- 4:43feeling spammy. Everyone on this channel
- 4:44is learning to build with AI, and the
- 4:46part that most people ignore is how
- 4:47they're actually going to get their
- 4:48product to paying customers because this
- 4:50seems so challenging. But Clay solves
- 4:52that because with their tooling, now a
- 4:54single person can run an entire sales
- 4:56department directly through Clay. Now
- 4:58the example I went through today is
- 4:59powered by Clay's new GTM agent, which
- 5:01is launching in beta very soon and can
- 5:04already be accessed through the Clay CLI
- 5:06in Clay. And the beauty is Clay is free
- 5:07to start and no credit card is needed.
- 5:09And if you sign up with the link in the
- 5:10description by the end of the month, my
- 5:12community gets $250 worth of free
- 5:14credits which can get you a lot done. So
- 5:17sign up for Clay with that $250 in
- 5:19credits and you can start building with
- 5:21the Clay CLI today. Step two, build the
- 5:23verifier. One question you may be asking
- 5:25is why can the agent that did the work
- 5:27just check its own work? You can think
- 5:29of it like this. You're grading your
- 5:30agent's output and the student can't
- 5:32mark their own exam. And here's Stanford
- 5:34describing this exact concept.
- 5:36>> Oftentimes getting the model to critique
- 5:38itself can be harder, so having a
- 5:40consensus of other models to critique
- 5:43the model sometimes works better because
- 5:45the models might be overconfident in
- 5:47>> And this overconfidence is measured. In
- 5:48one study, an agent ran 54
- 5:50self-improving cycles and said improved
- 5:53all 54 times. But the reality is that
- 5:5556% of those changes were flat or even
- 5:58worse. And this reminds me of the
- 5:59Michael Scott's World's Best Boss mug.
- 6:02It's a great mug until you find out that
- 6:03he bought it for himself. So we need a
- 6:05second agent whose only job is to review
- 6:08the output. But now building this
- 6:09verifier takes two parts. The first part
- 6:11is the answer key or the evaluation
- 6:13grading criteria. And the second part is
- 6:16actually the verifier itself. The answer
- 6:18key, part one, is a mapping of what you
- 6:20want your agent to output based on
- 6:22specific inputs. So for code, you would
- 6:24just check if it passed or failed a
- 6:26quantifiable test. But for non-technical
- 6:28knowledge work, it's a bit more nuanced.
- 6:30And so we need to check if that Austin
- 6:32GPT's response align with what I would
- 6:36actually say. So a straightforward way
- 6:37to do this is with a table. On the left
- 6:40will be examples of the input, and then
- 6:41on the right I'd give the actual answer
- 6:44that I would provide. Claude will help
- 6:45build this table and then I'll edit it
- 6:47directly. To make this concrete, right?
- 6:49It might feel a little abstract. Let's
- 6:50say someone asks me, where can I find
- 6:52the checkout link for a customer? The
- 6:54response would be check our
- 6:56buildpartner.ai admin portal. This is a
- 6:58very simple example, but I want to
- 7:00codify ways that I would respond to my
- 7:02own team so that I could streamline this
- 7:04process without them bugging me. And so
- 7:06for Austin GPT, I'm pulling the
- 7:08questions my team has asked me from
- 7:09Slack and the exact answer I gave it to
- 7:11build out this answer key automatically.
- 7:14So this prompt goes and it grabs the 20
- 7:16most common questions. Then I'd go
- 7:18through that list and manually review
- 7:20and make sure that the response is
- 7:22exactly how I would actually answer it.
- 7:24And this data set that we're creating is
- 7:25called an evaluation data set and I just
- 7:27call it the answer key.md. And this key
- 7:30is so critical to creating
- 7:31self-improving agents. It is a living
- 7:34breathing document. So every time the
- 7:35agent lets me down or gets something
- 7:37wrong, it's not a problem. It's just a
- 7:39new row in the answer key for us to
- 7:41evaluate the effectiveness of this AI
- 7:44agent. And this becomes a source of
- 7:45truth for grading every future change.
- 7:47So now we understand what this answer
- 7:50key or this evaluation criteria is. Now
- 7:52we need to actually go and build the
- 7:53verifier. The goal of a verifier is to
- 7:56answer is the answer right or wrong? And
- 7:58as part of this, it should never
- 7:59actually edit anything. That means not
- 8:01the answer key, not the agent. It's
- 8:03simply reading and analyzing what's
- 8:05going on. So to create this, here's a
- 8:06prompt and the verifier will explain why
- 8:09it thinks something is wrong. And the
- 8:10reason matters because it's giving
- 8:12usable context for actually fixing it.
- 8:15But what actually fixes it? Well, that
- 8:16brings us to the next step of the
- 8:18process. three is add the coach. At this
- 8:21point, there are two agents that we
- 8:22made. The AI generator in step one and
- 8:25the verifier in step two. And this is
- 8:27where you're likely asking, can the
- 8:28verifier just fix the generator? And the
- 8:31answer is no for two key reasons. The
- 8:33first is the score stops actually
- 8:35meaning anything. If the same agent
- 8:36writes the fixes that grades it, it's
- 8:38like grading your own homework. The
- 8:40verifier is only trustworthy because
- 8:42it's read-only and it has no stake in
- 8:44the result. The second is it will game
- 8:46the test. An agent that can see the test
- 8:48and also write the fix learns to pass
- 8:50the test rather than doing the job as
- 8:52it's intended to. The reason we create
- 8:55these tests in the first place is to
- 8:56help the generator do its job as best as
- 8:59possible. Now the natural next question,
- 9:00can the generator just fix itself? The
- 9:02answer is no. And the biggest reason is
- 9:04it's editing itself as it's trying to
- 9:06fix itself. So you're kind of hitting a
- 9:08moving target and it's harder to manage.
- 9:11And that brings us to the third agent,
- 9:12the coach. The coach does something
- 9:14different than both the verifier and the
- 9:16generator. It reads what the verifier
- 9:17found. It writes a draft version of the
- 9:20agent file, a candidate right next to
- 9:23the one that currently exists. And you
- 9:25never actually touched the live file
- 9:27that 's running. So to restate that,
- 9:29what this coach will do is it'll
- 9:30essentially copy and paste the existing
- 9:33agent that's doing most of the work and
- 9:35adjusting one thing to see if that
- 9:37improves the output. And the reason for
- 9:39this, whenever you're testing something,
- 9:41you want to isolate the variable that
- 9:43you changed. And so you have to have
- 9:44something that 's constant. And that's
- 9:46the original, the generator that you
- 9:48first made. Now to actually create this,
- 9:50here is a prompt that will help you
- 9:51create a coaching agent. And this one is
- 9:53specifically for my Awesome GPT coach.
- 9:55And there are a couple of rules to call
- 9:57out. Again, I mentioned it previously,
- 9:59but one change per draft. If you change
- 10:01eight things, you can't tell which one
- 10:03made a difference. The second is it
- 10:04never touches the answer key or the
- 10:06verifier. If you could adjust those
- 10:08files, the easiest way to pass the test
- 10:10is to just change the test. And the
- 10:11third is it keeps a versions folder.
- 10:14This will create a history of past
- 10:15agents so it can learn over time. And by
- 10:17having three different agents, you're
- 10:19able to restrict permissionings. And
- 10:20this is super important because you're
- 10:22able to alter what tools and files
- 10:24agents have access to programmatically.
- 10:26You can make it so that the coach
- 10:28literally can't edit the answer key or
- 10:30the original generator agent. And when
- 10:32building systems at scale, this
- 10:34permissioning is very important for
- 10:36system design. So now at this point, you
- 10:37have the generator which does the task,
- 10:39the verifier which grades the work, and
- 10:41the coach which suggests the change. And
- 10:44as a check in, I do know that this
- 10:45system is a bit complicated. So slow
- 10:48down, rewatch what I said. And this is
- 10:49for more complex systems. That's why it
- 10:51has to be a bit more complex. But it
- 10:53should all logically make sense as to
- 10:55why we're doing what we're doing. Once
- 10:57you're at this point, you can then
- 10:59compare the coach's version versus the
- 11:01original version by testing it across
- 11:03the specific use cases. The generator
- 11:05got wrong along with all of the
- 11:06historical other versions. And if this
- 11:09coaching candidate ends up scoring
- 11:11better, that brings us to the last step.
- 11:12And this is where you can either go
- 11:14simple or a bit more complex to get the
- 11:16output that you want. But before we get
- 11:17to that, if this is your first video of
- 11:19mine, welcome to the channel. But if
- 11:20this is your second or more, you know
- 11:21the drill. This is our anti-slop
- 11:23agreement. The visuals, the testing, the
- 11:25hours of research that went into this
- 11:27video. It's entirely built for humans,
- 11:30by humans. So all that I ask is you
- 11:32subscribe so that this content can reach
- 11:34more people. And for everybody who
- 11:35already subscribes, you are a legend.
- 11:37But make sure to sign up for those post
- 11:39notifications. And as a thank you for
- 11:40all the support, every video I give away
- 11:42a Claude Max subscription. And this
- 11:43video's winner is Hail Mary Pizza Epic
- 11:46Handle for building an AI-native
- 11:48business intelligence OS for SMBs. To
- 11:50enter this video's giveaway, comment
- 11:52below with what you're building, a
- 11:53recent feature you built, or any
- 11:55problems that you're running into. As
- 11:56always, I love chatting with you in the
- 11:58comments. But let's get to step four,
- 11:59which is about picking your level. There
- 12:01are three levels of self-improvement.
- 12:03Level one is you suggest the
- 12:05improvement. Level two is AI suggests
- 12:07you approve. And level three, AI
- 12:09improves itself without you. Everything
- 12:11we've covered thus far in this video is
- 12:12structuring your system to allow for any
- 12:15of these levels. And when people hear
- 12:17self-improving system, they think it's
- 12:19automatic by default. And that's where
- 12:20people default to. But the reality is
- 12:22that you likely want to be in level two.
- 12:24See, level one is when you notice an
- 12:26issue, you tell Claude, and then Claude
- 12:28writes the rule. This works on day one,
- 12:30and this works for a ton of use cases.
- 12:32So don't get me wrong, this is
- 12:33effective. Use this one-line a bunch on
- 12:35this channel, and I suggest you do, too.
- 12:37You can say directly in Claude, based on
- 12:39this conversation, update the skill or
- 12:41agent I used so this doesn't happen
- 12:43again. And this is good for a lot of
- 12:44things, but for things that are really
- 12:46important, which is what we're covering
- 12:48with our clone, that may not be enough.
- 12:50And that brings us to level two, which
- 12:51is the Goldilocks zone. Here is where
- 12:53the generator, the verifier, and the
- 12:54coach run on their own against your past
- 12:56outputs. They'll suggest an improvement,
- 12:58and they'll leave you a decision, and
- 13:00you get to choose whether or not to
- 13:01approve the change. It doesn't approve
- 13:03it on its own, but it does suggest how
- 13:05to improve it. And here's one of the
- 13:07last prompts that you'll need, and this
- 13:08will create a full loop where it goes
- 13:10through, and it suggests an improvement,
- 13:12and then you end up approving it. Now,
- 13:14if you want an even simpler level two
- 13:16approach to this, and this is something
- 13:18that I also use, is within the
- 13:19buildpartner.ai plugin, there is a mod
- 13:22that lives on my machine, and it
- 13:23suggests improvements in real time based
- 13:26on my conversation. And then I can
- 13:27either approve or deny it if I think
- 13:29it's the right direction. Now, that's
- 13:31for much simpler systems, but it is very
- 13:33effective still for having a level two
- 13:35self-improving system. Then there's
- 13:37level three, which is the most tempting.
- 13:39To do this properly, you have to have
- 13:41all of the infrastructure in place. And
- 13:42this is where you loop through the
- 13:43generator, the verifier, and the coach
- 13:45until all the evaluation criteria is
- 13:48fixed. Now, to do this, you can run this
- 13:49prompt, which will loop until it fixes
- 13:52itself automatically or it hits 10
- 13:54iterations. The reason that I say to
- 13:56stop at 10 iterations is to save you
- 13:58tokens and to stop this infinite loop,
- 14:01which will just cost you time and money.
- 14:02Now, this is very intriguing, but check
- 14:04out this comment from Zubin at Weights &
- 14:07Biases about exactly this.
- 14:09>> It's really easy to go like auto mode,
- 14:11but it doesn't absolve yourself of the
- 14:12thought behind how we want to make
- 14:14improvements.
- 14:14>> This
- 14:15>> statement resonated with me, especially
- 14:17for non-technical work. Having AI loop
- 14:19through the fixes can be that leads you
- 14:21to no longer understanding how your
- 14:24agent works, and it creates
- 14:25unpredictable outcomes because you don't
- 14:28know what's going on. And that happens
- 14:30because it changes and modifies
- 14:32automatically. So the right level of
- 14:34this self-improving system could change
- 14:36depending on the work that you're doing.
- 14:38If you have an extremely verifiable pass
- 14:40or fail test case, level three can work.
- 14:43And this is primarily for technical
- 14:44work, and that's where you'll see most
- 14:45people creating these level three
- 14:47self-improving systems. But if you're
- 14:49struggling finding an exact measurable
- 14:51evaluation criteria for your verifier
- 14:53that we create in step two, then you're
- 14:54going to struggle in practice creating a
- 14:57level three self-improving system. So in
- 14:59this case, stay at level two where your
- 15:01taste can be the final sign-off. And in
- 15:04terms of level one, that's where you're
- 15:05just telling the AI system to improve
- 15:07based on something you noticed. Just do
- 15:09that whenever you see it happening. And
- 15:10again, here is the prompt that I love
- 15:12using in my day-to-day. So let's zoom
- 15:14out for a second because there is a
- 15:15bigger idea here than just the four
- 15:17things we built. If we want AI agents
- 15:19that actually get better over time, you
- 15:21need four pieces working together. Step
- 15:24one is the generator. That is a clear
- 15:26job description with a reason behind
- 15:28every rule. Step two is the verifier.
- 15:30This is an independent read-only agent
- 15:33that checks the work against an answer
- 15:35key. Step three, that's the coach, an
- 15:38agent that proposes improvements in a
- 15:40separate candidate file without touching
- 15:42the version that's already working. And
- 15:44then step four is pick your level of
- 15:46self-improving system. Decide how much
- 15:48autonomy you're comfortable giving the
- 15:50system. And for most people, level two
- 15:52is the sweet spot. Now that is the whole
- 15:54process, but here's the mental model I
- 15:56want you to take away. Self-improving AI
- 15:58doesn't mean letting AI rewrite itself
- 16:00until it's magically smarter. It means
- 16:02building a feedback loop where the
- 16:03intelligence is in how you design the
- 16:06system. And that includes the decisions
- 16:07that you let AI make and the decisions
- 16:09that you make yourself. Now Stanford's
- 16:11course goes much deeper into the
- 16:12technical side, but 99% of people don't
- 16:15need to know all those details. Claude
- 16:17will handle the technicals, and what I
- 16:18covered in this video gives you the
- 16:19strategic direction to build a system
- 16:21yourself. So go run the prompts yourself
- 16:24so you can build your own version of
- 16:26AutoGPT. But no matter what you're
- 16:28building, you're likely going to run
- 16:29into a token constraint and not know
- 16:31which model to choose for which agent.
- 16:33So to solve this problem, I made this
- 16:34video which will teach you everything
- 16:36you need to know about Claude models.
- 16:38Now if you're new here, my name is
- 16:39Austin Marcaze and welcome to the
- 16:41channel. I'll see you in the next video.
- 16:42Peace.
About this transcript
This page contains the full transcript of How To Build Self-Improving AI Agents with Claude (Stanford's Method) by Austin Marchese, generated from the public captions YouTube serves with the video. The transcript has 3,711 words across 536 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.