ai agents / ai evaluation / llm as judge
How To Actually Tell If Your AI Agent Is Good (Evaluation)
Course walkthrough
AI Agents from Scratch
All lessons in this series
- 1I'll Teach You How To Build AI Agents From Scratch (10 Billion Tokens Proof)
- 2What Is An AI Agent? (ChatGPT Doesn't Count)
- 3The ONE Trick That Turns ChatGPT Into An AI Agent (Tools)
- 4The ReAct Loop: How Cursor & Claude Code Actually Work
- 5The System Prompt That Changes Everything (Prompt Engineering For AI Agents)
- 6How To Make Your AI Agent Truly Autonomous (Without It Going Rogue)
- 7How To Trigger An AI Agent (5 Different Ways)
- 8Subagents Explained: How AI Agents Launch Other AI Agents
- 9Simple Memory: How AI Agents Remember Between Runs
- 10How AI Agents Actually Remember (Memory + RAG Explained)
- 11How To Actually Tell If Your AI Agent Is Good (Evaluation)
- 12The Complete Guide To Building AI Agents (10 Lesson Recap)
How do you know if your AI agent is actually any good? Most people just eyeball it — "yeah, this looks nice." That's not going to cut it for production AI agents (or AI-native software engineering interviews at companies like Meta).
In this lesson, I cover systematic evaluation: how to grade your agent, what metrics actually matter, and the most common pitfall that ruins AI evaluation systems.
You'll learn: → Why evaluation is the most underrated skill in AI engineering → Building an LLM-as-judge evaluation system prompt → Multi-score weighted grading for nuanced evaluation → The CRITICAL pitfall: optimizing the wrong metric (with a real example) → How to make sure your eval prompt grades what you actually want to improve
By the end, you'll have a systematic framework for evaluating any AI agent — and you'll avoid the #1 mistake that derails AI projects.
This is Lesson 10 of "How To Build AI Agents From Scratch" — a free 11-lesson masterclass on building production-ready AI agents.
#AIEvaluation #AIAgents #LLMJudge #MachineLearning #ProductionAI
Transcript
0:05Welcome back to my course on how do you build AI agents from scratch I'm going to recap everything we've built so far because honestly it's pretty impressive So we started with the basic chat app
0:18started with using the open AI playground the large language model to have a back and forth conversation We noticed that the language model doesn't have access to any real time
0:30news It doesn't have access to any tools It can't really do anything other than chat We described ways to improve this For example having the language model respond in JSON or
0:43having the language model generate code that we execute otherwise Then we formalized this more in a concept called tools The language model has access to
0:55tools which we can then execute and then get a response Finally we add an orchestration loop This builds out an AI agent
1:08AI agents shouldn't be able to execute everything indiscriminately You need some way to control whether the agent can execute a command or if it needs approval or additional clarification
1:21from the user You can use a whitelist a blacklist or even just a toggle between automated and semi automated mode Tools like cursor and clock code allow you to do this
1:33We also introduced the concept of memory We can store memory simply with just plain dumps and markdown files We can store memory smarter like having different files for different things
1:45and having a language model summarize the memory and place it in the correct files We can do advanced memory We can take 100 pages of documents put each document in a vector database
1:58and then at runtime we can query the database for relevant documents put it into the system prompt and then answer the questions Or we might have a different memory architecture where we create these memory structs that
2:12have these tags that are queryable at runtime and can be injected into the AI's context at runtime Now we're getting to the final stretch That is after our
2:25agent runs how do we know if it did a good job at all This brings us to an extremely important concept called evaluation
2:39Evaluation is you deciding how you're going to grade how your agent performed And this can be in a number of key ways Right now this is
2:51an evaluation system prompt for a specific tool This prompt given the user's request the SQL query and the SQL query results it gives
3:07a grade The grade can be one for a perfect query 0 9 for something close 0 6 but it's flawed or 0 2 or 0 if it's just outright wrong And similar to other
3:20system prompts we have examples that has an input and the output and it gives it a grade And so we can basically give instructions on how we want
3:34it to be graded to an AI model We can get the score and now we know exactly how good the model predicted its task Now this is just one way of grading
3:48a language model This is grading from pure accuracy but sometimes you want to grade things that are a little bit more subjective like did it accomplish its goals Or maybe there are several things you have to account for
4:01In this example we're just outputting one score We could output multiple different scores and see how well the language model did in different tasks
4:13Here's an example of a system prompt that outputs multiple scores and it does a weighted sum You know this system prompt takes as an input an entire
4:26agent run Everything that happened and including traces which I'll talk about a little bit later but it takes an entire agent run and it
4:38gives it a score in multiple different categories and then it weights it So it's going to respond with this JSON with a summary a description all
4:51these scores and this JSON can be parsed and then be used to iterate over time Or at least that's the idea But in order to properly evaluate an
5:04agent especially the full agent run we need the entire context of what the agent actually did More over than that we might just want to monitor it What if we spent 70
5:17in an agent run but we have no idea why or how We need to know that sort of information That brings us to a key important part which is
5:29observability You want to store all your inputs your outputs the number of tokens the cost anything you need to know You want to store all that information as the agent runs
5:44in a database So you can see exactly what happened step by step And the fun thing is you don't even have to read it You can give all that information dump it to an LLM and then you
5:58can ask it to summarize what happened But by doing this you can essentially teach your agent to achieve specific goals and it's more or less objective But
6:11you don't just need an LLM to grade an agent right You can have grading criteria on the time it takes You know what if you have an AI agent that's trying to triage production outages If it's a
6:26SIV 1 and it took 20 minutes well we lost 10 million That is not a good agent Or you might consider something like cost You know if you have an AI agent that's sending emails and it's costing
6:40you 60 per email that's not a good AI agent either There are different criteria some objective that don't require LLMs some subjective that do require LLMs
6:53and you just have to choose what evaluation pipeline makes sense for your specific use case Now one important thing that I want to
7:06bring up with this is when you're evaluating the agent you have to be very careful that your prompt is actually grading the thing that you want to improve Let's take a concrete example of creating trading strategies Let's
7:21say you use the backtest performance of your trading strategy as the thing you're trying to optimize If your goal of the agent is to produce great backtest results on a
7:36certain period in the past then that would probably work really well Your agent will improve quickly and you're going to create some amazing agents that work all the time But if your goal is to build an AI agent to execute real world trades
7:51then the backtest performance while it's somewhat important is not actually the key thing you want to You might accidentally build an AI agent that produces very good backtest returns but produces
8:05horrible real world live trading returns You have to make sure the thing you're optimizing is the thing you want improved If your score is wrong then you're
8:19going to be improving towards the wrong outcome And this is one of the hardest things to get right with your AI agents Believe it or not we're finally done We've talked through everything it takes to build a real world production agent
8:35In my next video I'm just simply going to recap everything we've learned so far because it's a lot But if you understand it all excel you will
8:47ace your AI native software engineering interview or be a superstar on your tech team
Join the conversation
Loading conversation…