How to Know If Your AI Agent Is Any Good: Evals With Phoenix & Claude — Laurie Voss, Arize AI — Transcript
Full transcript
- 0:01[music]
- 0:12My name is Lauri Voss. I'm head of
- 0:14developer relations at Arise AI. Uh I
- 0:16used to do JavaScript at npm, Inc. way
- 0:18back in the day, so you may remember me
- 0:20from then. Uh but these days I think
- 0:22about AI applications and how to make
- 0:25them run and how to make them actually
- 0:26work. Um, I had this slide up for the 15
- 0:30minutes before. I hope you've seen it
- 0:32already. If not, now is the time to get
- 0:34started.
- 0:36Um, this is a moderately hands-on
- 0:40workshop. There's I've already built an
- 0:42agent for you. It's sitting there in
- 0:44that repo. Uh, you will get to play with
- 0:46the prompts and run actual evals. Um,
- 0:49but it's got checkpoints all the way
- 0:51through. So if you get lost, you can
- 0:53just switch to the right checkpoint and
- 0:55uh uh jump to the part where it's
- 0:58already working. Um you're going to need
- 1:01node 22 or later. All of this all of
- 1:03these examples are going to be in
- 1:04Typescript. Um because you know it's me,
- 1:08I'm going to use JavaScript if I can. Uh
- 1:11and uh you're going to be installing and
- 1:14running Phoenix on your own laptop. uh
- 1:17on conference Wi-Fi that can be a
- 1:19challenge, but I tried it this morning
- 1:20and it came through pretty quickly. So,
- 1:22uh UVX is magic. Um you're not going to
- 1:26need to run any Python in this thing.
- 1:27All of the Python is going to be run for
- 1:29you on your behalf by JavaScript, which
- 1:31is nice.
- 1:33Um I think that's it for the setup. Um
- 1:36so, what we're going to do today is um
- 1:42uh oh yeah, sorry, one more bit of
- 1:43setup. Once Phoenix is installed, uh you
- 1:46should open up your browser on localhost
- 1:48606 so that you can see what it looks
- 1:50like. Um it's going to be empty right
- 1:54now, but we are going to run the
- 1:56commands that will fill it with data.
- 1:58Um
- 2:01you will also need an anthropic key. All
- 2:03of my examples are using Claude. Uh you
- 2:07can do all of this stuff using any LLM
- 2:09provider in the world, but I had to pick
- 2:11an example, so I picked the one that I
- 2:12use every day. So, this one is using
- 2:14Claude. Um,
- 2:18who needs help with the setup? Show of
- 2:20hands. Just shout at me. It's fine.
- 2:25All right. So, the first 10. What's up?
- 2:31>> Just getting started.
- 2:33>> Okay, great.
- 2:35>> Yeah. So, the first 10 minutes are
- 2:37theory, which will give you some time to
- 2:38catch up on the setup uh while I'm
- 2:42talking.
- 2:47So, let's get started with the theory.
- 2:49Um, here's the situation I'm assuming
- 2:52most of you are in. You have already
- 2:53built an application that has an LLM in
- 2:55it. Uh, maybe a chatbot, maybe an agent.
- 2:58You tried it a bunch of times and it
- 2:59looks pretty good. Uh, then you shipped
- 3:02it and somebody used it in a way that
- 3:03you weren't expecting and it broke. Um,
- 3:07or you changed the prompt to fix one
- 3:09thing. uh and you have this nagging
- 3:11feeling that you broke something else.
- 3:13Uh and there's no way of knowing. That
- 3:15is the problem that today is about. That
- 3:17is the problem that evals are here to
- 3:19solve. How do you know if your agent is
- 3:22any good? How do you know if your change
- 3:24made things better or worse? Uh and how
- 3:27do you stop it getting worse when you
- 3:29make changes uh without having to read
- 3:31every output yourself?
- 3:36My promise by the end of today is that
- 3:38you're going to have a working agent
- 3:40traced end to end with code evals with
- 3:42LLM judge evals and with a custom eval
- 3:45that you wrote yourself. Uh
- 3:48and you'll have checked whether your
- 3:49judge can be trusted. You'll have run an
- 3:51experiment to prove that your changes
- 3:53worked. Uh and you'll have have all of
- 3:56it running as a test suite with npm
- 3:58tests so you can put it into npmci.
- 4:01Um, that is the bit that I'm most
- 4:04excited about. So, it's going to be the
- 4:05last thing that we do. I see some people
- 4:07have walked in late. So, let me just go
- 4:09back to the setup slide very quickly so
- 4:11that they're not completely lost.
- 4:17Right. Remember this repo because you're
- 4:20going to want this repo.
- 4:32How is the Wi-Fi working for people? Is
- 4:34it Are you getting places?
- 4:36>> Excellent. Okay. I did this at World's
- 4:40Fair and uh every and I accidentally had
- 4:42a repo that was full of product images
- 4:44that looked really great in the demo,
- 4:46but it was 400 megabytes of product
- 4:47images and it just complete failure.
- 4:50Nobody was able to get even the repo
- 4:51down.
- 4:54So, I've learned my lesson and today has
- 4:55no images. Uh,
- 4:59so let's cover the basics. What is an
- 5:01eval? The shortest version, the one that
- 5:04I use whenever I'm talking to somebody
- 5:05who's been an engineer for a while is
- 5:08that uh there are these things called
- 5:10traces and they are basically logs and
- 5:13there's these things called evals and
- 5:15they're basically tests and evals are
- 5:17using are running tests on your traces.
- 5:20Um
- 5:22the difference between an eval and a
- 5:23unit test is that uh evals are for
- 5:26outputs that are never exactly the same
- 5:28twice, which is to say the
- 5:29non-deterministic outputs that you get
- 5:31from LLMs.
- 5:32Um traces record what your AI did at an
- 5:36incredible level of detail. So every
- 5:37agent step, every tool call, every LLM
- 5:40call, the inputs and outputs at every
- 5:41single step.
- 5:43A trace is made up of what we call
- 5:45spans. Each span is one step in the
- 5:47execution. You can think of it as just a
- 5:49line in the log. Um, and a so a whole
- 5:52agent turn is a span that has other
- 5:55spans nested inside of it. Uh, and each
- 5:57one records its input, its output, how
- 5:59long it took, how many tokens it used,
- 6:01uh, and sometimes how much it cost. So
- 6:04traces tell you what happened and evals
- 6:06tell you whether it was any good and
- 6:08that is the whole mental model for
- 6:09today. This is very far from being
- 6:12rocket science.
- 6:15Looks good to me is not a test suite.
- 6:17Um, but it's how most AI features get
- 6:20shipped. You build it, you try it a few
- 6:22times, does it look right? Yeah, that
- 6:24looks good. You ship it. Uh, and it
- 6:27probably does look good on the three
- 6:29things that you tried. Um, but three
- 6:31tries is not a test suite. And the usual
- 6:33fix is unit tests. Um, but unit tests
- 6:37don't work here because the same prompt
- 6:38is going to give a different answer text
- 6:40every single time you run your
- 6:42application. Uh, so two completely
- 6:45different answers can both be right. a
- 6:46thousand different answers can both can
- 6:48all be right. Uh just differently right.
- 6:51So there's no expected string to assert
- 6:53against. Uh so humans tend to fall back
- 6:57on human judgment. They look at the
- 6:58strings being output and they're like
- 6:59well this looks fine. [snorts] Um but
- 7:02that doesn't scale. It doesn't catch
- 7:04regressions and it certainly doesn't run
- 7:05in CI where there are no humans to watch
- 7:07things.
- 7:09Uh what that looks like in practice is
- 7:12you change your system prompts to fix
- 7:14the tone and the tone gets better. Uh
- 7:16but now the bot is making up product
- 7:18features. Uh and you don't find out
- 7:20until a customer does. Every prompt
- 7:22change can affect every kind of input
- 7:23your users send. Uh and you can't test
- 7:26all of those by hand. So you end up
- 7:27playing a game of whack-a-ole where you
- 7:29fix one thing and something else breaks
- 7:31and you fix that and something else
- 7:32breaks. uh evals fix that by giving you
- 7:36a number that you can track and can
- 7:38compare and act on.
- 7:42This matters more every month because uh
- 7:45every couple of weeks somebody releases
- 7:47a new model and you're like, "Oh, I want
- 7:49to switch to the new model." Uh but you
- 7:51have no way of knowing which things the
- 7:53new model is going to be better at uh
- 7:55and which things the new model is going
- 7:56to be worse at unless you have a set of
- 7:58evals that you can run things through.
- 8:00Uh, and that's exactly what we're going
- 8:02to do today. We're going to start with
- 8:04uh Claude 4.5 and then we are going to
- 8:06upgrade it to Claude uh Haiku 5.5
- 8:10um uh which was conveniently released
- 8:14like a week ago making this demo
- 8:16extremely easy to put together. I was
- 8:17like I want to upgrade the model for
- 8:19this demo. So I'm going to make that the
- 8:21demo. Uh so with eval you run the suite
- 8:25you can compare the numbers and by the
- 8:26end of the afternoon you know uh whether
- 8:28you can upgrade your model.
- 8:31Um and there are a few kinds of evals.
- 8:33The first kind is code evals. Code evals
- 8:35are fast and free and a little bit
- 8:37brittle. They are very very similar to
- 8:40unit tests. They are just ordinary
- 8:42functions where you basically assert a
- 8:46string. There are a bunch of techniques
- 8:48you can use to make them more flexible
- 8:51than a straight unit test that asserts a
- 8:53basic string. Uh but fundamentally
- 8:55that's what they're doing. So the things
- 8:57that you can test with a Kodi valal are
- 8:59stuff like did the output parse as JSON?
- 9:01Is it under 500 words? Did it mention
- 9:04the thing that I asked about? The
- 9:05advantage of them is that they run in
- 9:07milliseconds and they cost nothing to
- 9:08run. Um,
- 9:11but there are lots of valid answers that
- 9:14a string match can't tell you about. Um,
- 9:17and for that you need the second kind of
- 9:19eval which is the LLM is a judge eval.
- 9:22Uh, which is what most people think
- 9:24about when they're thinking about evals.
- 9:26In this one you use a second LLM to
- 9:28grade the output of the first LLM.
- 9:31[snorts] Um, you grade it against what
- 9:33is called a rubric. There are a bunch of
- 9:35terms in uh eval land that are borrowed
- 9:38from ML uh that I find obscure the
- 9:42meaning of what's going on. One of them
- 9:43is traces and one of them is evals and
- 9:45the other one is rubric. I'm like rubric
- 9:47just means rules. Why do we have a
- 9:49special word for it? Anyway, uh
- 9:53L&M judges understand meaning not just
- 9:56strings. So stuff like is this accurate?
- 9:58Does it stick to the source documents?
- 10:00Is the tone right for a customer? Um,
- 10:03the catch is that because the LLM judge
- 10:06isn't itself an LLM, it has all of the
- 10:08flaws that LLMs have. So, it can be
- 10:10unpredictable. It is never the same
- 10:12twice. Uh, and it can make mistakes. Uh,
- 10:16they also cost money because you're
- 10:18using an LLM. Uh, and they can be
- 10:21confidently wrong. So, you have to check
- 10:23them. And that is one of the things that
- 10:24we're going to do today. Then there's a
- 10:27third kind of eval uh, which is the
- 10:29human eval. somebody who knows the
- 10:31domain, who can read the output and
- 10:34grade it as an expert. Uh, humans are
- 10:36the gold standard for quality. Um,
- 10:39they're also slow and expensive. Uh, and
- 10:42they get bored and start skimming. So,
- 10:45uh, you want to use all three at the
- 10:47same time. These are not competing
- 10:49approaches. They are complimentary
- 10:51approaches. And we're going to talk
- 10:52about a little bit about how you use
- 10:53them in a complimentary way later.
- 10:56So which eval do you use when? Use code
- 11:00when the answer is deterministic. So
- 11:03things like formats and lengths and
- 11:04required fields and band phrases. Uh but
- 11:07use an LLM judge when you need
- 11:09understanding. Is it accurate? Is it
- 11:11grounded? Is it useful? Uh and use
- 11:14humans for the kinds of failures you
- 11:16haven't seen before. Stuff that you
- 11:18haven't anticipated. And to check that
- 11:20your LLM judges are judging correctly.
- 11:24Um, all of that applies to any LLM app,
- 11:26but agents in particular make all of
- 11:28this stuff harder because agents are
- 11:30more complicated. A single simp a single
- 11:33LLM call is relatively simple. You give
- 11:35it an input, you get an output. Uh, but
- 11:38an agent tends to chain a whole bunch of
- 11:40steps together. So, one of the things
- 11:42that can go wrong is very early on in
- 11:45the chain, the agent makes a mistake and
- 11:46it cascades through all of the rest of
- 11:48the steps in your agent and each one
- 11:51gets progressively more off the rails.
- 11:53Um,
- 11:56and one of the biggest problems is being
- 11:58confidently wrong. Confidently wrong is
- 12:00worse than obviously wrong. Uh, so I
- 12:02talked about the cascading failure. Um,
- 12:06one example of that is say you've
- 12:08written a financial analysis agent,
- 12:09which is the kind of agent that I'm
- 12:11going to show you today. Um, and you ask
- 12:14it for a report on Tesla. It searches
- 12:16for Tesla and instead of getting results
- 12:18about the car company, it gets results
- 12:19about the 18th century inventor. It
- 12:22writes an beautiful, perfectly formatted
- 12:24report about an 18th century inventor.
- 12:26Uh, and none of your checks fail because
- 12:30you're like, it's well formatted. It's
- 12:32in a great tone. Everything is
- 12:34grammatical. Uh, it's just about
- 12:36completely the wrong subject. Uh, and
- 12:40that is the kind of failure that is uh
- 12:44um insidious with uh agents.
- 12:48Agents can also fail in the opposite
- 12:49direction. Um, Anthropic uh, who make
- 12:53Claude ran a benchmark called Ta2 bench
- 12:55which simulates customer service
- 12:57conversations and they uh, gave it this
- 13:01task where the user asked to change
- 13:04their flight. Uh, and the test according
- 13:07to the test the user was supposed to
- 13:09fail the test uh, or rather the agent
- 13:12was supposed to fail because uh, the
- 13:14person was in economy and you're not
- 13:16allowed to switch seats in economy. Uh
- 13:18but what cloud found is that they can
- 13:21upgrade the person to first class.
- 13:23You're allowed to change your seat in
- 13:24first class and then they downgraded
- 13:25them back after changing their seat back
- 13:27down to economy. Uh and pass and like
- 13:31did the thing that the user asked for
- 13:33and the test said no you failed because
- 13:34you weren't supposed to be able to do
- 13:36that. Um but the agent had been smarter
- 13:40than the rules that it was in. Um so you
- 13:42have to expect that uh when you are
- 13:45building eval that sometimes the agent
- 13:47is going to come up with a solution to
- 13:48the problem that you did not expect. So
- 13:50your tests have to be very flexible.
- 13:53Um here's what an eval result generally
- 13:57looks like. Uh it comes with a score, it
- 13:59comes with a label and it comes with an
- 14:00explanation. The score is a number
- 14:02usually just zero or one. Uh and the
- 14:05label is just a word that the human can
- 14:07read that matches what the score means.
- 14:09Uh so stuff like pass and fail,
- 14:11actionable and not actionable. Uh and
- 14:13LLM judges add a third thing which is an
- 14:16explanation of why you got the score you
- 14:18did, why you got the label you did. Um
- 14:22and it is the most valuable part of an
- 14:24LLM judge. Uh because the explanation is
- 14:27where the value is. It tells you what
- 14:29was wrong and what was missing and it
- 14:30tells you a a lot of the time what to
- 14:33fix in your prompt to get this right. Uh
- 14:37this is especially useful when you're
- 14:38running your evals at scale because you
- 14:40can get, you know, 50, 100, a thousand
- 14:43explanations from your LLM and you can
- 14:45get another LLM to read all of those
- 14:47explanations and be like, it looks like
- 14:48there is a pattern in these
- 14:49explanations. It looks like we have a
- 14:51systematic problem. And you can just
- 14:52feed them to your agent and your agent
- 14:54goes, okay, I see 50 traces all doing
- 14:56the same all with the same explanation
- 14:58of what went wrong. I can fix it.
- 15:01Um,
- 15:04so this is the loop that we're going to
- 15:05be building today. We're going to trace
- 15:07your agent. We're going to read what it
- 15:08did. We're going to write evals for what
- 15:10matters. Uh, we're going to check that
- 15:11those eval can be trusted. Uh, then
- 15:14we're going to change the agent and
- 15:15we're going to prove that the change
- 15:17worked. Then we're going to lock that in
- 15:19so that it stays fixed by putting it
- 15:21into CI.
- 15:22So, uh,
- 15:25who still needs help getting set up? Who
- 15:28walked in late and needs set up? Show of
- 15:30hands. Okay, let me
- 15:32head back to the setup screen and see if
- 15:35you can get it.
- 15:46Right, this is the magic URL.
- 15:50If you haven't got this one, uh, all you
- 15:52have to do is read the readme and, uh,
- 15:55run the instructions or just, you know,
- 15:56paste the readme into your agent and
- 15:58your agent will read the instructions
- 15:59and get it all done for you. One of the
- 16:02weird things about doing tutorials in
- 16:042026 is that we're just like, well, I
- 16:06could show you how to do all of this
- 16:08stuff, or I could just tell you how to
- 16:09tell your agent to do all of this stuff.
- 16:11Uh, and that's what we do a lot of the
- 16:14time.
- 16:16All right, I'm now going to assume that
- 16:17everybody has that URL. Cool.
- 16:31So let's start with step one. Step one
- 16:33is tracing. Before you can evaluate
- 16:35anything, you need to get the data to
- 16:37run the to run the evaluations on. And
- 16:39that is what that is traces. Today we
- 16:42are going to be using Phoenix. I hope
- 16:44that's not a surprise to anybody by now.
- 16:46Uh, Phoenix is ARIS's open-source AI
- 16:48observability platform. Uh, it collects
- 16:51traces from your AI AI app with in
- 16:54whatever framework you use to build it.
- 16:55It stores your evals next to those
- 16:57traces. Uh, and it gives you a UI to dig
- 16:59through all of it. It also does data
- 17:01sets and experiments, which we're going
- 17:02to be talking about today. Uh, and you
- 17:05run it on your laptop. So, uh, you can
- 17:09keep it entirely private to yourself, or
- 17:11you can run it on a server and share it
- 17:12with your team.
- 17:16So now I'm going to dangerously see if I
- 17:19can actually Oh, that's so that is so
- 17:22small.
- 17:24Let's make that bigger.
- 17:27Okay,
- 17:29so what we're working in today is
- 17:30Typescript. Uh you'll see a ton of
- 17:33examples in Python and Fenix has great
- 17:35Python SDKs as well. Uh but I like
- 17:37JavaScript so we're going to use
- 17:38TypeScript. Um the repo is a small set
- 17:42of uh scripts. Instrumentation.ts
- 17:45sets up tracing. Agent.ts is the agent
- 17:48itself. Prompts.ts has the prompts. Uh
- 17:55where are all of these things? There we
- 17:56go. Um
- 18:00and you'll be editing the prompts in
- 18:01this folder. Uh sorry, in this file. Um
- 18:04and the evals folder is where our evals
- 18:06go. Queries.json is our test data. Uh,
- 18:09and hopefully every step today is just
- 18:11going to be one npm command. Uh, and
- 18:13each one stands on its own. So if you
- 18:15fall behind, you can skip straight to
- 18:16the next one. Uh, and use the seed data
- 18:19that I put in the repo uh, so that you
- 18:21don't get left behind.
- 18:26So what we're building today, or indeed
- 18:28what I've already built for you, is a
- 18:30financial analyst. How it works is you
- 18:32give it a stock ticker and something to
- 18:34focus on like Tesla vehicle deliveries.
- 18:37uh and it will go and it will search the
- 18:38web for live data uh and write you a
- 18:41report about that. Uh there are whole
- 18:44startups built on this idea of giving
- 18:46you you know financial analysis of
- 18:48whether or not you should buy a stock.
- 18:50Uh but ours is deliberately simple
- 18:52because I needed something that would
- 18:54make mistakes so that we could fix the
- 18:56mistakes. Um
- 19:00today is not about how to build an
- 19:01agent. I've just built the agent for
- 19:03you. I assume you've already got an
- 19:04agent running somewhere and your what
- 19:06you want is help on making it reliable.
- 19:09Um, our agent works in two turns. It has
- 19:12a research turn where it searches the
- 19:14web and then it has a writing a report
- 19:16writing turn where it takes the research
- 19:18and it writes the report about it. Um,
- 19:22I'm I've built it using the claude agent
- 19:24SDK. If you haven't used it, that is
- 19:26anthropics framework for agents. Uh it
- 19:28is the same engine that runs underneath
- 19:30cla code which is going to become
- 19:32relevant later especially if you're
- 19:33using claude code to work with it uh
- 19:36because the two versions of cloud code
- 19:37tend to try to cooperate with each other
- 19:39and that makes them cheat the eval which
- 19:41is not very helpful. Um
- 19:45uh it gives you tool use web search uh
- 19:47and conversations that carry on across
- 19:49turns. There are also lots of other
- 19:50options that we are compatible with. The
- 19:52Versel AI SDK, Mastra, Langchain,
- 19:55OpenAI's agent SDK. Uh, Phoenix has
- 19:59adapters and instrumentation for every
- 20:01possible framework that you can think of
- 20:03and every LLM provider that you can
- 20:05possibly think of. Wherever you have
- 20:06built your agent in, Phoenix will work
- 20:08with it and the instrumentation will
- 20:10happen automatically. Uh, but I had to
- 20:12pick one for a demo, so I picked this
- 20:13one. Um, [snorts] tracing takes about
- 20:17five lines. Um, first we're going to
- 20:19call register uh from the Phoenix hotel
- 20:22package that sets up tracing and points
- 20:24it at Phoenix. One of the good things uh
- 20:27about the industry is that everybody has
- 20:30pretty much picked uh the same uh
- 20:33instrumentation standard. uh everything
- 20:36is built on open telemetry in the
- 20:37industry and on top of open telemetry
- 20:39there is a standard called open
- 20:40inference uh which arise takes care of
- 20:44um and everybody has already built the
- 20:46instrumentation into their frameworks
- 20:48that is why we are compatible with all
- 20:49of those frameworks all you have to do
- 20:51is use this registered command to say
- 20:53hey that instrumentation that you've
- 20:56already built into your framework turn
- 20:58it on and point it over here in this
- 21:00case you're just going to point it at
- 21:01your laptop
- 21:03uh and That's all you have to do. Every
- 21:06agent call that our agent makes is now
- 21:07going to be traced. Um,
- 21:11oh, I said that already. Uh, so the good
- 21:14thing about this is that we don't have
- 21:15to write a log line for every single
- 21:17call. We don't have to write a trace for
- 21:18every single thing our agent does. It's
- 21:20just going to do it automatically.
- 21:22Sometimes we will want to add additional
- 21:23information and the framework absolutely
- 21:25supports that. Um, uh, but we don't have
- 21:28to do it for every single thing. Um
- 21:31there's one gotcha in the TypeScript
- 21:34version that you should know about uh
- 21:36which is that manually you should use
- 21:38manually instrument which will hand you
- 21:40back a copy of the instrument uh and you
- 21:42should use the copy of the instrument uh
- 21:45because the cloud agent SDK is an ES
- 21:48module uh and ES module exports are
- 21:51readon. So the instrumentation can't do
- 21:53the thing like it can do in Python where
- 21:55it swaps out your instrument and just
- 21:57changes everything. you have to use the
- 21:58copy that it gives you which has that
- 22:00instrument swapped out. Um
- 22:05it won't break it just won't log
- 22:06anything if you don't use the copy that
- 22:08it gives you. Uh so everywhere in this
- 22:10repo we import claude agent SDK from our
- 22:13instrumentation file never straight from
- 22:15the package.
- 22:17Uh now if you open agent.ts you'll see
- 22:20our agents options. Uh we're going to
- 22:22start using Claude Haiku F 4.5 uh
- 22:25because it is fast, it is cheap, and it
- 22:27is sort of usefully dumb. Um it makes uh
- 22:31mistakes that are nice and predictable
- 22:33even with a relatively simple agent. Um
- 22:37unlike the frontier models which will
- 22:39still definitely make mistakes, but you
- 22:40have to have quite a complicated agent
- 22:42and quite a complicated set of tasks. Uh
- 22:44and it makes it harder for the demo. Um
- 22:48if you've not used it before then uh
- 22:51allowed tools is giving it web search so
- 22:53it can find the current financial data.
- 22:56Uh and the permission mode don't ask
- 22:58means that it's [snorts] uh going to not
- 23:00be interactive. It's not going to pause
- 23:01and ask you questions uh because there's
- 23:04nobody there to say yes. Um that option
- 23:08is going to become relevant uh to a
- 23:10failure mode later. [snorts] Um, and the
- 23:12other three options, like I mentioned,
- 23:14they keep the your laptop out of the
- 23:16agent. The cloud agent SDK, uh, runs the
- 23:18same engine as cloud code. Uh, so if
- 23:21you're doing this in cloud code, it
- 23:23tends to pick up the options that you
- 23:24and the tools and the skills that you've
- 23:26given to your copy of Claude code
- 23:28instead of its copy of Cloud Code. Uh,
- 23:30which tends to make things extremely
- 23:32non-deterministic in an unhelpful way.
- 23:35Uh so I've uh thrown in a couple lines
- 23:38of code there that make sure that the
- 23:40cloud uh the cloud SDK is running in its
- 23:42own isolated version of uh the cloud SDK
- 23:46and not uh stealing your copies of of
- 23:49you know keys and things from your data.
- 23:52Um
- 23:55[sighs]
- 23:57right uh none of that is Phoenix
- 23:59specific by the way. Uh that is just a
- 24:02danger of using the cloud SDK at the
- 24:04same time as you're using cloud code. Um
- 24:08in this SDK one turn is one query call.
- 24:11So you give it a prompt. Uh it streams
- 24:13back messages as the agent works. It
- 24:16thinks it calls a tool. It reads the
- 24:17result. Uh it maybe calls another tool
- 24:20and when it's finished you get a result
- 24:22message with the final text and a
- 24:23session ID. The session ID is how we
- 24:26carry on the conversation. If we pass it
- 24:28back in as resume, the next turn
- 24:30remembers everything that the last turn
- 24:32saw. Uh so that's how we can do the
- 24:34research and then say, hey, write a
- 24:37report on this research because it knows
- 24:39that it's in the same session. Uh and it
- 24:41can find the research that the previous
- 24:42turn just created.
- 24:45Then we put the two turns together. Uh
- 24:47so we get the two turns in one trace. Um
- 24:50first the research turn, then the
- 24:51writing turn, resuming the research turn
- 24:53session so the writer can see everything
- 24:55the researcher found. Um, and then we
- 24:57wrap the whole thing in trace agent. Um,
- 25:00the reason we do that, uh, is because it
- 25:03gives us one parent span that
- 25:05encompasses all of the data. If we
- 25:07didn't do that, we would get two, uh,
- 25:10two, uh, sibling spans in our Phoenix.
- 25:13Um, which would be fine, but slightly
- 25:16harder to read. Uh, so I'm just, uh,
- 25:19shaping the data now to make our lives
- 25:21easier later.
- 25:24Now, if you open up prompts.ts, ts.
- 25:26You'll see that uh there are a bunch of
- 25:27prompts in there. They are deliberately
- 25:29bad. Um there's one line of research
- 25:32instructions, one line of writing
- 25:33instructions. Uh and I did that on
- 25:36purpose because it gives us lots to
- 25:37improve later. Um if you're coding
- 25:40along, now is the time to start playing
- 25:42with things. Feel free to change them.
- 25:43Add stuff like make no mistakes or I
- 25:45will tip you $100.
- 25:47Um allegedly those help. Uh
- 25:52what I want is everyone in the room to
- 25:53end up with a slightly different agent
- 25:55uh so that we get different experiences
- 25:58uh which will make comparing notes more
- 26:00interesting.
- 26:02So now if you've followed along and
- 26:05you've installed everything and
- 26:07everything is going fine uh you should
- 26:09be able to run it. You should run npm
- 26:11run agent dash uh Tesla and then growth
- 26:15outlook in quotes. Um,
- 26:20you can do it on Tesla, you can do it on
- 26:21some other company if you like. Uh, it
- 26:24will take a minute or two because it
- 26:25really does have to actually search the
- 26:26web and you're on conference Wi-Fi. Um,
- 26:29and the model will do a few rounds of
- 26:31reasoning. Um,
- 26:34what's happening here while that's
- 26:36running for you uh is the agent gets the
- 26:39research prompt. It decides that it
- 26:41needs to search uh which is a tool call.
- 26:43It reads the results uh decides whether
- 26:45it has enough results or whether it
- 26:47needs to search again. And that is the
- 26:50thing that makes it an agent. We haven't
- 26:51specified how many times it needs to
- 26:53search the web. We haven't specified
- 26:54what it needs to search the web for. The
- 26:56agent is making those decisions by
- 26:58itself. Uh so all of our agents are
- 27:01going to make slightly different
- 27:02decisions about those things. They're
- 27:04going to use slightly different search
- 27:05terms. Uh they're probably going to
- 27:07search a different number of times. Um,
- 27:10and then once it's done, the writing
- 27:13turn starts and it turns all of that
- 27:14into a report. So the path the agent
- 27:17takes is nondeterministic by by design.
- 27:20Um, both reports might be fine if you
- 27:24run it a if you run it twice. Um, or one
- 27:28might be great and one might be wrong
- 27:29and you can't but you can't predict that
- 27:32uh output from the input. Uh, which is
- 27:34why you need evals. Um,
- 27:39who's got an actual report yet? Anybody?
- 27:43>> Still running. [snorts]
- 27:45>> Okay,
- 27:48we've got time. Let me be brave.
- 27:53And actually try running it myself.
- 27:56One of the problems that we're going to
- 27:58see that the agent runs into is that we
- 27:59told it to write a report, but we didn't
- 28:01tell it where to write a report. And so
- 28:03it assumes that it should be uh writing
- 28:06the report to a file. There we go. So
- 28:09you can see mine. I need permission to
- 28:10write the financial report file. Would
- 28:12you like me to display the report here?
- 28:14This is completely unhelpful. The agent
- 28:16does not understand that it is running
- 28:18in a no permissions environment and that
- 28:20I wanted the report actually output to
- 28:23the command line. Uh and that is because
- 28:25my prompt is ambiguous. Um but sometimes
- 28:28it doesn't do that. Sometimes it does
- 28:30just figure it out and give you the
- 28:31report. Uh, so that is the
- 28:33nondeterminism that we're talking about.
- 28:35So let's see what Phoenix captured from
- 28:38all of this.
- 28:41Here is my Phoenix 101. There is my
- 28:44financial report. This is what a trace
- 28:47looks like. So you can see the financial
- 28:50report agent running and you can see the
- 28:53two invocations of the claude agent. One
- 28:55is the this is the research report. You
- 28:58can see tool searches inside of it to
- 29:01find out whether what it's got available
- 29:03to it. You can then see it finds that
- 29:04it's got a web search tool. So it
- 29:07conducts three different web searches.
- 29:08You can see the inputs and the outputs.
- 29:11Uh what the exact query is, what output
- 29:13it got from each tool call. Uh and then
- 29:16you can see uh that it messed up in this
- 29:19case. uh it tried to write it it wrote a
- 29:22report and then it tried to write it to
- 29:24a file path on my computer and said that
- 29:26it couldn't work. Um
- 29:31so
- 29:33uh
- 29:34the important thing here is that we
- 29:36didn't have to add any logging to our
- 29:37agent. The important thing here is that
- 29:38all of this showed up all of this very
- 29:40useful information about what's going on
- 29:42without us doing anything. We didn't say
- 29:44hey your tools need to be instrumented.
- 29:46We didn't say hey your web searches need
- 29:47to be instrumented. All of that just
- 29:49happens as part of the cloud agent SDK
- 29:50because it's already instrumented for
- 29:52us. Uh and you can click into any span
- 29:55in Phoenix and you can see an enormous
- 29:57amount of data about what's going on. Um
- 30:04uh
- 30:05and the reason that all of this
- 30:06happened, the reason that it's trying to
- 30:08write to disk and then failing is
- 30:09because we gave it that don't ask
- 30:11setting. We told it you're going to be
- 30:12running unattended. Uh don't ask me any
- 30:15questions. it ran without asking any
- 30:17questions and then it messed up. Um,
- 30:21but you wouldn't know that if you hadn't
- 30:22been able to look at the trace, right?
- 30:24You just would have got a mysterious
- 30:25output where it says something was
- 30:27wrong. The traces are where you can see
- 30:30that the tool call is failing. The
- 30:32traces are where you can see it's trying
- 30:33to do something that it's not been given
- 30:35permission to do. Um, and that is the
- 30:39kind of stuff that lives in a span. Uh,
- 30:41so the span kind tells you what type of
- 30:44step it is. So it's an agent tool, an
- 30:46agent, a tool call, an LLM and so on.
- 30:48Um,
- 30:50and in a tool call and a web search and
- 30:53things like that, you can see that our
- 30:54input is in fact JSON. Um,
- 30:58and that's going to make our first eval
- 31:02uh because it gives us some structured
- 31:03data. Um, you also get things like
- 31:06timing and token counts. Um, and uh,
- 31:11often your agent will record what it
- 31:13costs.
- 31:14Um,
- 31:16when we write eval in a bit, these are
- 31:18the fields that we're going to pull out
- 31:19and grade.
- 31:26So, uh, you've run one, you've won one,
- 31:30you've run one test so far. Uh, that is
- 31:34not enough data to draw any conclusions
- 31:35from. So what I want you to do now is
- 31:37run npm run batch uh which will run 15
- 31:40queries in a row. Uh that will take a
- 31:43little while. So I'm going to talk while
- 31:45you're doing that. Um it runs five at a
- 31:48time. It takes three or four minutes
- 31:50optimistically on Wi-Fi. Um so start it
- 31:53now. [snorts] Um if it fails for
- 31:56whatever reason, don't worry about it.
- 31:57The seed project that you loaded earlier
- 31:59uh contains is called Phoenix 101
- 32:02golden. Uh, and it has my 16 runs that I
- 32:05did earlier on reliable Wi-Fi on it. So,
- 32:08you can use those instead if you can't
- 32:10get your batch to run.
- 32:13Um, here are some examples of the
- 32:15queries.
- 32:18Uh, there are obvious ones like Apple,
- 32:20Nvidia, and Amazon. And then there are
- 32:22some edge cases that I put in there to
- 32:23make things fall over. Uh, so one asks
- 32:26it to compare Apple and Microsoft, which
- 32:28is harder than just company covering one
- 32:30company. Uh, one is about Rivian. uh
- 32:33which is not a public company. So
- 32:34there's much less data out there than it
- 32:36does about uh public companies. Um
- 32:39Coca-Cola is a very different type of
- 32:41company from a tech company. Uh and ZZQ
- 32:43isn't a real ticker at all. I just made
- 32:45it up. Um and that is to see what the
- 32:48agent does when it sees a ticker symbol
- 32:50that it doesn't recognize. Does it, you
- 32:51know, invent a company? Does it guess
- 32:53what company you mean or does it say
- 32:56what I'm hoping it says, which is that
- 32:57ticker doesn't exist? Um, one of them is
- 33:00uh about Tesla, but the focus is yo is
- 33:03it a buy right now? Uh, because that is
- 33:06how real people send queries to agents.
- 33:08They do it in slang. Uh, and they don't
- 33:11often specify exactly what it is that
- 33:13they wanted. Um,
- 33:15so these are all, you know, realish
- 33:19looking queries. Um,
- 33:23and what you have to do is, like I said,
- 33:25you have to write down what good means
- 33:28before you measure it. You can't say
- 33:29that your agent doesn't work if you
- 33:31haven't specified what working means.
- 33:34So, for our analyst, uh, what does a
- 33:37good report look like? Um, it should use
- 33:40real current data. It should probably be
- 33:42about the right company. It should stick
- 33:44to what it actually found. Uh, and for
- 33:47my purposes, I want it to tell us what
- 33:49we should do. I want it to say buy or
- 33:53hold or sell this stock. I don't just
- 33:55want it to give me analysis.
- 33:57Um,
- 33:59those sorts of requirements sound
- 34:00obvious once you've written them down,
- 34:02but before that, they could just be
- 34:04vague or different people on your team
- 34:06could have different ideas about what a
- 34:08good financial an analyst agent would
- 34:10do.
- 34:10>> [snorts]
- 34:11>> Uh so writing them down turns vague
- 34:13disappointment into specific things that
- 34:15you can test and we are going to turn
- 34:17every single one of those requirements
- 34:18into an eval today.
- 34:21Defining good is not solely uh an
- 34:25engineering job. If you are defining
- 34:27good for your product, you have to talk
- 34:29to the non-technical stakeholders in
- 34:32your organization because they are the
- 34:33domain experts who are going to know
- 34:36what good looks like. You as an engineer
- 34:38are going to have specific guesses about
- 34:41what uh guesses and biases uh about what
- 34:44makes uh a good agent and what makes
- 34:46good output and you are not always going
- 34:49to agree with the domain experts. So uh
- 34:52the customerf facing people need to be
- 34:54in the room when you define what your
- 34:56agent looks like.
- 34:59Uh it's also great uh if you don't have
- 35:02users that you can make some up. uh you
- 35:05can get an LLM to generate lots of test
- 35:07queries and vary them on purpose. So
- 35:10research Tesla's financial performance
- 35:12is one way to ask what's going on with
- 35:14Tesla stock is another and yo is Tesla
- 35:17by right now is a third. Um then you can
- 35:20get a human to look at the list because
- 35:22LLM generated queries they are a useful
- 35:24way of seeding your initial data. They
- 35:26are not perfect u mostly because they
- 35:30are relatively conservative. They don't
- 35:32go as far a field as human users tend to
- 35:35actually go. Human users are like, you
- 35:37know, tell me what's wrong with, you
- 35:39know, my child's health instead of
- 35:42asking you for a financial analyst and
- 35:43you your agent has to have something to
- 35:45do with that. Um, but synthetic data is
- 35:48a great way to get started once you've
- 35:50got started and you have real users with
- 35:52real traffic. Real traffic is uh the
- 35:55gold standard for testing an agent. you
- 35:57want to get it incorporated into your
- 35:59data set as fast as you possibly can.
- 36:02Um,
- 36:04one aside before we look at the data
- 36:05that I'm hope hoping is arriving in your
- 36:07laptops right now. Um, I walked through
- 36:10tracing by hand because you should
- 36:11understand what it's doing, but you can,
- 36:13like I said, you can also get your
- 36:14coding agent to do all of this. Um,
- 36:17Phoenix has a really good CLI. Uh, and
- 36:19if you run it setup command in your
- 36:21project, it will give your coding agent
- 36:23um, it will get your coding agent to add
- 36:25tracing to your app. uh and it will work
- 36:28until your your app uh has tracing
- 36:31installed and you don't have to figure
- 36:33out how to add the register command and
- 36:34all of that stuff. It will work in every
- 36:36language. Uh it's really neat.
- 36:40So step two is reading your data. Who
- 36:43has any data at this point? Show hands.
- 36:46One person. Anybody else? Oh yeah. Cool.
- 36:49All right. Several people. Fantastic.
- 36:53Uh
- 36:55you have to read your traces before you
- 36:57write a single eval. Um reading a dozen
- 36:59or more of them end to end. Uh what was
- 37:02the input? What was the output? Um what
- 37:04specifically is wrong? This sounds
- 37:07manual and old-fashioned, but it's an
- 37:09incredibly high value high value thing
- 37:11that you can do. Um, when you're
- 37:14building an agent, uh, you have to
- 37:17manually inspect what is going on so
- 37:20that you can find things that you the
- 37:22unknown unknowns that you weren't
- 37:23expecting. Uh, Anthropics team regularly
- 37:27sits down and reads eval transcripts by
- 37:29hand uh, and have built a bunch of
- 37:32tooling internally to make that easy to
- 37:34do. [snorts] Um, if you automate before
- 37:37you understand how your agent fails,
- 37:38you're going to end up measuring what's
- 37:40easy to measure instead of what actually
- 37:42matters.
- 37:44Um, so you should read traces and we're
- 37:46about to do that. But reading traces
- 37:48doesn't scale. Reading 16 traces
- 37:51yourself is absolutely fine. Uh, but
- 37:531600 traces uh is going to give you a
- 37:56bunch of really great data and it's also
- 37:58going to take a week out of your life.
- 38:00Um,
- 38:02but it turns out that coding agents are
- 38:04aces at reading traces. Uh, so you can
- 38:06point your coding agent at your traces
- 38:08and get them to look for things that are
- 38:10weird in your traces. Get them to code
- 38:12stuff up. [snorts] Uh,
- 38:15but they're not always going to find
- 38:16what you expected. So manual inspection
- 38:18as a sampling technique always a really
- 38:20great idea.
- 38:24So, um,
- 38:27if you are using if you're getting the,
- 38:31uh, agent to do stuff for you, you want
- 38:33to install the Phoenix plugin or the
- 38:35Phoenix skill depending on which coding
- 38:36agent you're use you use. It was the
- 38:38last step in the setup readme if you've
- 38:40still got that. Uh, so you may have it
- 38:43already. Um, for cloud code, we have a
- 38:45plugin which is two commands. Uh, there
- 38:47are also plugins for cursor and codeex.
- 38:50Uh, and for any other coding agent,
- 38:51there is a skill file. Um, the plug-in
- 38:54connects your coding agent to your
- 38:56Phoenix. Uh, and it already points at
- 38:58localhost 606, so there's nothing to
- 39:00configure. Um, and Phoenix itself will
- 39:03hand your agent a skill called the
- 39:04Phoenix error analysis skill with
- 39:06instructions on how to do error analysis
- 39:08properly. Um,
- 39:11it should take about 10 seconds to
- 39:13install.
- 39:14Uh, and I'm not going to hang around
- 39:17waiting for you to install it. Um,
- 39:22now open your coding agent and ask it to
- 39:24do the error analysis.
- 39:26Uh,
- 39:29if you've got it. Who's got who's got
- 39:31the skill installed from previously?
- 39:33Fantastic. I'm going to pick on you
- 39:35again. Can you have you asked your
- 39:37coding agent to do things?
- 39:39>> Okay, great. Um, the prompt is on the
- 39:42slide. Tell it where Phoenix is. Tell it
- 39:44to read the traces. Come up with
- 39:45categories of failures. uh count them up
- 39:48and write each category back onto its
- 39:50trace in Phoenix as an annotation. An
- 39:52annotation is just a human readable
- 39:56string of text attached to a trace. Uh
- 39:59they are a way of adding additional
- 40:01information to traces so that either
- 40:04yourself or your agent can figure out
- 40:06what was going on. Um your your plug-in
- 40:09is going to ask permission to use
- 40:10Phoenix's tools. So you should say yes.
- 40:12Uh when I ran it, it took about 9
- 40:15minutes. Uh, so I'm not going to pick on
- 40:17you quite yet. Um,
- 40:22uh, also if it asks to write notes into
- 40:24the repo, uh, that's fine. Just let it
- 40:27write stuff to disk.
- 40:30Now, let's look at Phoenix again.
- 40:35Um,
- 40:37I'm going to very dangerously
- 40:43try and remember my syntax for search.
- 41:00Ha. Okay, so these are all of my runs uh
- 41:04that are the financial reports. Uh we
- 41:07can click into individual ones of them.
- 41:08Let's see if we can find the interesting
- 41:11ones. Uh ZZQ,
- 41:14what was my output for ZZQ?
- 41:18ZZZQ does not appear to be a valid or
- 41:20active financial ticker symbol. Hooray.
- 41:21The agent did the thing that we were
- 41:23expecting it to do. Um
- 41:26how about uh Coca-Cola?
- 41:31First, it starts with the apology. It's
- 41:33running in restricted mode and it cannot
- 41:34write files directly. We're going to
- 41:36have to fix that definitely. Uh then it
- 41:38comes to a conclusion. Coca-Cola
- 41:40represents a high quality, lowrisk
- 41:42dividend investment. Um KO is an
- 41:45excellent long-term income vehicle for
- 41:47riskaverse investors. This one's going
- 41:49to be fun. Show of hands. Who thinks
- 41:52that this is an actionable report?
- 41:57[laughter]
- 41:57Okay, I primed you already. Uh it does
- 42:00not say buy, sell, or hold. So it just
- 42:03says that it's a good investment. That
- 42:04doesn't say what you should do. Uh I'm
- 42:07going to make my standard of
- 42:09actionability for these reports that it
- 42:10should tell me whether I should buy,
- 42:12sell, or hold the stock. I'm not going
- 42:13to leave it to be ambiguous. Um
- 42:19a whole bunch of them do different
- 42:20things in this set. Uh
- 42:23you can see this one had the same
- 42:25problem. It tried to write to disk and
- 42:26it was and it was and it failed. Um,
- 42:31uh, the Rivian trace, I made a note that
- 42:34Rivian was interesting.
- 42:39There it is.
- 42:44Uh, it's full of emojis for some reason.
- 42:46Um, it opens by asking, "Would you like
- 42:50to
- 42:51Yes. Would you like to create the report
- 42:53file?" We saw that earlier when I ran it
- 42:55live. Uh, it's asking me to do things
- 42:57and it can't ask. I told it I told it
- 43:00it's not allowed to and it's asking to
- 43:01do things anyway. Um,
- 43:07all of these things are uh different
- 43:10ways of failing. Lots of these are
- 43:11failures. Lots of these are sort of
- 43:13okay. Um,
- 43:17but then uh there's Tesla.
- 43:23Tesla is particularly fascinating. Uh
- 43:27specifically the yo is Tesla a buy right
- 43:29now one.
- 43:36So in this one uh
- 43:40it says that the analyst consensus is a
- 43:42buy. Uh it says 50% say buy, 52.6% 6%
- 43:48say hold and 13.1% say sell, which adds
- 43:51up to 116% of analysts saying things.
- 43:55And it did not catch that its math was
- 43:57completely wrong. What it did was it did
- 43:59two different web searches. One where it
- 44:01found 50% of people saying something,
- 44:03another one where it found 13% of people
- 44:05saying something. It took those two web
- 44:07searches and it munched them together
- 44:09even though they were not from the same
- 44:10data set and it came up with 116%. But
- 44:14it confidently wrote down that 116% of
- 44:17analysts say something. This is exactly
- 44:20the kind of agentic failure that you
- 44:21see. Uh it is confidently wrong having
- 44:25done uh bad math. Um
- 44:29if you go into these web searches, you
- 44:31can see the specific places where it got
- 44:34the data and how it uh put those things
- 44:36together. Um
- 44:40so when you find a failure, you have to
- 44:42ask why it failed. the answer was wrong
- 44:44is a symptom. It's not a cause. Um
- 44:48with the traces you can see what the
- 44:49actual answer was. Did it get bad search
- 44:51results? That would be a retrieval
- 44:53failure. That is not what happened here.
- 44:54This each search result was fine. Uh did
- 44:57it have the right data but the wrong
- 44:59conclusion? Then that is a reasoning
- 45:00error. That is uh definitely what
- 45:03happened here. Right? It saw two
- 45:05different bits of data and it did not
- 45:07reason correctly about them. Um
- 45:10sometimes it will make numbers up
- 45:11completely. that is a hallucination. Uh
- 45:13and sometimes it will answer a question
- 45:15that isn't the question you asked. So a
- 45:17scope problem. Each cause has a
- 45:19different fix. Uh but if you don't know
- 45:21the cause, you don't know the fix. Which
- 45:23is why reading traces is useful.
- 45:26Um
- 45:28there's a really great way to do this
- 45:30which is
- 45:33let's switch back to slides. Uh you
- 45:36should write notes first and categories
- 45:38second. So look through all of your
- 45:39traces and just write down in human
- 45:41language what you see happening. So this
- 45:43is bad because it does this. This is
- 45:45good because it does that. Uh that is
- 45:48called open coding. Uh another term
- 45:51borrowed from ML. You're just saying uh
- 45:54what you saw. Once you've done that uh
- 45:57you can then do what is called axial
- 45:59coding where you look through all of the
- 46:00notes you've written to yourself and you
- 46:02group them into categories. It is very
- 46:04very tempting as an engineer to g try
- 46:07and guess in advance what the categories
- 46:09are going to be and come up with
- 46:11categories and just put things in
- 46:12categories from the get-go uh because
- 46:14that is less work but you will do worse
- 46:17at it because you will not know in
- 46:19advance what your failure nodes are
- 46:20going to be. Uh so the categories you're
- 46:23going to pick are going to be either too
- 46:24narrow or too broad or just not what not
- 46:26the kind of stuff that actually went
- 46:28wrong. [snorts]
- 46:29Um,
- 46:33while we're talking about this, I talked
- 46:35about how you stack up uh
- 46:39um
- 46:41Kod valves and LLM judgy valves and
- 46:43human evals. Uh this is uh a model
- 46:47barred from the security world called
- 46:49the Swiss cheese model. Um
- 46:53every layer of defense that you have is
- 46:55going to have holes in it. your your
- 46:57every eval you have is going to have a
- 46:59blind spot. What you want to do is uh
- 47:02stack as many eval as you can on top of
- 47:05each other such that it is very hard for
- 47:07an error to get all the way through all
- 47:09of them. Um
- 47:12because they've all got holes but the
- 47:14holes are not in the same place. So if
- 47:16you can uh if you have enough evals, if
- 47:20you have enough different types of check
- 47:22going on, they will stack up on top of
- 47:24each other and be much more reliable.
- 47:27Um so code evals can catch formatting
- 47:30problems, but they will miss problems
- 47:31with meaning. LM judges will catch
- 47:33reasoning gaps, but they will miss some
- 47:34subtle hallucinations. Humans will often
- 47:37catch the subtle stuff, but they can't
- 47:38look at every single trace. So no single
- 47:41method uh is going to catch everything.
- 47:44Um, so today we're building several
- 47:46small evals, not one giant super eval,
- 47:49which is also another failure mode. When
- 47:51people first get into evals, they're
- 47:52like, I'm going to think of every
- 47:54possible thing that can go wrong and I'm
- 47:56going to cram it into one big LLM as a
- 47:57judge, and it's going to find
- 47:59everything. And that is uh a very
- 48:02unreliable and very complicated way of
- 48:04not solving the problem.
- 48:08So, whoops.
- 48:14Uh
- 48:21so the agent may call uh
- 48:25the agent is going to do a whole bunch
- 48:26of stuff. This is what the agent output
- 48:28looks like. I showed you already in
- 48:29Phoenix. Um
- 48:32we've I've already showed you uh the
- 48:34various things that uh it came up with.
- 48:39Um,
- 48:41in this case, uh, my coding agent looked
- 48:45through all of my traces for me. It came
- 48:47up with, uh, both, uh, open coding and
- 48:51aial coding, uh, and it came up with a
- 48:54category, uh, called harness leakage.
- 48:57Uh, harness leakage is what it decided
- 49:00to call that thing where it's constantly
- 49:02asking us to give it permission to do
- 49:04things that it doesn't have permission
- 49:05to do. Um,
- 49:09so, uh,
- 49:12that's a ton of that's a ton of times
- 49:14for that specific thing to happen.
- 49:16[snorts] Um, there are also a bunch it
- 49:18also found a bunch of other things. It
- 49:19found hallucination. It found uh,
- 49:21reasoning errors like the Tesla one
- 49:23where it had too many it added up
- 49:25percentages. Um if you're doing if
- 49:29you've run this data yourself and you've
- 49:30come up with your coding agent has uh
- 49:33produced its own analysis, you're going
- 49:35to get a different analysis and a
- 49:36different set of uh labels. Uh because
- 49:40all of our agents are different. Who has
- 49:42got their coding agent to complete an
- 49:43analysis yet? Anybody still running?
- 49:48>> All right. Well, we'll keep going.
- 49:50Hopefully, you'll get some, but if not,
- 49:52you can just use my seed data.
- 49:56Uh once you've got data, you can count
- 49:58the categories. The most common failure
- 50:00is going to be where you look first, but
- 50:03the most common failure is not
- 50:04necessarily the first thing that you're
- 50:05going to fix. What you want to do is
- 50:07address uh frequency and severity. So if
- 50:12uh you know 40% of the time it
- 50:15hallucinates, that's a problem. If 1% of
- 50:17the time it gives your user instructions
- 50:20on how to build a bomb, you fix that
- 50:22immediately even though it happens only
- 50:231% of the time because that's absolutely
- 50:25not what a financial analyst is supposed
- 50:26to be doing. Uh so you multiply
- 50:29frequency by severity to get your
- 50:31priority.
- 50:32All right, so hopefully your agents will
- 50:35catch up to where we are, but I'm going
- 50:37to keep going. Step three is Kodi
- 50:39valves. Kodi valves are the simple ones.
- 50:41There's no model, there's no API call,
- 50:43there's just TypeScript.
- 50:45Uh the simplest useful eval that I could
- 50:48think of was does the report actually
- 50:50mention the stock that we asked about.
- 50:52Our agent is supposed to analyze a
- 50:54specific company. If it's doing that, it
- 50:56should mention the ticker symbol of the
- 50:57company that it is analyzing. Uh if I
- 51:00ask about Tesla and it writes about
- 51:01Microsoft, which is a thing that it
- 51:03really did on at least one occasion, um
- 51:06that is a completely useless report. So
- 51:08either the ticker report, the ticker is
- 51:10in the report or it isn't. and using an
- 51:12LLM to check that would be complete
- 51:14overkill.
- 51:15Uh
- 51:17so to run that check, the first thing
- 51:19that we need to do do is get our data
- 51:22out of Phoenix so that we can run the
- 51:23analysis. This is how that is done. Um
- 51:26we ask for spans for our project and
- 51:28parent ID null means that only spans
- 51:30that have no parent. Um so those are the
- 51:33top level spans. So the ones that I was
- 51:35showing you in my traces. Um, the repo
- 51:39runs this in a little helper called get
- 51:40agent runs, which hands back each run
- 51:42span ID, its input, and its output, plus
- 51:44the research turns output, uh, which
- 51:46we're going to need later.
- 51:49Uh, and then this is the ticker check.
- 51:52Um,
- 51:53create evaluator comes from the Phoenix
- 51:55evals package. You can just give it an
- 51:57ordinary function. You don't have to
- 51:58build an evaluator function yourself.
- 52:00Uh, all you have to do is tell it that
- 52:02this is a code eval so that no LLM is
- 52:04involved. The function gets the input
- 52:06and the output. It uh splits out the
- 52:08tickers we asked about. Uh it checks
- 52:11that each one appears in the report. Uh
- 52:13and it returns a label and a score. And
- 52:15if something's missing, it also it also
- 52:17says which ticker. So the failure
- 52:19explains itself.
- 52:21Um the structured inputs that I talked
- 52:24about earlier, how we the input being
- 52:26sent uh to our tool was JSON, that is
- 52:29helping us out here because it's making
- 52:30it really easy to write this Kodi val
- 52:32because it's already JSON. So we already
- 52:34know uh which thing is the ticker and
- 52:37which thing is the uh description of the
- 52:40uh report that it should be writing.
- 52:42[snorts] Um so if you can get uh your
- 52:46inputs to be structured data that's
- 52:48going to make your evals really easy to
- 52:50work with. But if not you're going to
- 52:51have to get another LLM involved to read
- 52:53your input figure out what the input was
- 52:55and then pass it to your eval.
- 52:58Uh then we run it and we log the results
- 53:01back to Phoenix. So the script runs the
- 53:03evaluator on every agent run and then it
- 53:05calls log span annotations which
- 53:07attaches each result to its span. Um
- 53:10that's going to be the same pattern for
- 53:11every single eval we run today. You get
- 53:13the runs uh you evaluate them and then
- 53:15you log the results back to Phoenix. Uh
- 53:19so
- 53:21uh the command here is npm run eval
- 53:24code. Let me see if I can get that to
- 53:25work.
- 53:39All right, it worked and it ran almost
- 53:41instantly because it's Kod valves. They
- 53:43don't have to wait for an LLM to do
- 53:44anything. They just go [snorts]
- 53:46uh and it has reported 15 fastes and two
- 53:50failures. One is Tesla is missing Tesla
- 53:52and one is Amazon is missing Amazon. Uh
- 53:56so uh
- 54:00this is the dumbest possible check that
- 54:01we could have made. Did the LLM actually
- 54:03write a report about the thing that we
- 54:05asked it about? Write a report about and
- 54:07it has already found some errors. It has
- 54:09found cases uh where it wrote about the
- 54:12wrong thing. I know for instance that
- 54:14the am the problem with Amazon is uh
- 54:17that it asked it about AWS profitability
- 54:20and the agent got focused on AWS and
- 54:23wrote a report that was only about AWS
- 54:25and what AWS was doing uh and not about
- 54:28what Amazon, you know, the shopping
- 54:30company does. Um so this is a test worth
- 54:35doing and it cost you absolutely nothing
- 54:37to run. So Kod valves aren't toys. So,
- 54:41did the output parses JSON? Is it under
- 54:43the length limit? Does it avoid phrases
- 54:45you never want to see like as an AI
- 54:47language model? Um, and it doesn't have
- 54:50to be a string check. Kodval just means
- 54:52that the grading is deterministic. So,
- 54:55uh, your Kodval can be querying your
- 54:57database to make sure that the state is
- 54:58correct. It can make sure that the tool
- 55:00calls did what the tool calls were
- 55:02supposed to do. uh it can call an API
- 55:05and double check that the stock price uh
- 55:07that the agent thinks is happening is
- 55:09really the stock price. Um anything that
- 55:12gives the same answer for the same input
- 55:14every time can become a Kodi val. So
- 55:16your Kodi valves can be quite advanced.
- 55:19Um but one thing you should be wary of
- 55:21is grading the outcome and not the path.
- 55:24Uh there's a tempting mistake here um to
- 55:27check that the agent took particular
- 55:29steps. Did it call the search tool first
- 55:31and then this other tool? Uh, Anthropic
- 55:34advises that this is too rigid an
- 55:36approach. Uh, like we saw earlier, the
- 55:40agent can be creative. It can do things
- 55:41in an unexpected way. You don't want to
- 55:44assume that it's always going to do
- 55:46exactly what you would have done. Uh, so
- 55:48you don't want to grade the path that it
- 55:50took. You want to grade whether or not
- 55:52the outcome was good.
- 55:55um our ticket check doesn't care how
- 55:57care how the agent found its data right
- 55:59it just cares that the right company is
- 56:01in the report and that is the right
- 56:03level for a lot of evals we will talk
- 56:05later about trajectory level evals where
- 56:07we do actually want to grade the path
- 56:09but that is a very different uh kettle
- 56:11of fish
- 56:13so that brings us to step four the LLM
- 56:16as a judge uh and we're going to start
- 56:19with Phoenix's builtin evals
- 56:22Um
- 56:24code can't check whether code can check
- 56:26whether the ticker is in the report but
- 56:28it can't tell you if the analysis is any
- 56:29good. Uh are the numbers accurate? Is
- 56:31the report report complete? Is the
- 56:33recommendation well reasoned? These are
- 56:35questions about the meaning of the
- 56:37report not the textual content of the
- 56:39report. And for those you need uh
- 56:41something that has judgment. Uh an LLM
- 56:44judge has three parts. It has a judge
- 56:46model which is the LM that is doing the
- 56:47judging. Uh it has a rubric which is the
- 56:50prompt that tells it what good looks
- 56:51like. And then it has the data which is
- 56:53the examples that it's grading. Phoenix
- 56:55keeps those three separate so you can
- 56:57mix and match. You can try the same
- 56:58rules with different models. You can try
- 57:00the same judge with different rules.
- 57:03Uh the good news for you is that Phoenix
- 57:06ships a bunch of built-in evals. So you
- 57:08don't always have to write your own
- 57:10evals, at least not right off the bat.
- 57:12Uh there's correctness which checks if
- 57:14the answer is accurate. Uh there's
- 57:16faithfulness which checks if it sticks
- 57:18to the source material. Uh we're going
- 57:20to see the difference between those two
- 57:21in a second. Uh there's completeness,
- 57:24hallucination, refusal, PII, and
- 57:26toxicity. Lots of things that lots of
- 57:28agents need to check are built in. Uh
- 57:32and for agents, there are evals for tool
- 57:34use. Did it pick the right tool? Did it
- 57:35pass the right arguments? Um did it do
- 57:38something sensible with with the result?
- 57:41Uh these eval are not magical. They are
- 57:45just uh prompts that we've already
- 57:48written and battle tested and made sure
- 57:50work for you.
- 57:52Uh
- 57:55so let's find the judge model. Um
- 58:00uh Phoenix evals in Typescript uh use
- 58:03the Versel AI SDK to talk to models. So
- 58:06any model that the AI SDK supports can
- 58:08be a judge. Uh in this case I'm using
- 58:12Claude Sonnet 5.5. Um, the agent runs on
- 58:15Haiku. Like I said, it's cheap and fast.
- 58:18Our judge is running on Sonnet because
- 58:19you want your judge to be more capable
- 58:21than the agent itself was. So, give it
- 58:24Sonnet or give it Opus. Uh, or give it
- 58:27uh even better um give it a model from
- 58:31uh a different provider entirely. If
- 58:33you've got an OpenAI key, get OpenAI to
- 58:35judge the work of Claude. Uh because
- 58:37Claude has what is known as uh same
- 58:40model bias. So Claude tends to like the
- 58:42output of other versions of Claude uh
- 58:45more than it does the output of uh of
- 58:47OpenAI or some other provider.
- 58:50Um
- 58:52the last line here uh in case you're
- 58:55wondering is suppressing tracing on the
- 58:57judge because we turned on tracing
- 58:59across the board. The judge is itself a
- 59:01copy of Claude. Uh so by default and in
- 59:05fact in my test data you will see that I
- 59:08forgot to turn on uh uh telemetry
- 59:11suppression. So my traces are full of
- 59:13the the judge running itself and and
- 59:16seeing all of the traces from the judge
- 59:18which you don't need. Um
- 59:23so every evaluator in this repo gets it
- 59:26gets this telemetry setting uh so that
- 59:28the judge stays out of uh our agent. Um
- 59:32let's start with correctness. Uh which
- 59:35is the obvious first choice. Is the uh
- 59:37is this report correct? Um that is one
- 59:40import and one line of setup. You don't
- 59:42have to do anything. You just say hey
- 59:44I'm running the correctness evaluator.
- 59:46Run it on my stuff and let's see how it
- 59:48goes. Uh then you call evaluate and you
- 59:51get back a label, a score, and an
- 59:53explanation. And the script runs it on
- 59:54every agent run and logs the results
- 59:56back to Phoenix. Uh the same way we did
- 59:58the ticker check. Uh,
- 1:00:02I should be able to run that as well.
- 1:00:12That's going to take a little while
- 1:00:13because it has to actually do some LLM
- 1:00:15stuff. Uh,
- 1:00:18if it works, it works. If it doesn't, I
- 1:00:20have stuff already built in.
- 1:00:26So you can see uh in my annotations
- 1:00:29column you can see the results of
- 1:00:31various evaluations I've already run. In
- 1:00:33this case it's showing you the uh
- 1:00:35actionability one but you can see uh
- 1:00:38correctness, faithfulness, human
- 1:00:39actionable uh and mention sticker. We're
- 1:00:42going to talk about what all of those
- 1:00:43are. But first you're going to see
- 1:00:44correctness. Uh correctness on all of
- 1:00:48these is zero. Uh,
- 1:00:54all 16 reports have been judged as
- 1:00:56incorrect. And the reason that they've
- 1:00:58been judged as incorrect is because
- 1:01:00Claude judges correctness by what it
- 1:01:03knows. That's the only thing that it has
- 1:01:05available to it. And Claude's knowledge
- 1:01:08cut off uh at the moment is in something
- 1:01:10like January. So uh my agent is talking
- 1:01:14about stock prices in October and Claude
- 1:01:16is freaking out and going, "You're
- 1:01:18talking about stuff that's in the
- 1:01:19future. That's obviously a
- 1:01:20hallucination. This report cannot
- 1:01:22possibly possibly correct. So our
- 1:01:24built-in check for correctness fails
- 1:01:26every single report for that reason. Um
- 1:01:30which is not terribly useful. Um
- 1:01:35so the eval is half wrong and half
- 1:01:37right. Seven of in my data, seven of the
- 1:01:3916 explanations complain that the judge
- 1:01:41can't verify fresh data. Uh which is the
- 1:01:44eval definitely being wrong. Um, but
- 1:01:46lots of them also point out something
- 1:01:48real. Things like the numbers don't add
- 1:01:50up or dates that contradict each other.
- 1:01:52Um, so a score of zero is telling us
- 1:01:55nothing here. It's telling us across the
- 1:01:56board that this that this eval is
- 1:01:58probably not the right choice of eval.
- 1:02:01Um, what we want is a question that the
- 1:02:04judge uh can actually answer.
- 1:02:08So uh
- 1:02:13oh, I told you that already. All right.
- 1:02:15uh what we're going to use instead is
- 1:02:16faithfulness. Faithfulness is asking a
- 1:02:19much better question. It's saying given
- 1:02:20the data that you had, did your did your
- 1:02:23report make sense? Did is the answer
- 1:02:26based in the data that we were given?
- 1:02:28This works much better because it can
- 1:02:29work with data this exactly the same
- 1:02:31data that the agent was given and see if
- 1:02:33it gets a report that makes sense. Uh so
- 1:02:38that's a question the judge can actually
- 1:02:39answer. Uh and the context is already in
- 1:02:41the trace. Every web search is its own
- 1:02:44span like we saw. Um, every research
- 1:02:47turns output is the agent's own notes on
- 1:02:49what it found. So my first version, my
- 1:02:52first eval uh only gave the judge uh the
- 1:02:55research notes and then I read the
- 1:02:57explanations and the judge was flagging
- 1:02:58numbers as made up uh because my version
- 1:03:01of the eval hadn't told it that oh I I
- 1:03:03searched the web and actually found this
- 1:03:05data. Uh so uh in the version you see
- 1:03:08we've given it the full context. um our
- 1:03:12get agent runs helper is going to pull
- 1:03:14both uh the raw search results and the
- 1:03:18notes so that it can see uh what the
- 1:03:22research agent found and how it found
- 1:03:24that data.
- 1:03:27Uh so like I said faithfulness takes
- 1:03:28three things. It takes the input which
- 1:03:30is what the user asked. It takes the
- 1:03:32output which is the report and it takes
- 1:03:33the context which is the search results
- 1:03:35and the notes that I was just talking
- 1:03:36about. [snorts]
- 1:03:37Uh and you run it using the same pattern
- 1:03:40as before. You create the evaluator, you
- 1:03:41evaluate every run, you log the results.
- 1:03:44Um,
- 1:03:46like I said, it's slower than
- 1:03:47correctness uh because the judge is
- 1:03:50reading every search. Uh, who has got
- 1:03:53any results out of their uh eval so far?
- 1:03:58Again, you've got a faster Wi-Fi
- 1:04:00connection than everybody else. Anybody
- 1:04:01else?
- 1:04:04Cool.
- 1:04:06Um,
- 1:04:08so let's look in Phoenix at my
- 1:04:10faithfulness reports. Um,
- 1:04:16I got a lot of zeros on faithfulness,
- 1:04:17but not all of them.
- 1:04:22Um,
- 1:04:23let's read the Microsoft explanation.
- 1:04:26That was the one that I read that was
- 1:04:27most interesting.
- 1:04:30Uh, as you can see, next to each one,
- 1:04:32you get the explanation. Um, so in this
- 1:04:35one, the response adds several claims
- 1:04:37that the context does not support. Azure
- 1:04:39is the number two cloud provider. The
- 1:04:41backlog gives three years of visibility
- 1:04:43and there are implied FY202 targets. Uh,
- 1:04:50it is telling me what it doesn't like
- 1:04:52about uh this thing. It does it's
- 1:04:55telling me why it thinks this thing is
- 1:04:56unfaithful. Um,
- 1:05:00it's complaining that uh some of the
- 1:05:042027 targets are fabricated because
- 1:05:06they're not in any search results. Uh,
- 1:05:09the Nvidia one is also interesting
- 1:05:14if I can find that one.
- 1:05:20Right. In this one, it says the response
- 1:05:22conflates two different data points.
- 1:05:23This is a reasoning error that the agent
- 1:05:25that the judge has uh accurately found.
- 1:05:28Um
- 1:05:31it says the context information this is
- 1:05:33fabricated. These are much more useful
- 1:05:35results. We've got uh 14 out of 16 uh
- 1:05:39reports marked as unfaithful here, but
- 1:05:41the explanations are way more useful. Uh
- 1:05:44and it's actually doing the thing that
- 1:05:45we wanted it to do. Um
- 1:05:50so for agents, you can also grade the
- 1:05:51tool calls. Uh so we saw the web search
- 1:05:54spans inside each trace. Phoenix has
- 1:05:56built-in evals for all of those as well.
- 1:05:59Tool selection asks did the agent pick
- 1:06:01the right tool uh or search when it
- 1:06:04didn't need to. Tool invocation asks did
- 1:06:06it pass sensible arguments to those
- 1:06:08tools like a search query that's
- 1:06:10actually about the company. And tool
- 1:06:12response handling asks did it do
- 1:06:13something sensible uh with the result of
- 1:06:16that call.
- 1:06:17Uh these are the decisions that can make
- 1:06:19a break make or break an agent. Um, and
- 1:06:23they all happen before the report
- 1:06:24actually gets read. Uh, and we already
- 1:06:27know our agent makes strange tool
- 1:06:28choices sometimes, like it tries to save
- 1:06:30the report to a file. Uh, so we can see
- 1:06:33if our built-in eval catches that. Uh,
- 1:06:37I'm not going to run this one, but you
- 1:06:38can run that one. Um, tool selection
- 1:06:41takes three things. What the agent was
- 1:06:43asked, which tools it could have used,
- 1:06:44and which ones it picked. Uh and the
- 1:06:46script goes through every agent turn and
- 1:06:48every trace research and writing
- 1:06:49separately and collects the tool spans
- 1:06:51underneath each one. Um the trace
- 1:06:54records which tools the agent called but
- 1:06:57not which ones it could have called. So
- 1:06:58we have to write that list ourselves uh
- 1:07:01in tool selection.ts.
- 1:07:03Uh then it is uh the same pattern as
- 1:07:06every other run. Uh so npm run eval
- 1:07:10tools uh and then you're done. Uh that
- 1:07:12one should take about 15 seconds.
- 1:07:17So, let's look in Phoenix at
- 1:07:20tool selection.
- 1:07:38Tool selection. It's helping me out.
- 1:07:44All right. So, these are ones where it
- 1:07:46has decided that my tool selection was
- 1:07:48incorrect for whatever reason. Uh, the
- 1:07:51user asked for a concise report based on
- 1:07:53prior research. Writing it to a file
- 1:07:55with write is plausible and appropriate
- 1:07:57since write exists and is safe. Uh,
- 1:07:59however, the LLM made a second redundant
- 1:08:02bash call. Awesome. Uh, yeah, it sure
- 1:08:06did. Um,
- 1:08:09the judge failed six that tried twice.
- 1:08:12It passed seven. Six of the seven that
- 1:08:14tried once. Uh
- 1:08:16uh overall 13 of my 16 writing turns
- 1:08:19tried to save a file. Um
- 1:08:25and only one of these explanations said
- 1:08:27that the user never asked for a file to
- 1:08:30be saved. So uh is this judge incorrect?
- 1:08:34Is the judge uh accurately judging that
- 1:08:37the tool call was correct? Um, our
- 1:08:40writing prompt said, "Write a concise
- 1:08:43financial report based on your research
- 1:08:45above." Our prompt is genuinely
- 1:08:47ambiguous here. We said, "Write, we
- 1:08:49didn't say where to write it to. We
- 1:08:51didn't say what to write it for. Uh, we
- 1:08:53didn't say who the audience was going to
- 1:08:54be." So, the tool selection knows that
- 1:08:56and is looking at the input and is
- 1:08:57going, "Well, it seems a reasonable
- 1:08:59thing for the agent to try and write to
- 1:09:01disk here." Uh so again what you're
- 1:09:06telling the agent to do and what you're
- 1:09:08telling the eval to do interact with
- 1:09:10each other. Uh you can't necessarily
- 1:09:13trust that the tool call invocation is
- 1:09:15going to be right because in this case
- 1:09:17the tool call is citing the tool call
- 1:09:19eval is siding with the agent. It's like
- 1:09:21no the the agent is right. The agent
- 1:09:23gave us instructions uh the agent
- 1:09:26received instructions and did its best
- 1:09:27is basically the eval's position. Uh,
- 1:09:34eval results live in the trace as well.
- 1:09:37Um,
- 1:09:39so if you're looking at the traces in
- 1:09:41Phoenix, uh, you can see them here
- 1:09:44attached to which trace they got, which
- 1:09:47span in the trace they got attached to.
- 1:09:48So you see actionability and correctness
- 1:09:50got attached to the root. Uh, whereas
- 1:09:52tool selection is getting attached to
- 1:09:54the specific uh, turn that made that
- 1:09:57tool call.
- 1:09:58Um, you can filter your traces by any
- 1:10:01eval. Uh, you can sort by score to find
- 1:10:03your worst runs. You can click straight
- 1:10:05from a failing score into the step that
- 1:10:06caused it. Uh, from score to from score
- 1:10:09to cause in one click. Uh, so all of
- 1:10:12that is the built-in eval.
- 1:10:15Um,
- 1:10:17and the lesson here is that choosing the
- 1:10:19right eval beats tuning it. Choosing
- 1:10:21correctness was entirely the wrong eval.
- 1:10:23It didn't tell us anything. It just told
- 1:10:24us a bunch of stuff was wrong. tool
- 1:10:26selection did tell us something uh and
- 1:10:28faithfulness told us quite a lot. Um
- 1:10:33so checking the right eval beats tuning
- 1:10:35it uh and knowing which question you're
- 1:10:37actually asking is really the core of
- 1:10:40getting this right
- 1:10:42which brings us to step five which is
- 1:10:44writing your own judge. This is where
- 1:10:45the eval get specific to your
- 1:10:47application.
- 1:10:49Uh, and again, this is when people are
- 1:10:51thinking about evals, this is what most
- 1:10:53people are thinking about, but I wanted
- 1:10:55to make sure that you got the basics in
- 1:10:56first. You don't have to jump straight
- 1:10:58to writing a custom rubric. You can
- 1:11:00write code evals to get a bunch of stuff
- 1:11:02out of the way. You can write uh you can
- 1:11:04use built-in eval to do a bunch of
- 1:11:06obvious stuff without having to invent
- 1:11:08your own tool calling correctness uh uh
- 1:11:12evaluator.
- 1:11:13Um,
- 1:11:16what I wanted my report to do was give
- 1:11:18me a buy, sell, or hold recommendation.
- 1:11:20There is no built-in eval that checks
- 1:11:22for that because that would be a very
- 1:11:23specific thing indeed. So, we're going
- 1:11:25to write our own. Uh, every eval prompt
- 1:11:28I've seen that works well has five
- 1:11:30different parts and we're going to go
- 1:11:32through them one at a time. The first
- 1:11:34part is you give the judge a role and
- 1:11:37context. Uh, a thing you'll see all the
- 1:11:40time is you are an expert blah blah blah
- 1:11:42blah blah. That does actually work.
- 1:11:45That's why everybody puts it in there.
- 1:11:46Like it helps a little bit to tell the
- 1:11:48to tell the agent what it is. Uh,
- 1:11:51telling it it's an expert as opposed to
- 1:11:53just telling it that it is running up
- 1:11:55something else also seems to make a
- 1:11:57difference when they do sideby-side
- 1:11:59comparisons. Um, it's just one of the
- 1:12:02weird things about LLMs. You need to
- 1:12:03tell it it's really smart and it gets
- 1:12:04like confident and tries. Um
- 1:12:09uh but what really matters is the
- 1:12:10context. Um this is a financial report.
- 1:12:14Uh we are expecting a report that that
- 1:12:17analyzes financial data and tells us
- 1:12:19real things. Um
- 1:12:21and specifically what we care about is
- 1:12:23whether or not you could act on it. So
- 1:12:26uh that gives us the explicit criteria
- 1:12:28that we include in our rubric. Um so
- 1:12:32this is where a lot of people don't put
- 1:12:33in enough effort. So don't write a good
- 1:12:36response is helpful and accurate because
- 1:12:38uh a judge doesn't know what helpful and
- 1:12:40it doesn't know what accurate means in
- 1:12:42this context. Um a judge can't make a
- 1:12:45yes or no decision from that. Write down
- 1:12:48exactly what makes a report actionable.
- 1:12:50Uh so it makes a specific
- 1:12:52recommendation. It names concrete risks
- 1:12:54and it looks forward not just back.
- 1:12:56Those are things that a judge can look
- 1:12:57at and actually check.
- 1:13:00Uh, and note that we're not just making
- 1:13:03up these things blind. Um, your criteria
- 1:13:06come from your error analysis. Uh, only
- 1:13:10summarizes data with no interpretation
- 1:13:12is a problem that we saw when we were
- 1:13:13reading our traces. We are putting that
- 1:13:15in there because it's a problem that we
- 1:13:16are trying to avoid. Um, that is the
- 1:13:20whole point of reading the data first.
- 1:13:21Specific criteria give you consistent
- 1:13:24judgments and you get specific criteria
- 1:13:26by knowing in advance what the data is
- 1:13:28going to look like because you read it
- 1:13:29yourself.
- 1:13:31Part three of a good rubric is to mark
- 1:13:34the data clearly. Wrap each piece of
- 1:13:35data in its own XML tag. Claude was
- 1:13:38trained on billions and billions of XML
- 1:13:40tags and it's really good at working
- 1:13:41with them. Um,
- 1:13:44if you look into the code at our own
- 1:13:46rubrics, that's what we're doing. uh our
- 1:13:48own prompts [snorts] uh wrap everything
- 1:13:50in XML tags. Um and the double curly
- 1:13:54braces are template variables that
- 1:13:55Phoenix fills in uh with each span's
- 1:13:58input and outputs. Uh the reason you do
- 1:14:01this is because you want clear
- 1:14:02boundaries between what is the input,
- 1:14:04what is the output, and what is your
- 1:14:05instructions. Uh this helps against
- 1:14:07prompt injection, but it also helps uh
- 1:14:10the agent just getting confused. uh in
- 1:14:12particular it helps you get con uh if
- 1:14:15you include examples which we're going
- 1:14:16to see mark the example as an example
- 1:14:19and not the data otherwise it will get
- 1:14:21very confused about that um I love to
- 1:14:25include labeled examples but it is in
- 1:14:26fact a controversial proc uh a
- 1:14:28controversial practice uh in the eval
- 1:14:32world um
- 1:14:35criteria tell the judge what you mean in
- 1:14:37the abstract but examples show it
- 1:14:39exactly what you mean as a human, I find
- 1:14:42it much easier to do something when
- 1:14:43somebody has shown me an example of how
- 1:14:45it's supposed to work than if they've
- 1:14:47just given me a list of instructions of
- 1:14:49how to work. Uh, and, uh, a lot of LLMs
- 1:14:53feel that way as well, apparently. Um,
- 1:14:57so when you test your rubric, uh, which
- 1:15:00we're going to do in the next step, uh,
- 1:15:02test it with examples and without
- 1:15:03examples and see which one does better.
- 1:15:07Uh, because sometimes, uh, examples are
- 1:15:10going to help it do a better job. And
- 1:15:11sometimes, uh, an example will make it
- 1:15:14overfit. It will look at your examples
- 1:15:17and say, well, it doesn't look exactly
- 1:15:18like my example. Or it will try and make
- 1:15:19every output look like your output
- 1:15:21example. Uh, which is less helpful.
- 1:15:24Um, I ran exactly that test on mine. Uh,
- 1:15:28so in the rubric that I used, um, this
- 1:15:32was fascinating in a really nerdy way,
- 1:15:34which is why I included it. Uh, I threw
- 1:15:36out my examples and with the examples,
- 1:15:38the judge agreed with me, uh, 15, 15,
- 1:15:41and 15 times out of 16 in three
- 1:15:43different runs. Uh, and if I threw out
- 1:15:46the examples, it agreed with me 16 times
- 1:15:48twice, all 16 examples, and 15 times
- 1:15:52once. Uh and so I was like I was very
- 1:15:55curious as to how throwing out the
- 1:15:56examples made it better. Uh and the
- 1:15:59specific problem that it was having is
- 1:16:01that in one of the reports it did not
- 1:16:05include
- 1:16:06um
- 1:16:08uh it did not include a list of risks.
- 1:16:10So as a human I read the report and it
- 1:16:13was like Microsoft is a buy and it
- 1:16:15didn't include any risks and I was like
- 1:16:17that's fine. It's still actionable. It
- 1:16:18included a buy. Uh so I marked it as uh
- 1:16:21an actionable report. Uh but my examples
- 1:16:25said you must include risks. And so the
- 1:16:27agent uh the LLM judge was looking at
- 1:16:31the rules and and looking at the
- 1:16:32examples and saying there must be risks
- 1:16:34in here. So this is not actionable
- 1:16:36because there's no risks. So that's
- 1:16:39genuinely an open question as to whether
- 1:16:41or not my human judgment was better or
- 1:16:43worse than the judges. The judge was
- 1:16:45being very strict and I was being loosey
- 1:16:48goosey when I as a human gave myself
- 1:16:50golden data.
- 1:16:51>> Sorry, can I ask a question?
- 1:16:53>> Sure.
- 1:16:53>> So what's your hypothesis then as to
- 1:16:56without the examples
- 1:16:58it agreed with you so it saw that
- 1:17:01Microsoft as being actionable?
- 1:17:03>> Yeah.
- 1:17:03>> Is that is that your hypothesis then
- 1:17:05that like simply because you didn't say
- 1:17:07risk was a necessary element it felt
- 1:17:10that that was a good actionable? I mean,
- 1:17:13it's not a hypothesis like the LLM judge
- 1:17:15comes with an explanation. So, it says
- 1:17:17>> So, it said that that was actionable,
- 1:17:19>> right?
- 1:17:22>> Yeah. So, like I said, in this case,
- 1:17:25it's genuinely unclear whether or not I
- 1:17:28was doing the right thing or the judge
- 1:17:29was doing the right thing. The judge
- 1:17:30decided to interpret the the rubric very
- 1:17:33strictly and I when I was marking these
- 1:17:35things as human actionable or not, uh
- 1:17:38was not being as strict.
- 1:17:41Um,
- 1:17:44here's an example of an actionable one.
- 1:17:46Uh, it has specific numbers. It has
- 1:17:48revenue growth. Uh, it has valuation
- 1:17:50compared to its sector. It names a
- 1:17:52concrete risk. And it ends with a
- 1:17:53recommendation you could actually
- 1:17:54follow, including when you'd change your
- 1:17:56mind. Um, and this is what a not
- 1:17:59actionable one looks like. It isn't
- 1:18:00wrong. Everything in it is is true. It's
- 1:18:03just not very useless. Investors should
- 1:18:05consider various faction uh factors is
- 1:18:08not a recommendation. Um, now that the
- 1:18:11judge has seen both, the hope is that
- 1:18:13it's more consistent on reports that
- 1:18:14fall somewhere in between. Uh, and
- 1:18:17whether it actually is, you find out by
- 1:18:18testing.
- 1:18:20Uh, part five of putting together a
- 1:18:22rubric is you constrain the answer. You
- 1:18:24ask it for things that are actionable or
- 1:18:26not actionable. A thing you used to have
- 1:18:29to do is you used to have to say output
- 1:18:31a string and the string must be the word
- 1:18:32actionable or not actionable. Uh, you
- 1:18:35don't have to do that anymore. what uh
- 1:18:38modern evaluators use tool calls uh to
- 1:18:41put their output. So those uh the
- 1:18:44choices available for that tool call are
- 1:18:46defined in the tool call and not in your
- 1:18:49rubric. Uh which makes them a lot more
- 1:18:51reliable.
- 1:18:54So now it is your turn to write the
- 1:18:56rubric. Uh open evalactionability.ts.
- 1:19:00Uh it has my rubric in it with all five
- 1:19:02parts. Um and you can make it yours. You
- 1:19:05can change the criteria. You can change
- 1:19:06the examples. Uh
- 1:19:09what would make you act on one of these
- 1:19:11reports? What did you see in your own
- 1:19:13traces? Write that down and that should
- 1:19:15become your rubric. Um it will take
- 1:19:18three or four minutes to run. Who has
- 1:19:20managed to stay up with me so far? Like
- 1:19:22who is at this point? Excellent. I have
- 1:19:25multiple hands. Uh like I said, the last
- 1:19:29time I did this workshop, everyone was
- 1:19:31completely lost because the 200 megabyte
- 1:19:34repo. So the fact that anyone's got it
- 1:19:35this is just great for me. Um
- 1:19:40this is how you wire it up. You create a
- 1:19:41classification evaluator which does all
- 1:19:43the plumbing. Uh you give it a name, you
- 1:19:45give it the model. Uh you give it your
- 1:19:49template. Uh and like I said uh out of
- 1:19:52band you give it its out its options. So
- 1:19:54you give it its choices which are
- 1:19:56actionable with a score of one and not
- 1:19:58actionable with a score of zero.
- 1:20:00Um,
- 1:20:03so let's look at actionability in
- 1:20:05Phoenix. [snorts]
- 1:20:22It's so cold in here that my fingers
- 1:20:24have gone all numb and I can't type
- 1:20:25properly.
- 1:20:28Okay.
- 1:20:36So, the report analyzes JPM's rate
- 1:20:38exposure and loan growth uh and a
- 1:20:40forward-looking output, but makes no
- 1:20:42buy, hold, sell recommendations.
- 1:20:44Fantastic. It's doing exactly what it's
- 1:20:45supposed to do. Uh it is complaining
- 1:20:48about uh the lack of recommendation of
- 1:20:50concrete recommendations. Um
- 1:21:00before we look at all of these
- 1:21:01recommendations, we should look at the
- 1:21:02split in the recommendations. Uh in my
- 1:21:05data, five of 16 reports were actionable
- 1:21:08and 11 were counted as not actionable.
- 1:21:11Uh and that is one of the most useful
- 1:21:14types of evals you can get. An eval
- 1:21:16where everything is perfect is not
- 1:21:18particularly helpful. An EVA where
- 1:21:20everything is wrong is also equally
- 1:21:22unhelpful. An EVA where you've got an
- 1:21:24even split that is a hill that you can
- 1:21:26climb. You've suddenly got uh some
- 1:21:28you've got a def a set of examples where
- 1:21:31things are actually working, a set of
- 1:21:33things where uh stuff isn't working and
- 1:21:35you can start figuring out the
- 1:21:37differences between them. Um
- 1:21:43so if you click through these traces,
- 1:21:45I'm not going to bother clicking through
- 1:21:46all these traces. In Rivian it says it
- 1:21:48never makes a buy, hold, sell
- 1:21:49recommendation or any equivalent next
- 1:21:51step. For Nvidia, it said the closing
- 1:21:54investment thesis risk level is
- 1:21:56moderate, is vague rating, not guidance.
- 1:21:58And uh for Meta, the verdict is the is
- 1:22:02only that the position is solid. So this
- 1:22:04is the same problem over and over. It is
- 1:22:06refusing to give concrete buy, sell,
- 1:22:08hold recommendations.
- 1:22:10Um,
- 1:22:14if we
- 1:22:16uh we can open the Phoenix prompt
- 1:22:18template. I'm not going to do it now.
- 1:22:20Um, but uh there's one more rule for
- 1:22:25rubrics, which is that you should treat
- 1:22:26eval prompts as code. Your eval prompts
- 1:22:29going into your into your custom eval
- 1:22:32are extremely sensitive to small changes
- 1:22:34in wording. Um,
- 1:22:37so, uh, one example of that I ran into
- 1:22:41while making this was, uh, I told you
- 1:22:43that you should put XML tags around
- 1:22:45stuff. I forgot to put XML tags around
- 1:22:47my examples to begin with. Uh, and with
- 1:22:51my examples as plain text, uh, I got a
- 1:22:54string of not actionable stuff, uh,
- 1:22:56because it was getting confused about
- 1:22:58what the data was and what my examples
- 1:23:00were. And when I wrapped them in XML
- 1:23:02tags, everything suddenly became
- 1:23:04actionable because it could tell what I
- 1:23:05was talking about. Um,
- 1:23:09this is there was no other change. I'd
- 1:23:12given it the same data, the same
- 1:23:13instructions, the same input and the
- 1:23:15same output every time. Uh, it just got
- 1:23:17less confused in the evaluator as to
- 1:23:20what was happening. Uh, so you have to
- 1:23:23treat your evals as code. You should
- 1:23:25version them, you should check them, and
- 1:23:26you should test them.
- 1:23:29Um, as I mentioned earlier, uh, there is
- 1:23:33a trap to fall into with evaluators,
- 1:23:34which is to try and write write one
- 1:23:36evaluator that does everything for you.
- 1:23:38It is called the god evaluator because
- 1:23:40it is such a a common pattern. Uh, you
- 1:23:43try and get it to check accuracy, tone,
- 1:23:45completeness, formatting, policy all in
- 1:23:47a single prompt. Uh, and it is a
- 1:23:49nightmare because if it fails, what
- 1:23:52thing failed? Was it inaccurate? Was the
- 1:23:53the tone wrong? Was the faithfulness
- 1:23:55wrong? which of the many many many
- 1:23:56things that you've told this god
- 1:23:58evaluator to evaluate is it actually
- 1:24:00wrong and you try and solve that by
- 1:24:02giving it 15 labels that it can spit out
- 1:24:05uh and the whole thing becomes very hard
- 1:24:07to track. Uh the best practice is to
- 1:24:10split this up split your evaluators into
- 1:24:13as many dimensions as you are testing.
- 1:24:15So one for faithfulness, one for
- 1:24:16correctness, one for actionability.
- 1:24:19Um,
- 1:24:21and you should also know which one of
- 1:24:22your evals is a guardrail and which one
- 1:24:24is a north star. So, a guardrail is
- 1:24:26something that should block the release.
- 1:24:28So, if the agent is making up a stock
- 1:24:30price, that should halt shipping. Uh,
- 1:24:34but north stars are things that you're
- 1:24:36aiming for. So, suggests other stocks
- 1:24:38worth a look would be nice to have. That
- 1:24:40would be a good thing to include. Your
- 1:24:41eval can look for that, but it doesn't
- 1:24:43have to gate shipping on that.
- 1:24:47Which brings us to step six, which is
- 1:24:49testing your tests. We've built a judge
- 1:24:51and it says that some of our reports
- 1:24:52aren't actionable. Uh but can we trust
- 1:24:55the judge? How do we know that the judge
- 1:24:57is right? Uh the trick to remember is
- 1:25:00that your judge is a classifier in the
- 1:25:02classic ML sense. Uh it is looking at a
- 1:25:05report and it is predicting a label as
- 1:25:07actionable or not actionable.
- 1:25:08Predictions uh can be right or wrong. So
- 1:25:12like any classifier, you measure it by
- 1:25:14comparing its predictions with the
- 1:25:15truth. Uh, and here the truth is what a
- 1:25:17human expert would say. You get to judge
- 1:25:20uh you get to mark the judge's homework.
- 1:25:23Uh,
- 1:25:24in this case, the human expert is going
- 1:25:26to be me. I'm going to be deciding
- 1:25:27whether or not stocks are buy, sell, or
- 1:25:29hold. Uh, not necessarily the expert
- 1:25:33that you want. Uh, but we're doing our
- 1:25:36best. It's just a demo. Um, how you do
- 1:25:39this is very simple. You open up a
- 1:25:42trace.
- 1:25:44uh you click the little pencil button
- 1:25:46and you can add annotations. So I have
- 1:25:50created an annotation in advance called
- 1:25:52human actionable uh and I can set it to
- 1:25:55actionable or not actionable and I can
- 1:25:58very quickly
- 1:26:00uh click through all of my traces and
- 1:26:02set that on each one which I've done in
- 1:26:04advance. Uh this is where you would get
- 1:26:07uh a domain expert involved. You would
- 1:26:09throw them at Phoenix. You'd say here
- 1:26:11are 10 traces, here are 20 traces.
- 1:26:13there's 50 traces. Go through and read
- 1:26:15the output and give me give me your
- 1:26:17golden data set about whether or not
- 1:26:18these things are good. Um,
- 1:26:24[snorts]
- 1:26:25I sat down and labeled all 16 of my
- 1:26:27reports properly against the same
- 1:26:28criteria that I gave the judge. Uh, and
- 1:26:30those are sitting in your seed project
- 1:26:32so that you don't have to do that
- 1:26:33because that would take you a long time.
- 1:26:36Um, what you're building when you do
- 1:26:37this, like I said, is called a golden
- 1:26:39data set. Uh it's examples where to the
- 1:26:42best of human knowledge you know that
- 1:26:44the answers are right. Um it is a lot of
- 1:26:47work so you should make that work count.
- 1:26:50So you should give yourself the same
- 1:26:52specific criteria that you gave the
- 1:26:54judge. That was the error that we were
- 1:26:56talking about earlier. Uh where I was
- 1:26:59not exactly reading the rules that I had
- 1:27:01put into my eval criteria. Right? I was
- 1:27:04disobeying one of my own rules. my rule
- 1:27:06said uh must include risks and I said
- 1:27:10that this report is fine even though it
- 1:27:11doesn't include risks. Uh and as a
- 1:27:13result me and the judge disagreed and I
- 1:27:15feel like the judge was actually more
- 1:27:17correct than I was. It was being
- 1:27:18stricter. Um so uh your enemy here is
- 1:27:24fatigue. Uh if you give yourself a
- 1:27:27hundred traces to judge by trace 50,
- 1:27:30you're going to be really bored of
- 1:27:31judging traces and you're going to get
- 1:27:32lazier about it. Uh so it is better to
- 1:27:36have 50 really well-labeled
- 1:27:39uh examples than a hundred where you
- 1:27:41were just clicking through and saying ah
- 1:27:42this looks fine. Uh the the higher the
- 1:27:46quality the data in your golden data set
- 1:27:48uh the more reliable everything is going
- 1:27:50to be.
- 1:27:52Um
- 1:27:53and one of the best things that you can
- 1:27:55do is that uh is continuously add to
- 1:27:57your golden data set. when you see a
- 1:27:58tricky example, when you see something
- 1:28:00strange happen in production, figure out
- 1:28:02what the answer should have been and put
- 1:28:03it into your golden data set.
- 1:28:06Uh, a few good rules for human go for a
- 1:28:08good golden data set is that you should
- 1:28:10write test tasks a human could pass. Uh,
- 1:28:13if your agent fails a task every single
- 1:28:15time, that is almost always going to be
- 1:28:17a broken task, not a broken agent. Um,
- 1:28:20and for each task, you should have an
- 1:28:22answer that you know is good, which
- 1:28:24proves the task can be done. Uh, you
- 1:28:26should also test in both directions. If
- 1:28:28you only check, for instance, that the
- 1:28:30agent searches the web when it's
- 1:28:31supposed to search the web, you're going
- 1:28:33to accidentally train your agent to
- 1:28:34search the web every single time, all
- 1:28:36the time, even when it doesn't need to.
- 1:28:40Uh, and here's a rule from machine
- 1:28:42learning that applies to judges as well.
- 1:28:43Don't tune on your test set. Uh, split
- 1:28:46your labels into two groups. One that
- 1:28:48you use to tune your evals and one that
- 1:28:51you use to test that they are working.
- 1:28:54Uh when you only have 16 answers in your
- 1:28:56golden data set, that makes it your test
- 1:28:57set very small. Uh because the rule is
- 1:29:00usually 75% in the tuning set, 25% in
- 1:29:03the test set. So there's only four in
- 1:29:05our test set. Uh but if you were up to
- 1:29:08100, that would be fine. Um
- 1:29:12Phoenix data sets have splits built in.
- 1:29:13So this is very easy to do. Uh
- 1:29:17see what that looks like.
- 1:29:20uh
- 1:29:22so first it builds the golden data set
- 1:29:24with splits. It finds every report with
- 1:29:26a human label. Uh
- 1:29:30uh and each one becomes an example in a
- 1:29:31Phoenix data set. The input is the
- 1:29:33report. The expected output is the
- 1:29:35human's label. We sort them by span ID.
- 1:29:37Then every fourth example goes into the
- 1:29:39test split and the rest go into dev. Uh
- 1:29:42sorting first means that a report always
- 1:29:44lands in the same split however many
- 1:29:46times you run this. Uh, and span
- 1:29:48[snorts] ID links each example back to
- 1:29:50the trace it came from. Uh, so you can
- 1:29:52always click through to the original
- 1:29:54run.
- 1:29:57Then we run the judge against the
- 1:29:59humans. This is an experiment which is
- 1:30:01something that we're going to dig into
- 1:30:02in a little bit. Um, but for now uh an
- 1:30:05experiment takes a data set. It takes a
- 1:30:07task task to run on every example uh and
- 1:30:10evaluators to score the results. The
- 1:30:12task here is our judge and the evaluator
- 1:30:14is a tiny Kodi val which checks whether
- 1:30:16the judge's label matches the humans. Uh
- 1:30:19notice that we only run it in the devs
- 1:30:21split. Uh you can run this yourself by
- 1:30:24running npm run meta.
- 1:30:28[sighs]
- 1:30:30Let's see if we can get it to go.
- 1:30:44It's going to run an LM. So, uh, I'm
- 1:30:47going to assume that it does the same
- 1:30:48thing that it did last night. Um, the
- 1:30:51script should print a little table at
- 1:30:52the end. Uh, and on my 12 dev reports,
- 1:30:56the judge and I made the same call every
- 1:30:57time, which is great, but it's also only
- 1:30:5912 reports. Uh, so read that as, you
- 1:31:03know, no sign of a problem yet. you're
- 1:31:05going to want a larger test set when
- 1:31:06you're running this in production. Um,
- 1:31:11cool. It actually completed it. Uh,
- 1:31:14the more interesting part is the two
- 1:31:16ports that I the two reports that I
- 1:31:18found hardest to label. Um,
- 1:31:24so in my Phoenix data,
- 1:31:27uh, there's Coca-Cola and there's
- 1:31:30Microsoft.
- 1:31:38Um
- 1:31:42the the first one is Coca-Cola. The
- 1:31:43Coca-Cola is the one that flipped uh
- 1:31:46when I changed from the XML tags to the
- 1:31:48uh from not having XML tags to having
- 1:31:50XML tags. Uh this is where when it got
- 1:31:53the examples it got better. Um
- 1:31:58borderline for me turns out to be uh
- 1:32:00borderline as well. the it the report
- 1:32:02calls KO ideal for conservative income
- 1:32:04oriented pol uh portfolios uh which
- 1:32:08sounds like a recommendation. So as a
- 1:32:10human I went back and forth on whether
- 1:32:12or not I should count that as a
- 1:32:13recommendation. Ultimately I decided it
- 1:32:15did not uh but the judge also goes back
- 1:32:17and forth on whether or not that counts
- 1:32:18as enough of a recommendation.
- 1:32:21Um
- 1:32:23and the second one was Microsoft uh
- 1:32:25which I'm not going to bother to click
- 1:32:26into which is the other way around. The
- 1:32:27report says buy with reasons uh and a
- 1:32:30time horizon. Uh and it never mentions a
- 1:32:32single risk. This is the one that I was
- 1:32:34talking about earlier. Uh my rubric
- 1:32:37lists name concrete risks as a
- 1:32:39criterion. Uh and I decided that was
- 1:32:42fine and the judge decided that that was
- 1:32:44not fine. It said it was weak on risks.
- 1:32:46There is no risk section. It clears the
- 1:32:48bar for actionability but though not by
- 1:32:50much. So, the judge looking at this
- 1:32:53stuff came up with exactly my human
- 1:32:55judgment on whether or not this was an
- 1:32:57actionable report, including the
- 1:32:59ambiguity.
- 1:33:02Um, and that ambiguity is still in our
- 1:33:05rubric
- 1:33:08because we haven't changed it yet. Uh,
- 1:33:10so it's very tempting to fix it. So, I
- 1:33:13tried I added one sentence uh which was
- 1:33:16a report is actionable only if it meets
- 1:33:18all four criteria because previously
- 1:33:19that was ambiguous. I said a report
- 1:33:21should include all of these things. I
- 1:33:24didn't say that it must. Uh so you can
- 1:33:27change the you can change the rubric and
- 1:33:29be more specific and say yes this
- 1:33:31absolutely must contain all these four
- 1:33:33criteria. Uh and on dev uh that broke
- 1:33:36Microsoft my 12 out of 12 agreement
- 1:33:39became 11 out of 12 agreement. Um
- 1:33:42and uh it also in the test split it
- 1:33:46broke Apple uh because Apple didn't have
- 1:33:48enough uh a big enough risk section as
- 1:33:50far as the agent was the judge was
- 1:33:52concerned. Um
- 1:33:55what that tells you is that I could
- 1:33:57change my rubric and make my eval worse.
- 1:33:59Uh I can make my eval less helpful. I
- 1:34:02can make my EVA less like what a human
- 1:34:04would do. Uh even though I'm trying to
- 1:34:06be specific.
- 1:34:08Um the script also prints precision and
- 1:34:11recall. Uh precision these are very
- 1:34:14important things again borrowed from the
- 1:34:16ML land or rather from stats land. Um
- 1:34:20precision asks when the judge says not
- 1:34:22actionable how often is it correct? And
- 1:34:25recall asks of all the reports that
- 1:34:28aren't actionable how many did the judge
- 1:34:30catch? Those two sound very similar but
- 1:34:33measure different things. Um,
- 1:34:37in most cases, you're going to want to
- 1:34:39prioritize recall because what recall
- 1:34:41gives you is it catches everything, but
- 1:34:44it gives you high recall catches
- 1:34:46everything, but it will give you uh
- 1:34:48false alarms. A false alarm costs you a
- 1:34:51minute or two when you look at a report
- 1:34:52that turns out to be fine. Uh, but a
- 1:34:55missed failure uh would give you a bad
- 1:34:57report that reaches a customer. Um, so
- 1:35:01you have to trade one for the other. If
- 1:35:03recall goes up uh um then uh precision
- 1:35:08will go down and vice versa. So for your
- 1:35:11application you have to decide whether
- 1:35:14being accurate uh as in throwing away
- 1:35:17some things that were actually correct
- 1:35:19uh but but uh you decided they weren't
- 1:35:23is better or worse than getting false
- 1:35:25alarms where you say something is
- 1:35:27important and it turns out not to be. Um
- 1:35:32judges also have biases. Uh I mentioned
- 1:35:35one of them already. Um one is position
- 1:35:38bias. Given two options, they tend to
- 1:35:40prefer depending on the model either
- 1:35:42which one comes first or which one comes
- 1:35:44last. It depends which way the model
- 1:35:46around which way around the model was
- 1:35:47changed. Uh but you should swap your
- 1:35:50options so that it's not always looking
- 1:35:52at those uh things in the same order. Um
- 1:35:54they have length bias. Uh, judges prefer
- 1:35:58long answers and they also have a
- 1:35:59confidence bias. Judges prefer answers
- 1:36:02that sound fluent and confident. Um, and
- 1:36:06the one that I mentioned already is
- 1:36:07self-preference. A model judging its own
- 1:36:09output tends to rate it higher. Uh,
- 1:36:13which is why we judged Haiku with
- 1:36:14sonnet. Uh, and ideally you judge haiku
- 1:36:17with something from open AAI.
- 1:36:21Um, but before you get too worried about
- 1:36:24how much you can trust a judge, it's
- 1:36:25worth noting that human judges also
- 1:36:28disagree with each other a lot of the
- 1:36:29time. Um, if you give two experts the
- 1:36:32same outputs in the same rubric and
- 1:36:33measured how often they agree, uh, there
- 1:36:35is a standard score for that called
- 1:36:37Cohen's Kappa, uh, and for this kind of
- 1:36:39task, it's often as low as 02 or.3. Uh,
- 1:36:43which is to say they agree with each
- 1:36:45other not very much more often than just
- 1:36:47random chance. Um [snorts] so the bar
- 1:36:50for your human judgment is h for the bar
- 1:36:53for your judge is human performance and
- 1:36:55h human performance uh is not actually
- 1:36:57that good when you compare humans to
- 1:36:59each other. So having a judge that
- 1:37:01disagree you don't do not need a judge
- 1:37:04that agrees with you 100% of the time.
- 1:37:07Uh your judge is never going to agree
- 1:37:09with you 100% of the time. What you want
- 1:37:10is a judge that does better than another
- 1:37:12human doing the judge would be. uh
- 1:37:15because your judge can run across
- 1:37:17thousands of examples and help itself
- 1:37:19out that way. Um
- 1:37:22one last principle on judges uh is that
- 1:37:24failures should seem fair. When
- 1:37:26something fails, it should be obvious
- 1:37:27what the agent did wrong. If you look at
- 1:37:29the failure and go, "Well, actually that
- 1:37:31looks fine to me," then the problem is
- 1:37:33probably your eval. Um
- 1:37:36there's a famous example of this uh when
- 1:37:38Claude Opus 4.5 first scored 42% on a
- 1:37:42benchmark called Corebench uh which
- 1:37:44tests whether agents can reproduce
- 1:37:46scientific papers. Uh anthropic were
- 1:37:49upset about that low score. Uh so a
- 1:37:51researcher ran the actual transcripts
- 1:37:53and found uh that uh Claude was just
- 1:37:57being uh right in a different way. Uh it
- 1:38:01the test expected uh six digits of
- 1:38:04precision and Claude gave the right
- 1:38:06answer to two digits of four digits of
- 1:38:07precision rather. Um and the test said
- 1:38:10that was wrong. There were ambiguous
- 1:38:12task descriptions. Some of the tasks
- 1:38:14couldn't be reproduced at all. Uh so
- 1:38:16Anthropic went through and they fixed
- 1:38:18all of the tests and they said these
- 1:38:19tests could be better. Uh and magically
- 1:38:22they got 95% on the eval.
- 1:38:24Um this happens all the time. SWEBench
- 1:38:28and all of the other uh benchmarks that
- 1:38:31you see are constantly being
- 1:38:33re-evaluated and manually tweaked and uh
- 1:38:37that is why you see version two, version
- 1:38:38three, version four of of uh the famous
- 1:38:40benchmarks uh because people are
- 1:38:42constantly finding that the benchmarks
- 1:38:44are not actually as good as they could
- 1:38:45be and your evals are going to end up
- 1:38:47with the same problem. Uh so you need to
- 1:38:51be constantly re-evaluating your test
- 1:38:53set.
- 1:38:55Uh which brings us to step seven which
- 1:38:57is uh experiments. We've got evals that
- 1:39:00we trust. Now we are going to use them
- 1:39:02to actually improve that the agent and
- 1:39:04prove that the fixed worked. Uh
- 1:39:09I'm going to go a little faster now as
- 1:39:11I've been going on a very leisurely
- 1:39:12pace. I'm getting beginning to run out
- 1:39:14of time. Um so the here's the problem.
- 1:39:17We know that some reports aren't
- 1:39:19actionable and we know why. So we change
- 1:39:21the prompt and then what? How do you
- 1:39:22know that it worked? Uh, how do you know
- 1:39:25that you didn't break something that was
- 1:39:27working before? If you run it on a
- 1:39:28couple of examples and eyeball it, then
- 1:39:30you're back to vibes. A prompt change
- 1:39:32that you haven't measured is just a
- 1:39:34vibe. What you want is a controlled
- 1:39:36comparison. You want the same inputs,
- 1:39:38the same eval before and after. That is
- 1:39:41an experiment.
- 1:39:42Um
- 1:39:46so uh what you can do in Phoenix is you
- 1:39:49can take a bunch of your evals that you
- 1:39:51have filtered down to not actionable say
- 1:39:54uh and you can select them and you can
- 1:39:56add them to a data set. Um
- 1:39:59that gives you a set to test against uh
- 1:40:02against specific things. Um I'm not
- 1:40:05going to do that since I've already done
- 1:40:06it over here. Um
- 1:40:14Um once you have a data set you can
- 1:40:16create turn that into an experiment and
- 1:40:18run uh your experiment against only the
- 1:40:22data set only against the evals that
- 1:40:24were failing as opposed to against your
- 1:40:25entire set every single time which you
- 1:40:28know if you've got a decent sized split
- 1:40:30and a decent sized test set is saving
- 1:40:31you thousands and thousands of tests
- 1:40:33every time. Uh
- 1:40:36now we're going to fix what the eval
- 1:40:38found. So, uh, if you're still coding
- 1:40:42along, congratulations. Open prompts.ts.
- 1:40:44There is an improved version of each
- 1:40:46prompt. Uh, or you can write your own.
- 1:40:49Um,
- 1:40:51and every change maps to a finding. So,
- 1:40:54the judge said, uh, makes no
- 1:40:56recommendation, so we asked for an
- 1:40:57explicit recommendation. It said
- 1:40:59mentions risks with no evidence. So, we
- 1:41:00asked for risks with supporting data.
- 1:41:03Faithfulness found invented numbers, so
- 1:41:04we said use only numbers that appear in
- 1:41:07your research. uh and reading traces
- 1:41:09found that the agent uh was trying to
- 1:41:11save files all the time. Uh so we tell
- 1:41:14it to reply with the report instead.
- 1:41:17We're not guessing here. We are coming
- 1:41:18up with specific things for the agent to
- 1:41:20do as a result of the previous results
- 1:41:22of our evals. Uh
- 1:41:27this is what the experiment script looks
- 1:41:29like. An experiment is a data set, a
- 1:41:30task and evaluators. The data set is the
- 1:41:33one that we just created. Uh the task is
- 1:41:35a function that just runs the agent on
- 1:41:37each example. Uh
- 1:41:40in this case, we're running the entire
- 1:41:42agent, but we could be running it on a
- 1:41:43specific subset of the agents behavior
- 1:41:45or a specific subtask uh if we wanted
- 1:41:48to. Uh our task hands back the report
- 1:41:51and the research. So each eval gets a
- 1:41:53small wrapper that picks out the fields
- 1:41:55that it needs. Uh and then faithfulness
- 1:41:57gets the research as its context. The
- 1:41:59same as before, uh Phoenix runs the task
- 1:42:02on every example. It scores every result
- 1:42:04and it stores everything so you can
- 1:42:06compare. If you want to run this, you
- 1:42:08can run npm run experiment and it will
- 1:42:10take about four minutes to run. Um,
- 1:42:14but I'm running out of time so I'm not
- 1:42:15going to wait for four minutes. Uh, I
- 1:42:19ran mine ahead of time. How many
- 1:42:21examples do you need? Uh, is a really
- 1:42:23good question. Uh, 10 to 20 examples
- 1:42:26gives you a rough direction of where
- 1:42:27things are going. Is very useful in dev.
- 1:42:30Um, if you're getting into production,
- 1:42:32uh, you're going to want hundreds of
- 1:42:33examples. Um, that is going to take a
- 1:42:37long time, but is, uh, very worth it for
- 1:42:41accuracy. Um, for every, uh, to have
- 1:42:46your error bars on your accuracy, you
- 1:42:48need to quadruple the number of
- 1:42:51examples. So, uh, going from 25 examples
- 1:42:55to 100 examples is really, really
- 1:42:57helpful. uh and is not that much effort
- 1:43:00going to get that big a jump again you'd
- 1:43:03have to go to 400 examples which begins
- 1:43:05to get into the territory of you're
- 1:43:06never going to bother to do this uh but
- 1:43:09the bigger the better uh and the more
- 1:43:12production failures you throw into your
- 1:43:13data set the better
- 1:43:16um so I ran mine three times and the
- 1:43:18reason I did that uh is because the
- 1:43:20agent is non-deterministic each run of
- 1:43:22each example uh can mislead you in
- 1:43:25either direction um And there are two
- 1:43:28useful ways of thinking about how an
- 1:43:30agent runs uh when it runs multiple
- 1:43:33times. The first is called pass at K
- 1:43:36which is uh does it succeed at least
- 1:43:38once in K tries and then there is pass
- 1:43:41to the K which does it increase every
- 1:43:45single time uh does it pass every single
- 1:43:47time I run uh K times. Um
- 1:43:52so as K goes up those two numbers
- 1:43:55diverge. Uh the more tries you give it,
- 1:43:58the more likely pass at K is to succeed
- 1:44:00because it succeeds at least once. The
- 1:44:02more tries you give it, the more likely
- 1:44:03it is to fail at least once and then
- 1:44:05pass it K pass to the K will go down. Um
- 1:44:09a coding assistant gets that gets it
- 1:44:11right on the second try is fine. So pass
- 1:44:13it K is fine. Um a support bot that's
- 1:44:16wrong runtime in every five is a huge
- 1:44:19problem. And a financial anal analyst uh
- 1:44:22that gives inaccurate recommendations is
- 1:44:24also a huge problem. Uh so you want pass
- 1:44:27to the K. You want it to pass every
- 1:44:29single time for those.
- 1:44:31Um
- 1:44:33when you're improving an agent, there's
- 1:44:35an order of operations based on how
- 1:44:39useful making a change is going to be.
- 1:44:41The first one is data quality. If your
- 1:44:44underlying data is bad, if it's hard to
- 1:44:46read, if it's difficult to interpret for
- 1:44:48the agent or for the judge, uh then
- 1:44:51nothing else you do, nothing else you
- 1:44:52tweak is going to be useful. Once you've
- 1:44:55got good quality data, then you move to
- 1:44:57the prompts. Uh that is what we've been
- 1:44:59messing with mostly today. Uh is to make
- 1:45:02things better at the prompt level by
- 1:45:04changing our rubric, by changing our
- 1:45:06agent.
- 1:45:07Then there's model choice. Uh model
- 1:45:10choice has a lot of leverage, but it
- 1:45:15also changes a whole bunch of stuff at
- 1:45:17the same time.
- 1:45:18uh and also the usual way that you're
- 1:45:21going to change your model is you're
- 1:45:22going to change it to a bigger model and
- 1:45:24that makes things more expensive. So
- 1:45:25that is uh creates a tradeoff uh that
- 1:45:29you don't always want to make. Uh and
- 1:45:31finally there's hyperparameters.
- 1:45:32Hyperparameters are things like
- 1:45:34temperature and stuff like that. Uh
- 1:45:36they're so useless that uh people have
- 1:45:38that modern models have stopped allowing
- 1:45:40you to tune them. You can't pass
- 1:45:42temperature to model to modern claw
- 1:45:44models. Um so if you're tempted to it is
- 1:45:48the least useful thing that you can
- 1:45:49pass.
- 1:45:53Um so if we're looking at my experiments
- 1:45:55you can look in your seed data and get
- 1:45:57see see the same experiments. Um
- 1:46:00you'll see that uh
- 1:46:03as I improved as I improved my runs I
- 1:46:06went from uh
- 1:46:1016 out 15 out of 16 to 48 out of 48. and
- 1:46:13went from 5 out of 16 to 48 out of 48.
- 1:46:15And faithfulness went from 2 out of 16
- 1:46:17to 3 out of 48. Uh, which is not that
- 1:46:20good, right? Like we really should have
- 1:46:22done better on faithfulness with my
- 1:46:24improved prompt. Um,
- 1:46:28the
- 1:46:30uh
- 1:46:31important thing is did anything that
- 1:46:33used to pass break? We can filter down
- 1:46:36to the passes split. I'm not going to do
- 1:46:37it in the UI right now. Uh, but all of
- 1:46:40the five reports that passed previously
- 1:46:42as I improved my prompt still passed.
- 1:46:45Uh, so actionability went straight to
- 1:46:47perfect. Um, but faithfulness was bad.
- 1:46:50Faithfulness uh went from 2 out of 16 to
- 1:46:533 out of 48. Uh, even though the prompt
- 1:46:56literally says only use numbers that
- 1:46:57appear in your research. Um,
- 1:47:01so we fixed what we measured in a single
- 1:47:04line of the prompt. Uh, didn't fix the
- 1:47:06agent making things up. That is the next
- 1:47:08thing that we have to fix for this
- 1:47:09agent. Uh we have fixed whether or not
- 1:47:12it is making a good judgment call. Uh
- 1:47:15but we have not fixed uh that it is uh
- 1:47:18inventing the data some of the time.
- 1:47:22Um
- 1:47:25if we want to we can look into uh each
- 1:47:27of the runs and you'll see that each of
- 1:47:29the because it's nondeterministic each
- 1:47:31of the runs are coming up with different
- 1:47:32advice. Um, but I'm not going to do that
- 1:47:35because I'm running out of time and I
- 1:47:36want to get to some other stuff. Uh,
- 1:47:44let's get to Okay, cool. Um,
- 1:47:48a good eval like the 56 the 511 split
- 1:47:52that I was talking about on my 16 data
- 1:47:54sets. That is what is called a
- 1:47:55capability eval. A capability eval is a
- 1:47:58thing that our agent can't do yet. And
- 1:47:59it gives us a hill that we can measure
- 1:48:01ourselves climbing. Uh when it passes
- 1:48:04reliably, when you get a test that
- 1:48:07passes 100% of the time, you don't throw
- 1:48:09it away. You turn it into what is called
- 1:48:10a regression eval. That is the kind that
- 1:48:13you can put into your CI and say this
- 1:48:14used to pass 100% of the time. If it
- 1:48:16suddenly stops passing 100% of the time,
- 1:48:19then we can call that a failure and we
- 1:48:20should stop release. Um how do we climb
- 1:48:24this hill is the question. uh
- 1:48:28we could work on the prompt again or uh
- 1:48:30we could do the thing that I said that
- 1:48:32we would do which is we can upgrade the
- 1:48:34model. Uh so you can run the experiment
- 1:48:37again by passing in a new model haiku
- 1:48:395.5 and then run npm experiment. Um,
- 1:48:44I said at the start of today that you
- 1:48:46can't switch models without eval. And
- 1:48:47this is what it looks like when you can
- 1:48:48switch a model with an eval because we
- 1:48:51know now that we are measuring all of
- 1:48:52these things. Um, with three
- 1:48:55repetitions, it takes 13 minutes, which
- 1:48:57is more time than we've got left. So,
- 1:48:58I'm just going to skip to the results.
- 1:49:00Uh, here is Haiku 4.5 versus 5.5. Uh,
- 1:49:05faithfulness improved. It got more than
- 1:49:07three times better. It is still
- 1:49:08terrible. This agent is still making
- 1:49:10things up all the time.
- 1:49:12Uh, but consistent calls got better. So,
- 1:49:14it is at least making the same call over
- 1:49:16and over. Is that good? Uh, it's also
- 1:49:19costing four times as much money. Is
- 1:49:21that worth it? Uh, is a question that
- 1:49:24you need to make for yourself in
- 1:49:25production when you're doing this kind
- 1:49:27of thing. Um,
- 1:49:31one of the ways that it got more
- 1:49:32consistent, one of the ways it stopped
- 1:49:34varying between buy and sell between
- 1:49:36calls, uh, is it just got more
- 1:49:38conservative. Haiku 5.5 uh it turns out
- 1:49:41just says hold all the time. Uh so uh is
- 1:49:46that better or worse? Probably worse. Uh
- 1:49:49probably we need to iterate on Haiku 5.5
- 1:49:52being too conservative uh about things.
- 1:49:55But at least we know now that something
- 1:49:57has changed and that the conserviveness
- 1:49:59is a problem with Haiku 5.5.
- 1:50:02Um that is the problem that I found. It
- 1:50:05went it went to 41 of out of uh 45 calls
- 1:50:09it said uh hold 41% of the on 41 of the
- 1:50:13times. Um which is perfectly consistent
- 1:50:16between runs. Uh so it it got better at
- 1:50:19the uh consistency check that I was
- 1:50:21talking about over here the consistent
- 1:50:23call. Uh but it got there by just
- 1:50:26picking the same answer every single
- 1:50:27time.
- 1:50:28>> [snorts]
- 1:50:28>> Um
- 1:50:32but that is the eval iterate cycle. Uh
- 1:50:34and the cycle is where the value is not
- 1:50:36anyone's score. You run your evals, you
- 1:50:38read the failures and the explanations,
- 1:50:40you spot the pattern, you change the
- 1:50:41prompt or the tools or the data and you
- 1:50:43run the experiment again. Did it get
- 1:50:45better? Uh your evals can now answer
- 1:50:48that question for you. You can go from I
- 1:50:50think it works to I can show you it
- 1:50:52works. Uh
- 1:50:55I have just enough time to talk about
- 1:50:57how to do the last step which is eval in
- 1:50:59CI.
- 1:51:00Uh more and more teams that ship AI
- 1:51:03quickly write the eval before the
- 1:51:05feature. That's called eval driven
- 1:51:06development. Um say you want your
- 1:51:09support agent to always check who the
- 1:51:11customer is before giving a refund. Uh
- 1:51:14you can write the eval that checks for
- 1:51:16that first and now done has a definition
- 1:51:18that you can measure a hill that you can
- 1:51:20climb from the start. Um,
- 1:51:24we talked already about capability
- 1:51:26capability evals and regression evals.
- 1:51:29Um,
- 1:51:31here's how uh to create a eval that runs
- 1:51:34in CI. Um,
- 1:51:37if you've never used VEST, VEST is a
- 1:51:40JavaScript testr runner and Fenix can
- 1:51:41plug straight into it. Uh, if you open
- 1:51:44agent.eval.ts, you'll see that it looks
- 1:51:46like an ordinary test file because it is
- 1:51:47one. There is a describe block and a
- 1:51:49test for each query in our regression
- 1:51:51set. So Coca-Cola, Apple versus
- 1:51:53Microsoft, Rivian, uh, and the fake
- 1:51:55ZZZQ.
- 1:51:57Um, each test runs the agent, logs the
- 1:52:00report as the output, uh, and then runs
- 1:52:02our evals on it. And the same ticker
- 1:52:04check and actionability judge that we
- 1:52:05wrote earlier. We don't have to add new
- 1:52:07evals for CI.
- 1:52:09Uh, then at the bottom, we gate the
- 1:52:12build on acceptance criteria. This is
- 1:52:14where I talked about guardrails and
- 1:52:15northstars. Mention sticker is a
- 1:52:17guardrail. It has to be talking about
- 1:52:19the right company. Um actionability is a
- 1:52:22target. The average has to stay 08 or
- 1:52:25better. Uh because an LLM judge can be a
- 1:52:27bit noisy on a single report. So we gate
- 1:52:29on the average uh not on just one. Uh
- 1:52:33and then you can run npm test uh and it
- 1:52:36runs like any test suite. Um and at the
- 1:52:39end the reporter prints out a scorecard.
- 1:52:42Um, and that'll take about four minutes,
- 1:52:44which is more time than I've got left.
- 1:52:46Um,
- 1:52:48a red build. If a failed build, if your
- 1:52:51build fails, this is what you'd get. All
- 1:52:52four tests ran and every report
- 1:52:54mentioned its ticker, but Rivian's
- 1:52:55report wasn't actionable. So, the
- 1:52:57actionability average came out at 75.
- 1:53:00Uh, it doesn't say you failed. It just
- 1:53:01says that you missed. Um,
- 1:53:06but, uh, a green run, uh, is where all
- 1:53:10of those pass. Um,
- 1:53:13I'm not going to show the experiment
- 1:53:15view because again, I'm running out of
- 1:53:16time. Uh, but when a build fails, you
- 1:53:19don't just get a red cross. You get an
- 1:53:21explanation that says whether things are
- 1:53:23good or bad and why they went wrong. And
- 1:53:25that is the important thing. Uh, this
- 1:53:27same test suite can be run in GitHub
- 1:53:29actions. Uh, it starts Phoenix as a
- 1:53:32service container. Uh,
- 1:53:36but now we've done everything that I've
- 1:53:38said that you can do. uh you can run
- 1:53:41your evals, you can test things, you can
- 1:53:43make sure uh that it matches your human
- 1:53:45judgment, you can put it into CI and you
- 1:53:47can make sure that your builds are gated
- 1:53:49on whether or not uh the LLM's judgment
- 1:53:52of what you've encoded as the definition
- 1:53:55of good uh really works.
- 1:53:58Um
- 1:54:00and there's something I love about this
- 1:54:02which is that anyone who knows what good
- 1:54:04looks like can write evals now. uh your
- 1:54:07product managers, your support team,
- 1:54:09your person in sales who keeps hearing
- 1:54:10the same complaint. They don't need to
- 1:54:12write TypeScript. Uh they just need to
- 1:54:14describe what a good answer looks like
- 1:54:17uh and give it to you or even better
- 1:54:19just give it to a coding agent which
- 1:54:21will then write all of the evals for
- 1:54:22them.
- 1:54:24Uh you shouldn't run your whole agent on
- 1:54:27every single commit because uh it's
- 1:54:30going to take a really long time and
- 1:54:31cost you a whole bunch of money. Um, but
- 1:54:35now you've got the repo I promised you.
- 1:54:37You've got all of the code. You've got
- 1:54:38all of the examples. You can see how
- 1:54:39everything is done. Uh, you can point
- 1:54:41your agent at it and say, "Do this, but
- 1:54:43for my codebase," uh, and your agent
- 1:54:45will figure it out. Um,
- 1:54:49there is one thing that we didn't get
- 1:54:50time to build today, uh, which is, uh,
- 1:54:53once you're live, you should keep
- 1:54:55evaluating. You should run your evals on
- 1:54:57a sample of real traffic, uh, and alert
- 1:55:00when scores drop and stay down. um not
- 1:55:03on every single failure because one
- 1:55:04failure would be noise. Um but if you
- 1:55:07get a trend in failures, uh production
- 1:55:10monitoring is incredibly useful and eval
- 1:55:12can get you that as well.
- 1:55:15So this is the full cycle that we built.
- 1:55:18We traced, we read, we evaluated, we
- 1:55:20checked, we improved, uh and we locked
- 1:55:23it in with CI. Uh but you don't have to
- 1:55:26do all of the stuff that you've learned
- 1:55:27today on Monday. You can start small.
- 1:55:30You can just instrument your agent. you
- 1:55:31can just read some traces. You will get
- 1:55:34information reading 12 traces that you
- 1:55:36wouldn't have got uh by just looking at
- 1:55:39the output. Um so run them. Look at the
- 1:55:42results and build from there.
- 1:55:45Uh
- 1:55:47so go try it on a app of your own. This
- 1:55:49is the repo that I said that everything
- 1:55:50was in. Uh the Phoenix docs are there.
- 1:55:53Uh Phoenix itself is open source. So you
- 1:55:56can mess with the code and tell us that
- 1:55:58we got stuff wrong in there. Uh and that
- 1:56:01just on time is it. Thank you very much
- 1:56:04everybody. [applause]
About this transcript
This page contains the full transcript of How to Know If Your AI Agent Is Any Good: Evals With Phoenix & Claude — Laurie Voss, Arize AI by AI Engineer, generated from the public captions YouTube serves with the video. The transcript has 20,194 words across 2,896 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.