Using Jev In Your Agent Harness — Transcript
Full transcript
- 0:00Okay, so most of the model calls in an
- 0:03agent harness aren't actually writing
- 0:05anything. They're making decisions.
- 0:08They're making decisions like which tool
- 0:09should I use here, what skill should I
- 0:12load, is this command safe to run, and
- 0:15even decisions for things like rag where
- 0:17it's asking which of these 20 search
- 0:19results actually answers the question.
- 0:22Up until recently, everybody has
- 0:24approached those decisions pretty much
- 0:27in the same way. They've used a full LLM
- 0:30call to get the answer back. So in this
- 0:32video, I want to show you how you could
- 0:33use Jev and the other open decision
- 0:36models to actually improve an agent
- 0:38harness from the inside. I'm going to
- 0:41talk about some of the things that you
- 0:42can actually do with it. I'll show you a
- 0:44couple of cool examples that I've been
- 0:45playing with for doing progressive
- 0:47disclosure on lots of skills and for
- 0:49doing re-ranking of rag results. But
- 0:51I'll also talk about some general
- 0:53principles and perhaps more importantly,
- 0:55what are the use cases that you don't
- 0:56want to use a model like this. All
- 0:58right, so let's start with the loop that
- 1:01every agent runs. A request comes in and
- 1:03it goes to an LLM. Along with that, you
- 1:06basically have some kind of tool
- 1:07registry going in there, a system
- 1:10prompt, perhaps a set of skills, some
- 1:12guidelines of how the agent's going to
- 1:13work, etc. And the LLM decides straight
- 1:16away what action should it take, whether
- 1:18it needs to use a tool. And if it does,
- 1:21it writes out a function call giving us
- 1:23the tool name plus the arguments as
- 1:25JSON. Your scaffolding your agent
- 1:27harness then runs that code as a
- 1:29function. It gets the results and it
- 1:32appends that to the conversation. And
- 1:34the whole thing goes back to the LLM.
- 1:36And then round and round this goes until
- 1:39eventually your LLM's decided it's done
- 1:41and it writes its final answer. Along
- 1:44that road, it's probably going to use
- 1:45many tools. It's basically going to get
- 1:48information to expand its context and
- 1:50it's going to make a lot of decisions
- 1:52along the way. Now if you look at those
- 1:54LLM steps to see what's actually going
- 1:57on at each step. The whole sort of thing
- 1:59of asking itself which tool it should
- 2:01use, is it safe to actually run that?
- 2:03And often because it's making those
- 2:05decisions itself, it never really stops
- 2:07to ask any sort of verification step or
- 2:10any kind of safety step in there to ask,
- 2:13is this safe to run? And for most
- 2:15agents, if they don't have any sort of
- 2:17reflective step in there, they're really
- 2:19never even asking themselves, is this
- 2:21result good enough or should I go around
- 2:23again and try again? Each of those
- 2:26things are clear decisions that you can
- 2:28use a decision model like Jev or one of
- 2:31the open Jevs to actually improve the
- 2:33quality of the agent harness. On top of
- 2:36that, a lot of the times the decisions
- 2:38that the LLM's actually making are just
- 2:40a small set of options. Do I go to this
- 2:43node next or this node? Which skill
- 2:45looks like the best one to use in this
- 2:47situation? Which skill do I ask for more
- 2:50information in this situation? And each
- 2:53time you're paying for a full call to a
- 2:55large LLM there. And that's costing you
- 2:58both in money for tokens, but often even
- 3:01more it's costing you in time of you
- 3:03actually having to go through and do
- 3:05these things. And that's why a lot of
- 3:07the time when people are building custom
- 3:08agents, they often don't put anywhere
- 3:10near as many verification steps in there
- 3:13as they should simply because that's
- 3:16just going to slow everything down. So
- 3:18if you've watched any of my other Jev
- 3:19videos, you know that I've basically
- 3:21talked about the whole concept of Jev as
- 3:24being like a smart if statement. You
- 3:26give it a state which is just the thing
- 3:28that you're evaluating, and then you
- 3:30give it a set of typed questions about
- 3:33that state and it gives you back typed
- 3:35answers with probabilities. No text at
- 3:38all. Choice will pick one option from a
- 3:40list. Score rates the state on a scale
- 3:43that you define. A null is a yes or no
- 3:46or a true or false that's returned back
- 3:48as a probability. And the cool thing is
- 3:50you're not limited to one question at a
- 3:53time. You can ask many questions about
- 3:55the one state all in a single call and
- 3:58get answers back in parallel and it
- 4:00almost doesn't change the response time
- 4:02at all. So, if you're looking at how to
- 4:05improve your agent harness, one of the
- 4:07key things you can do is look at that
- 4:10loop of where it's full of a bunch of if
- 4:12statements that are dressed up as
- 4:14function tools or dressed up as asking
- 4:16the model for structured JSON responses
- 4:18back and you can convert those kind of
- 4:20calls to something that's much quicker
- 4:22like a decision model. All right, so
- 4:24where does this actually belong in your
- 4:26agent harness? I'd say that there's six
- 4:28main places that you want to be thinking
- 4:30about here. So, the first one is model
- 4:32routing. I did a whole video about how
- 4:34you can look at this. You got a request
- 4:37coming in, Jev decides whether it goes
- 4:39to a cheap fast model or expensive model
- 4:42that's going to do much better reasoning
- 4:43etc. If anyone watched the video that I
- 4:45made about that, you can see the whole
- 4:47thinking process for actually putting
- 4:48that together. The second use is risk
- 4:51gating. So, before a tool call actually
- 4:54runs, Jev can actually check whether
- 4:56it's going to be something destructive
- 4:58like deleting a database or wiping a
- 5:00folder or whether what it's actually
- 5:02going to be doing is quite benign. Now,
- 5:04we know that a lot of the coding agents
- 5:06have had this kind of [clears throat]
- 5:07check for a while, but it's been hidden
- 5:09generally in their harness. And when you
- 5:11were using it, you were basically paying
- 5:13for a full tool call with the amount of
- 5:15tokens that it actually gets used there.
- 5:17So, being able to configure your harness
- 5:19so that when certain tools get called,
- 5:22perhaps like a bash tool, you actually
- 5:24look at what the arguments are going to
- 5:26be going into that and you send that to
- 5:28Jev to basically ask it, "Hey, is this
- 5:31going to be malicious or benign?" Very
- 5:33quickly, you've got a safety check that
- 5:35can take milliseconds. And of course,
- 5:37with the open decision models, that can
- 5:38be running fully locally as well. Third
- 5:41up, you've got tool and skill selection.
- 5:43So, generally what people have done is
- 5:45they inject their entire tool registry
- 5:48that they're going to be using into the
- 5:50system prompt. And they can chew up
- 5:51thousands of different tokens. So, the
- 5:54whole idea of skills has reduced that a
- 5:56lot by using progressive disclosure.
- 5:59This is one of the key things that I'm
- 6:00going to show you in the demos a bit,
- 6:01that you can actually have lots of
- 6:03skills going on, categorize them, have
- 6:06your decision model decide which kind of
- 6:08category it's going to need, and then
- 6:10just load the appropriate skills into a
- 6:12system prompt at that point. Fourth up,
- 6:15you've got things like ranking and
- 6:16judging. So, this is another one that I
- 6:18want us to demo here. I think the whole
- 6:20idea of scoring retrieve trunks and
- 6:23grading on answers against a rubric,
- 6:25this can be a huge win for anything that
- 6:28you're doing with rag or anything you're
- 6:30doing where you're injecting context
- 6:32into the context window. Fifth up, we've
- 6:34got things like triage. So, this is all
- 6:36your things like support tickets, email
- 6:38issues, and one call here can give a
- 6:41proper probability of how urgent
- 6:43something is. I start to help giving
- 6:45things an actual probability of priority
- 6:48here. And this one can be really useful
- 6:50for when to basically get the model to
- 6:51go back to the human for things like
- 6:53human in the loop as well. And the sixth
- 6:55use that I'm not going to go into too
- 6:57much here is the whole idea of just
- 6:58real-time filtering. This can be really
- 7:01useful for anytime you're basically
- 7:02dealing with APIs, polling requests,
- 7:05anything where it's good to just filter
- 7:07what comes back from that before you
- 7:10inject that into the context window. So,
- 7:12the rule of thumb that I use for all of
- 7:14these actually comes from Type Safe
- 7:16themselves. If a panel of smart people
- 7:19could answer the question in just a few
- 7:21seconds, then it's the kind of question
- 7:23that you probably should be using a
- 7:24decision model for. If they need to go
- 7:27away and formulate an answer and then
- 7:29write a complicated answer back, that's
- 7:31when you should be sticking with the
- 7:32LLMs. In a little bit, I'll actually go
- 7:34through the use cases of where you
- 7:36shouldn't be using these decision models
- 7:38at all. So, how do you actually wire
- 7:40this in? So, if we go back to that loop
- 7:43that we had there, there are four places
- 7:45to hook a decision in. And really,
- 7:47they're going to be the same in any
- 7:49framework, whether you're talking about
- 7:50LangChain, whether you're talking about
- 7:52ADK, whether you're just using custom
- 7:54Python code to write your own loop here.
- 7:56You've got before the prompt is built,
- 7:58so decide which skills or tools to load,
- 8:02before the model called, decide which
- 8:04actual model you're going to call,
- 8:06before a tool runs, decide whether it's
- 8:08safe, and then after a result comes
- 8:11back, decide whether it's good enough to
- 8:13use or whether you should go back and
- 8:15actually go through the loop again. So,
- 8:17each hook here is the same small piece
- 8:18of code. Build a state from what the
- 8:21loop already has, ask your questions,
- 8:24and then read the probabilities and
- 8:25answers that come back, and then branch
- 8:28or make your decision for the path going
- 8:30forward based on those. Now, there's
- 8:32also a second pattern that you can use,
- 8:34where Jev is the loop's decider and the
- 8:37LLM is the fallback. So, Jev picks the
- 8:40tool or the answer, and only hands it to
- 8:42the LLM when it's unsure or when
- 8:44something needs text to be written. Now,
- 8:46this pattern can actually cut more LLM
- 8:47calls, but it's definitely a much bigger
- 8:49change to your agent. But so far I found
- 8:51with this one, it just doesn't seem to
- 8:53work as well when you've got a lot more
- 8:54sort of complicated things going on in
- 8:56there. Anyway, for either of these
- 8:58patterns, you don't need a framework.
- 9:00That said, the first pattern that I
- 9:01talked about here, LangChain has already
- 9:03shipped that as middleware, and Pydantic
- 9:06has shipped their own version by making
- 9:07the type safe models something that you
- 9:09can just plug in and use in the agent
- 9:11loop. All right, so before I show you
- 9:13the demos, let me just go through
- 9:14quickly where I think this doesn't fit.
- 9:17Clearly, anything where you need text
- 9:19back, anything that needs any sort of
- 9:22multi-step reasoning, and anything where
- 9:24you're going to need to connect several
- 9:26things together to generate an answer
- 9:28out, all of those are still an LLM's
- 9:31job. And in many ways, a lot of that
- 9:33multi-hop stuff is still going to be the
- 9:34stuff that you're going to use the LLM
- 9:36for and then have your Piranhas process
- 9:38that and keep passing it back to the
- 9:40large LLM. The second thing you want to
- 9:42think about here is size. So, if your
- 9:45state is just getting too big, and then
- 9:48you're trying to pass in 100,000 tokens
- 9:51to get some kind of response back from
- 9:53that context window, then Jev is not
- 9:56going to be a good fit here. Type-safe's
- 9:58own docs say that accuracy drops a lot
- 10:00on long inputs. And so, it generally
- 10:03seems to fit whether you're using the
- 10:05Type-safe Jev decision model or one of
- 10:07the open decision models. On top of
- 10:10that, another thing, obviously, is that
- 10:12Jev itself doesn't use images. Now, some
- 10:14of the open models actually do use
- 10:16images and use images really well. So,
- 10:18at the moment, that's definitely a win
- 10:20for the open decision models over the
- 10:22proprietary models. All right, another
- 10:24thing that doesn't work well are
- 10:25compound questions. So, compound
- 10:27questions are often something that the
- 10:28decision models don't handle that well.
- 10:31If you've got a yes-no question, okay,
- 10:32that's fine, but if you've got something
- 10:34that requires multiple questions in
- 10:36there to be answered, then often the LLM
- 10:39is going to do better for that kind of
- 10:41thing. Another thing you want to be wary
- 10:42about in here is, while the decision
- 10:45models can be really good at spotting
- 10:46sort of weak spots, you want to be
- 10:48careful about how you always rely on
- 10:50them. It does seem currently that a lot
- 10:52of these models can be prompt injected
- 10:54to basically have instructions that
- 10:57actually move the results out of that.
- 10:59So, often the way to get around that is
- 11:01to basically have a question first that
- 11:03asks, are there prompt injections in
- 11:05here before you actually pass it on to
- 11:07the real question that you wanted to
- 11:08actually ask. The other thing I find,
- 11:10too, is that you really want to think
- 11:12about criteria for making the decisions.
- 11:15So, if you've got very clear decision
- 11:18spots where you're asking the same
- 11:19questions, you can control the actual
- 11:22criteria very well in situations like
- 11:25that. If you're just asking some vague
- 11:27question about the output from the LLM,
- 11:30and you haven't got a nice clear
- 11:32in there, I wouldn't necessarily be
- 11:34trusting the LLM to write that in a way
- 11:36that's going to make the whole system a
- 11:38lot better. You kind of want to define
- 11:40the instructions and the criteria
- 11:41yourself, and then benchmark any changes
- 11:44that you make to that over time. And
- 11:47then of course lastly, if you're
- 11:48actually running your agent locally, but
- 11:50then you're using Jase in the cloud,
- 11:52you've got to think about the whole fact
- 11:53that it's a hosted API. And do you
- 11:56really trust it for every state that
- 11:58you're going to send to the cloud? Is it
- 12:00okay that that leaves your machine? And
- 12:02I think this is where the open decision
- 12:03models have really come along so far
- 12:05now. So, let's jump into the demos and
- 12:07actually look at some examples of how
- 12:09you could do this for a couple of these
- 12:11key tasks and some of the challenges
- 12:13that you might face along the way.
- 12:15All right. So, in the demo here, I've
- 12:17basically made a UI just so you can see
- 12:19what's going on a lot easier, but these
- 12:22are exactly the kind of decisions that
- 12:23are going on in your agent. So, if we've
- 12:26got a bunch of skills, more and more now
- 12:28people are starting to use large amounts
- 12:30of skills files. And remember the whole
- 12:33thing that's really cool about skills is
- 12:35that you've got progressive disclosure
- 12:37in there. So, the idea here is that if
- 12:40this is the actual skill file, and it
- 12:42might actually be a lot longer going
- 12:44through this, you only give the model
- 12:46this after it's decided that okay, it
- 12:50needs to basically use a coding write
- 12:53tests skill for this. Then you would
- 12:56actually go and give it this in the
- 12:58context window. So, the different thing
- 13:00that we're doing here is that rather
- 13:02than just give it 50 skills in one shot,
- 13:06we can see for each of these 10
- 13:08different categories, we've got five
- 13:10different skills in here. And if we're
- 13:12injecting that in the system prompt for
- 13:14every time we call the LLM, that's going
- 13:16to burn a lot of tokens. So, the idea is
- 13:20that the thing that we inject into the
- 13:22LLM is just the categories of skills.
- 13:27And then the Jev model itself will
- 13:29basically take the task that we've got.
- 13:32It will then decide which category to
- 13:35pick from, then it will be given the
- 13:37list of skills for that category, and it
- 13:41will then choose the most appropriate
- 13:43one to actually do this. So, let's look
- 13:45at this. So, if the task is basically
- 13:47someone saying, "Someone got an email
- 13:48pretending to be our CEO asking for gift
- 13:51cards, is this a hacking attack?" And
- 13:54you can see I'm running this through one
- 13:56of the bigger Jev models in here. But
- 13:57actually, you can try it out on a lot of
- 13:59the different Jev models. You can see if
- 14:01I run this and route it, it goes through
- 14:04and it basically first decides that the
- 14:07category here is security and access.
- 14:10So, it's done that as a choice. It's
- 14:12basically returned this back. And then
- 14:14in this category, it has a bunch of
- 14:17these in here. And we can see it decided
- 14:20investigate a security alert in here.
- 14:23And sure enough, the description for
- 14:24that is triage a suspicious login,
- 14:26phishing report, or security alert in
- 14:29there. So, you can see in this case what
- 14:31we've actually done is a sort of cascade
- 14:33classifier, where we've done one sort of
- 14:35classifier first to basically pick out
- 14:38the class of the category, and then
- 14:40we've done a second one to actually pick
- 14:42out the skill in this case. Because
- 14:44we're running this locally, it's done it
- 14:45super quick going through this. All
- 14:48right, you can see that if I give it a
- 14:50sort of general question here, we've got
- 14:52certain things that we can actually do.
- 14:54Let's route it through. Sure enough, in
- 14:57this case, it's basically saying do web
- 14:59research, fact-check a claim, right? It
- 15:02probably could have also gone for search
- 15:04the web, although I guess this does
- 15:06actually make more sense in that it's
- 15:08actually stating a fact and then asking
- 15:10if it's true here. And from there, we
- 15:12could load the skill file or use any
- 15:14sort of API, etc., that we actually
- 15:16wanted to there. All right, one more in
- 15:18here. You can see, "Okay, make me a
- 15:19short voiceover of this product
- 15:22description for a launch video. Now it's
- 15:24deciding that okay, that relates to
- 15:26images, audio, and video, and it needs
- 15:28to be a text-to-speech skill in there.
- 15:30So, this is a way of using Jev for sort
- 15:32of progressive disclosure with skills,
- 15:35especially if you've got lots of skills.
- 15:38By classifying them first into
- 15:39categories and then putting them into
- 15:42actually which skill is being chosen,
- 15:45you're able to get a very fast result
- 15:47here, and then the skill itself can
- 15:48actually be sent to the large language
- 15:50model to work out any arguments that
- 15:52need to go into that skill, those kinds
- 15:55of things. But, this is able to help us
- 15:57reduce on token spend, but also just
- 16:00speed things up like this. Another one
- 16:02that you can use in the same sort of
- 16:04vein of this is doing sort of
- 16:05verification steps of things that come
- 16:08back from APIs. To basically have the
- 16:10whole thing make a decision of whether
- 16:12whatever's coming back from the API is
- 16:15really good and can just go through
- 16:16straight through as a result, whether
- 16:18you need to change the arguments that
- 16:20you gave to the API, or whether you just
- 16:22need to call it again because you got a
- 16:23certain type of error, etc. The next
- 16:26demo is combining this with rag. So, one
- 16:28of the patterns in rag that works really
- 16:30well is go and get a lot of information,
- 16:33and then re-rank that information. And
- 16:36generally, there are ways to do that
- 16:37where you've got a separate re-ranker
- 16:38model. And that can work really nice as
- 16:40a pattern. The only challenge is that
- 16:43for certain projects, you just can't do
- 16:45that because of time, you can't do that
- 16:47because you're going to need more
- 16:48models, and especially if you're already
- 16:50using an embedding model on an API, you
- 16:53probably don't want to have lots of
- 16:55calls to the API for re-ranking, for
- 16:58that kind of thing. So, the idea here is
- 17:00that we can ask it a question, it will
- 17:02then go off, get a lot of different
- 17:05passages, then give those to the actual
- 17:09Jev model, which can decide, okay, these
- 17:12are the top five passages that I'm going
- 17:14to send to the full-size LLM. And there
- 17:16are different ways you could do this.
- 17:17You could basically do it on a sort of
- 17:18yes no thing. You could do it via sort
- 17:21of scoring kind of things. Or if you
- 17:23really wanted to just sort of pick one,
- 17:25you could actually just have a choice of
- 17:27one to see, okay, what's actually going
- 17:29to go through in there. Now, for me
- 17:31playing around with this, I find the
- 17:32scoring one seems to work quite nicely
- 17:34here. We then basically get a score. So,
- 17:37in our question here is, why are my
- 17:38webhook requests failing with an error?
- 17:41And then we can see, sure enough, we're
- 17:42getting back webhooks verifying
- 17:43signatures, second up webhooks raw
- 17:46bodies, third up was proxies, fourth up
- 17:49was webhooks signing secrets. And you
- 17:51can see that we've got the five things
- 17:53now that we can basically send back. And
- 17:56this is something that you could even
- 17:57use if you weren't using an embedding
- 17:59model. If you're just using something
- 18:00like BM25 to basically get different
- 18:04sections out, you can kind of get a bit
- 18:06of the best of both worlds by having
- 18:08sort of a broad sweep that gets you 25
- 18:11different passages back, and then using
- 18:13the Jev model, again in this case using
- 18:16one of the open local ones here, to
- 18:19actually go through and pick out the top
- 18:21five that you then send to your LLM. You
- 18:24can see if I try it with one of the
- 18:25other ones that it's then able to
- 18:27basically go through, get out different
- 18:29parts of the context, pick out stuff
- 18:32that's most relevant, and then pass that
- 18:34through. Now, these are certainly larger
- 18:37chunks of text than what I had with the
- 18:39skills before. So, it's perhaps not
- 18:41quite as fast as the cascading system
- 18:43that we had for the last one, but
- 18:46fundamentally the same idea of where
- 18:48you're doing scoring and classification
- 18:50using the world knowledge that's in that
- 18:52particular decision model to help it
- 18:55make simple but useful decisions for
- 18:58you. All right, so just to finish up,
- 18:59you can see that there are lots of uses
- 19:02of where you can use either the Jev
- 19:04model itself or the many open versions
- 19:07of this in building any sort of custom
- 19:10harness. And again, if you're interested
- 19:12to basically think of these things more,
- 19:14come through and read some of the Jev
- 19:16tutorials. This OpenRouter has got one
- 19:18up here. And when I'm actually using the
- 19:20Jev model, I'm going through OpenRouter.
- 19:22So, for those of you who are asking, if
- 19:24you haven't been whitelisted for the
- 19:26actual type-safe API on their site,
- 19:29anyone can just come and use the
- 19:30OpenRouter one here. Another useful
- 19:32resource that's worth checking out is
- 19:34LangChain has got a nice article about
- 19:36using Jev in LangChain, about different
- 19:39uses and stuff like that. They've
- 19:41actually made some middleware for doing
- 19:43this. But overall, I would say just try
- 19:45it out. If you're doing any sort of
- 19:47custom harness or any sort of
- 19:49modifications to an harness, it's
- 19:51definitely worth it looking at putting
- 19:53this in your pipeline to be able to get
- 19:56these really fast and really cheap
- 19:58decisions made for improving the results
- 20:00that your harness gets overall. Anyway,
- 20:02as always, let me know in the comments
- 20:03what you've tried out. I'm sure there
- 20:05are plenty of examples that I haven't
- 20:07put into this video. So, if you've got
- 20:08some interesting use cases, please share
- 20:10them cuz that would be really to check
- 20:12out and see what other interesting ideas
- 20:15people have got for how to actually use
- 20:16this kind of thing. And as always, if
- 20:18you found the video useful, please click
- 20:20like and subscribe, and I will talk to
- 20:22you in the next video. Bye for now.
About this transcript
This page contains the full transcript of Using Jev In Your Agent Harness by Sam Witteveen, generated from the public captions YouTube serves with the video. The transcript has 4,075 words across 564 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.