Engineering

Fighting LLMs with LLMs: A decision model to judge every decision your agents make

Written by
Asaf Rosentswaig
Published on
November 17, 2026

An engineer's coding agent needs a command-line tool. It goes looking, lands on an install script in a stranger's GitHub gist, downloads it, and runs it on the engineer's laptop with the engineer's access.

No rule or alert fired. The script didn't match any signature, the command didn't match any pattern, and nothing about the string looked unusual. The only indicator that this might be a problem came from a decision model, a small AI model whose whole job is to look at an action and judge what it is actually doing.

This wasn't a lab exercise. When we looked back over 90 days of real-world agentic coding activity, we discovered five cases where agents downloaded and executed code from personal repositories, gists, or anonymous file hosts. None of them were caught by our existing detection rules. However, the decision model caught all of them. 

This post is about the risk that arises from LLMs making questionable coding decisions, why security controls struggle to catch these risky actions, and why we think the best protection against AI agents making bad choices is, quite literally, more AI. Just not the kind you'd expect.

Meet the decision model

When people hear "we use LLMs for detection," they usually picture a chatbot reading logs or agents poking around an environment. A decision model is neither of those things.

A decision model is a small model built to do one thing: Answer a narrowly scoped question about a piece of evidence and return a probability. It doesn't write explanations. It doesn't call tools. It doesn't take action. You give it an event and a question, and it gives you back a number between 0 and 1.

The simplest way to see it is with something that has nothing to do with security:

Scores are real outputs from a decision model.

The rule only sees the word "banana," it calls the toy food, and it misses the emoji entirely. The decision model gets all three right, because it judges what the thing is, not how it’s spelled. Now swap the banana for a command run by an agent, and ask a different question: Does this run code downloaded from a stranger? Now you have a detection.

That sounds modest, and that’s exactly the point. Narrow, probabilistic judgments have three properties that matter for security:

  • They're fast and cheap enough to run on every action. A decision model doesn't need to be saved for the alerts a rule already raised. It can look at each command an agent runs.
  • They judge meaning, not spelling. The model understands what a command does, so it doesn't care how it's written.
  • They're easy to put inside guardrails. A probability is an input to logic we control, not a conclusion we have to trust.

So yes, we're fighting LLMs with LLMs. The obvious objection is the right one to ask: If an AI agent can make bad decisions, why trust an AI to judge it? Who checks the checker?

Our answer lies in how the pieces fit together. The decision model only decides, it never acts. All it does is return a number between zero and one. Our own code supplies the facts the model can't know on its own, like which domains belong to the customer and where a piece of code came from. And the final call, alert or don't, stays in deterministic logic that we write, test, and version like any other detection. The model brings judgment. We keep control.

That also limits prompt injection. The questions are ours and fixed, and whatever the agent wrote reaches the model only as evidence to judge, never as instructions to follow. Even then, the model can only return a number.

Agents improvise

To see why this matters, it helps to look at what agents actually do all day.

A coding agent acts with the full access of the person who runs it: their shell, their credentials, their cloud sessions, their repositories. It works at machine speed. And almost everything it does looks legitimate because almost everything it does is legitimate. Installing a package, reading a config file, opening a pull request: that's the job of a coding agent in the same way that it’s the job of a person who writes code for a living.

The difference from a human is that every action is a decision the agent makes on its own, in the moment, and it rarely makes the same decision the same way twice. Ask a human engineer to install a tool, and they'll paste the same one-liner every time. Ask an agent and you get variations:

All five do the same thing: fetch a script from someone's personal gist and run it. A typical "download piped to shell" rule catches the first. The rest slip through because they're wrapped in a prefix, nested in another shell, tucked inside a conditional, or saved to a file first.

You can keep adding patterns, and detection teams should and do. But a known pattern only matches what someone already wrote down, and an agent writes something new every time. And the reverse problem is just as real: Broaden the pattern enough to catch every variant, and it starts firing on every agent that pipes an API response into a JSON parser. Now you’re flooded with benign alerts.

The rule vs. the decision model

Here's what that looks like in practice. These are four patterns from real agent activity. In each one, a detection rule failed to raise an alert. A decision model, however, looked at the actions and saw the risks.

The stranger's script

We saw an agent download a binary from an anonymous file-hosting link and install it so the user's shell would run the binary from then on. The binary didn’t come from a known or approved vendor, it carried no code signature, and nobody reviewed it. 

The unprotected key

An agent working on a file-transfer integration took the private key used to connect to a financial partner, removed its passphrase, and copied the unprotected key out. Every command along the way is standard key tooling that engineers use daily and that were unlikely to trigger a behavioral detection, but removing the passphrase obviously introduced risk.

The borrowed session

To finish a task in a business application, an agent decrypted the browser's saved cookies using the operating system's keychain, pulled out the session, and used it to act in that application as the user. No password was typed, and no login was recorded, despite what clearly looks like risky session hijacking.

The hardcoded secret

An agent opened a pull request whose purpose, in its own words, was to hardcode a client secret and remove the repository's encryption. A routine commit, by every string-level measure, but ultimately a risky one that could expose a hardcoded secret. 

None of these looks malicious as a string. Each one is risky because of what the agent decided to do.

They weren’t attacks, either. Each was an agent doing its job a little too creatively, with real access. They weren't the result of a threat, but the actions were risky nonetheless. That's exactly why they're hard to catch, and this is why AI adoption is inherently risky if you aren’t careful. There's no malware to match and no bad actor to profile. There's just a decision that shouldn't have been made, and the only way to see it is to judge the decision itself.

The numbers

We tested this approach on 90 days of AI coding agent activity across customer environments and compared it to what was caught by our existing detection logic and alerting.

On agents downloading and running code from untrusted sources, the known-pattern rules caught 0 of 5 real cases. The decision model caught all five.

On a hand-checked sample of commands, the decision model correctly identified 91% of the ones that downloaded and ran code, at about 95% precision. The known patterns found 17%.

Most of that gap is the variation shown above: same behavior, different spelling.

Credential access shows the other side of the problem. The obvious known pattern for it, one that looks for credential stores and secret-reading commands, would fire about 1,000 times a day on agent activity alone, and it still wouldn't flag the borrowed session above because the commands involved look like every other credential lookup. A rule there gives you more noise and less signal at the same time. A decision model gives you a ranking by what is actually happening.

These are testing results, not a finished product, and we're treating them that way. But they're consistent enough that we're building on them.

Where Daylight is going

Detection has spent twenty years getting very good at matching strings, hashes, and known behavioral patterns. That works when the thing you're looking for behaves the same way every time. AI agents don't, and they're now running in almost every engineering org, with the keys to production.

Our direction is simple to state: a judgment for every agent decision. Every action an agent takes can be judged by a decision model on intent: Where did this code come from, what is this command doing to this credential, is this secret leaving its home? Those judgments feed deterministic detection logic we own, and the results flow into the same investigation and response pipeline we already run for our customers.

For a SOC, that means two things. Fewer alerts that exist only because a string matched, which is most of what agent-related rules produce today. And the risky agent behavior that string matching never sees, surfaced with the context to act on it.

Agents are where this matters most right now, but they're only the start. Anywhere behavior is too open-ended to spell out in a rule, a narrow question about intent works better than a longer list of patterns.

Running agents across engineering?

Talk to us about detection built for how agents actually behave. And if you want to build AI-native security engineering, we're hiring.

Subscribe to newsletter

Subscribe to receive the latest blog posts to your inbox every week.

Thanks for your interest.
Oops! Something went wrong while submitting the form.
By subscribing you agree to our Privacy Policy.
Two pinkish translucent bubbles of different sizes on a black background.Two pinkish translucent bubbles of different sizes on a black background.Two pinkish translucent bubbles of different sizes on a black background.
Illustration of a mythical hippocampus creature with the upper body of a horse and the lower body of a fish with scales and a curled tail.Illustration of coral colony with tube-shaped and frilled coral structures in shades of pink and red on a transparent background.

For expert judgment, scaled to your world, head for Daylight