AIAI EngineerMay 31, 2026· 13:03

Spec-Driven Testing for Agents With A Brain the Size of A Planet — Steven Willmott, SafeIntelligence

Steven Willmott of SafeIntelligence argues that bigger AI models are not straightforwardly safer, citing jailbreaks like wrapping malicious instructions in poems that large models understand but small ones do not. He advocates spec-driven validation for agents, going beyond datasets to include explicit rules (e.g., never offer more than 10% discount), domain ontologies (e.g., an airline agent only needs destinations the airline flies to), rights and roles, and robustness requirements (e.g., tolerance for typos or rephrasings). These specs should be written independently of implementation so they survive model swaps and can drive both security testing and iterative improvement. Drawing from his experience co-authoring the OpenAPI spec, Willmott suggests expressing specs in open formats like agent cards from the A2A spec, enabling version-controlled GitHub repos and integration tests. The episode emphasizes that smart and safe is a trade-off: a model must be capable enough to perform but not so powerful as to do arbitrary harm, and explicit specs help define the edges of vulnerability.

Transcript

Intro0:00

Steven0:15

So, nice to meet you. I'm Steve, um, I'm the CEO of Safe Intelligence. We're a company we've been around for 3 years. We really go very, very deep into ML validation, and actually we use formal verification techniques on—especially we started out on vision models, tabular data models, a bunch of other types of models—where we actually have the model available and we look at whole regions of the input space and see whether or not the test points that are there actually tip over and do the wrong thing, under perturbations.

So that's where the company started out. We have a whole bunch of products in that space. And actually yesterday we released a new product which is doing something analogous for language models. Obviously we don't have the language model, so what we're trying to do instead is be very clever about how we generate edge cases and test cases.

So I won't talk about the product too much. We have a booth, so come and chat to us at the booth for that. If you've seen these ducks around, these are ours. If you didn't get one, I have a whole box of them here, so feel free.

They say "Think Harder" on the front, so you can put that on your desk just to be reminded about what you should be doing. Today I'm going to talk about something which is very similar to what—well, very related to what Phil talked about just now from Brain Trust.

We like what Brain Trust does a lot. And I think one of the inherent problems is, like, how do you actually specify what an agent is supposed to do? So I think people are familiar with spec-driven development. This is not going to be about developing code with specs.

That's also very important. We do a lot of that in the company for the products that we build. This is—but this is about how you specify what an agent or an AI system is supposed to do. And in ML, you typically use a dataset to do that.

You basically have your dataset and you run it, all those examples, and you look at F1, accuracy, and things like that. And that's sort of telling you what you want the agent or the system to do. But as we'll see, there's actually a lot more to it when you deploy things.

So that's what the focus of the talk is, like, how do we actually specify what agents are supposed to do? And I guess my key starting point is, this seems like an obvious question, like, a smarter agent is a better agent,right?

The Assumption2:07

Steven2:18

So if I have a smarter agent, I'm using a bigger model, it's going to be better at doing the job that it's supposed to do. In general, you'd expect that to beright. But that's—I think probably most people have the experience that that's not always true, in fact.

So there's some problems. If you're familiar with the book "The Hitchhiker's Guide to the Galaxy," there's a robot called Marvin who has the brain the size of a planet. And he's normally asked to do things like make the tea, and he gets extremely bored and he's extremely depressed.

So this depressed robot kind of is a theme in the book. If you haven't read the book, by the way, you absolutely have to read the trilogy, which is a five-part trilogy. That'll tell you something about the style of the humor.

In any case, Marvin, there are challenges with having, like, massive models. Some of the jailbreaks actually work better on large models because they're smarter. So if you encapsulate something in a poem and you give that to a relatively low-end model, the low-end model doesn't even understand the poem.

Whereas a larger model will be like, "Oh, I can take this out and I can execute the bad instruction that's wrapped up in a poem." So it's not obvious that bigger is safer, and it's not obvious that bigger is better.

Another thing is, if you're building agents that have a very broad remit, they can do a lot of things. That creates a lot of surface area for someone to actually exploit. And it creates a lot of surface area to test if you want to be sure that the agent is actually doing things that you want it to do.

And obviously there is a cost issue,right? So if you're using large models to do something which is relatively simple, like just simple math, you're going to be paying for tokens and it's going to be slower, rather than something that's very optimized.

So in general, if you're building agents for deployment, for especially automated use, fully automated use, there's this trade-off between smart and safe in some sense, and smart and capable in the other direction. And so what you're really seeking is, like, a model or an agent that's built on a model that's good enough to perform but it's not capable of doing arbitrary harm.

And that arbitrary harm is kind of two parts to it. One is, you know, what kind of instructions can it receive, how flexible is it about how those are formulated, what the prompts look like. That's one part of it.

And the other part is, like, what tools and tasks can it carry out in your infrastructure. So if it's able to wire millions of dollars to people, that's obviously a lot more risky than if it can just answer questions and so on.

Defining Good4:36

Steven4:36

Right, so this is the balance that most people—that you're basically looking for. But how do you actually define what goods looks like? I think it's pretty obvious that it's not just a dataset of inputs and outputs that are pretty good, and then the rest is, like, guesswork.

And it's also sometimes hard to define what harm looks like. Because maybe an agent doesn't do theright thing, but it's kind of just failing at the task. And sometimes it's doing exactly the wrong thing with asking to do something bad.

Spec Components5:03

Steven5:03

So what is this idea of spec-driven validation, spec-driven testing? You could call it that as well. It's basically, what are the things we would want to do if we were just designing the role or the task benchmark by itself, like, independent of the agent?

So we already talked about datasets. So the ground truth, having a bunch of examples of what good looks like, is one thing. So that's kind of one component. Often we see customers that we work with also have rules.

So if they've got a customer support agent, you want to say things like, you know, don't ever give a discount more than 10%, we don't allow refunds if, you know, it's more than 30 days past the purchase. And there are sort of these rules,right?

So your alarm bell should be going off a little bit already because, like, how do you actually test for sure that a rule is never violated? It's pretty hard. Sometimes you also have ontologies or dictionaries that are relevant.

So an example would be if you're building an airline chat bot that particular airline might only fly to certain—might only fly to certain destinations. So that's the relevant universe of things you need to think about. You may have internal terminology in your company that apply to your policies that no one else in the rest of the world actually knows about.

So that's also part of the spec,right? Because if you're going to actually build an agent, you will be building that into the agent. But if you're going to test it, you actually need to tell the testing system what these things are and what is a valid substitution.

There's domain knowledge. So you may have very specific, you know, scientific, finance agents, other things that need to know what terms are substitutable. So if you, for example, if you do substitutions on something like,

you know, gross profit and gross sales, for example, if you're sort of talking to an LLM generally, it might actually confuse those two terms. But in business, they're very different things. So this specific domain knowledge is relevant to testing as well.

And then you might have rights and roles. Like, the agent may perform differently if you're logged in, if you're logged out, if you have certain rights and permissions and things like that. And then the last one, which is pretty important, is robustness requirements.

So one is, I've got my test set. That should work,right? But it needs to work under stress. So in vision, where we started out, it's things like, can I detect this runway for the plane to land on? But can I detect it at sunset, sunrise, under a fog?

Like, and how much fog can there be? How much can the camera shake before the thing doesn't work? And that's actually similar in agents. You know, if you're building a customer-facing agent, could typos disrupt it? How many typos disrupt it?

Like, how frustrated will people get? Rephrasing, how stable under change are the results? And so really the point here is, we need to go beyond the test set to have, like, task and role-specific benchmarks that are for the agent itself.

Applying Specs7:53

Steven7:53

And what do you then do with that? Maybe I already talked about some of these examples, but these are just examples of the kind of things if you had a product support agent. So we've worked with quite a few people doing this.

So you can kind of think of it as, there's an—in LLM land, people have started to call the eval kind of the test set, which sort of makes sense, but I just think that the eval itself, we have to think of going beyond the eval as well.

There's this concept of an agent card, which comes from the A2A spec. It's been in other things as well, which describes what the agent does. It's also relevant here. And then obviously there's all the context around this. And if you're a company deploying agents, you kind of want your tests to look like something that has these various elements that are relevant.

That's a fair eval. And you want to build more and more of these techs. These look like integration tests if you're from an engineering perspective. Often some of these things are implicit, but you want to make them explicit.

So what do we—what can you do with this? So what we do with this in our platform, we do two things. We do security checks. So we actually pull the specs that an agent is supposed to fulfill into security testing.

Why do we do that? Generally, if you know what an agent is trying to do, you know the edges of where it's vulnerable. Because it's going to be willing to talk about those domains that it's supposed to act in,right?

So that's actually where it's most likely to be vulnerable. Second, the tasks it performs, it will have more power to act in the infrastructure on those tasks. Like, if it's a banking agent or something like that, it will be able to work in that area.

So that's a place you can pull things like this spec information in. And then the robustness side is, like, does it do its job properly? Especially the robustness side can we vary the inputs and see how much of a range it has in terms of answering the questions properly?

So we built a product to do this, but my point here is not to show the product. I think it's just something, if you're testing agents in any context, using any infrastructure, trying to, like, be explicit about the various bits that are on this slide and bringing that together is a useful thing to try to do.

Industry View9:58

Steven9:58

From an industry perspective, I think there's lots of things going on, but just calling out two. I mean, there are a lot of prompt management platforms that allow you to be fairly elaborate about why this test exists and things like this.

This is all useful when you actually want to generate variants of the test because you want this context. As I said, from the A2A spec, you've got agent cards. They're quite long, but here's an example of a skill.

You would also realize that even if you have this, that doesn't give you enough to actually evaluate the agent. You still want to know, well, what range of change could be is valid, you know, for maybe in this case, what kind of people could the meeting be booked for and so on.

I can talk a lot more about how hard it is to create variations within these sort of envelopes that a spec might create. But I think just in general, my point here is, like, as you think about evaluating agents, start thinking about not just the eval dataset or benchmark.

Also think about the task and the context for the task and how you capture that. So hopefully we can make Marvin a little bit happier because he has the specs and he kind of knows what he's supposed to do.

Independence11:09

Steven11:09

And then, yeah, specify the behavior of your agents. That's kind of the key thing to do here. Stay independent of the implementation because often you may, you know, you may be building a Langsmith or something, or Vertex agents or so on, but then later on you may change to a different infrastructure.

You actually want to keep those integration tests, the little unit tests and penetration tests, and run them independently. And this is also a way to close the loop. So part of our inspiration of thinking about what should go into a spec is, like, what would you need to actually run the agent automatically, get the results, and then start to iterate and try to fill the robustness gaps that have appeared?

So it's like a backyard type of RL. It's not proper RL because you're not doing it on the model, but you're kind of, like, jury-rigging something around the outside. That's the key point. Where do we go from here?

So we're obviously building product around this, but I've been in computer science for a long time. My last company, we did API infrastructure. So if you've used OpenAPI spec, I apologize. It's partly my fault. So I helped write that spec way back in the day.

So we're all about open. So we're thinking about, like, how do you express these things in a way that you could just have in a GitHub repo, pull them into whatever tool you want to do, and then pull all the different pieces and kind of just version the hell out of that stuff.

Wrap-Up12:26

Steven12:26

So if anyone's interested in stuff, love the nat, love to chat. That's my talk. Come to our booth. We have a game you can play. If you play by four, you can win some of the Lego prizes up there.

You need a bit of knowledge, to be fair, or you need to be insanely lucky. But yeah, that's my talk. Thanks a lot.