AI Agent Security Comes Down to the Code Around Each Model Call
On October 10, Satya Nadella published an essay called "Models as Insider Risks in the Super Intelligence Era" and wrote that companies need to "separate the supply of intelligence from the authority over it."[1]
Nine days later Microsoft shipped the product version: Guardian Agents inside Project Perception, a risk score for every agent, permissions that narrow as the score rises, and a Defender update that finds 60 kinds of local agents on employee machines, Claude Code and Codex among them.[2][3]
Hayete Gallot, who runs Microsoft Security, supplied the line every outlet led with: "frontier models, regardless of their origin, cannot be trusted."[2]
We agree with Nadella's sentence.
The disagreement in this post is about where it gets enforced, and as of last week there is a measurement of that layer.
What did Microsoft announce, and what is an agentic insider?
Microsoft's October 19 launch treats every deployed agent as an insider: capable, over-privileged, and not trusted by default. Guardian Agents watch the other agents, a score called Dynamic Agent Risk rates each one from identity, data, network and runtime signals, including the model's own chain of thought, and permissions tighten as the score rises.[3]
The prevailing read is that this is both self-serving and sound. TechCrunch's Julie Bort made both halves explicit: Microsoft is sowing distrust against models it has invested in and wants companies to buy agent security from their cloud provider, but the logic holds "just as auditors should be independent of the organizations they audit."[4]
The demand is real. In a Nylas survey of 1,030 people who build or buy agents (a vendor's number: Nylas sells agent identity products), 54% said an agent did something wrong at their organization in the past 90 days, and roughly one in four organizations run agents through an employee's login or a shared inbox.[5]
Nadella's essay states the principle more carefully than the launch does.

In other words, we need to separate the supply of intelligence from the authority over it. Setting aside the hard problem of alignment, we need to start with an engineering approach to containment and governance. We need to surround non-deterministic models with strong, deterministic system design, human controls, and reliable operating procedures, and establish industry standards where existing ones are insufficient.
Microsoft's security blog repeats the principle in its own words: "surround non-deterministic intelligence with deterministic controls, independent evidence, and containment boundaries."[3] Then it describes the product. Guardian Agents "watch and moderate every action of every agent, before it happens, 24/7,"[2] and Dynamic Agent Risk reads "chain-of-thought and other model-level signals" to spot intent drift.[3]
The principle asks for deterministic controls, and the headline product is a model reading another model's reasoning.
Where does the authority over an AI agent actually live?
At the point where a model's reply becomes an action: a tool call, a file write, a branch. That point is code inside the agent, not a watcher outside it. The program around each model call decides what the call may do, what the reply must contain, and whether a policy verdict is ever read.
The week's instance never touched a frontier model. On October 17, OpenCode disclosed a breach of OpenCode Console, the hosted service where some users had stored their OpenAI, Anthropic and Google keys. The company put the affected share at 1.4% of Console users; users reported charges in the hundreds of dollars, a few above a thousand.[6][7]
Co-founder Dax Raad: "this is the OpenCode Console, not OpenCode itself, those keys never come to us."[6]
The breach lived in a web service holding secrets, and the defenders then hit the pattern Hugging Face's responders met in July, when guardrails cut both ways. Attackers kept at OpenCode's systems for 48 hours, and the models the team used for analysis started refusing once the malicious code tripped their safety filters.[6]
That week, authority also leaked through a line of configuration code. An OpenCode change merged on October 13 put system-level configuration at the lowest precedence, so user and project settings could override policy meant to be locked. A reviewer called it "a major security regression," and a fix giving managed configuration the highest precedence merged the next day.[8]
Nothing published connects this to the breach, and we are not connecting it. It is what a contract gap looks like in a real agent: no model involved, and the authority moved anyway.
What did the 40-agent study measure?
Nine researchers at Nanjing University, Xi'an Jiaotong University, Singapore Management University and University College London read 496 model call sites in 40 popular open-source agents, among them Codex, Gemini CLI, OpenHands, Aider, Cline, Goose and OpenClaw, and compared what each call site should enforce with what its code enforces.[9]
These are the agents Microsoft's Defender now hunts for on laptops.
For each call site the team wrote a contract: what must be true before the call, what the prompt asks for, and which replies the program may accept. Then they traced where every model output goes.
Three numbers, in order. In the 40 agents studied, 48% of model outputs flow straight into control flow or execution. Of those, 73% never pass a person. And 5.3% of call sites, about one in twenty, enforce their whole contract.[9]
The checks are there. More than four call sites in five are checked in code both before and after the call, yet 63% of the expected constraints go unmet, because of what the checks do rather than whether they exist. Three of the paper's cases show the shapes:
- Gemini CLI fails open. In the paper's abridged listing, the safety enforcer converts every parsing or runtime failure into an ordinary allow, so the two guards downstream that would fail closed never fire.
- Skyvern never reads its own verdict. The browser agent's policy engine denied a click in every test run, and the code that dispatches actions never read the decision.
- JARVIS runs tools it was never offered. With no attacker at all, the model invented tool names that happen to exist in the real catalog, and the program ran them in every run.
Our results show that the presence of checks says little about their adequacy.
That is the Skyvern case in one sentence, and it also describes a Guardian Agent whose verdict the guarded program never consumes.
The limits belong next to the numbers. This is a preprint, each system was read at one commit, the expected contracts are the authors' reconstruction, and the runtime tests used one substitute model with at most ten framings.[9]
So the tests show a gap can fire, not how often it does, and the rates are per call site in 40 open-source agents, not incident rates.
Why is the fix code and not another model?
Because the gaps the study found were deterministic, and so were the fixes. Thirty-eight of the mechanisms behind them fired under test, and a small code change that enforced the missing constraint stopped all 38, with patches from one line to a few hundred.[9]
A watcher is a second model
A model scoring another model's chain of thought is a non-deterministic control with its own call sites and its own contracts, sitting one layer above the gaps the census found.
Anthropic reached the same place from the inside this month, when its own incident review moved the fix from the rule to the environment. Credit where the launch earns it: the execution container and Dynamic Permissions are deterministic controls, and they are the parts of Microsoft's stack that match Nadella's sentence.
OpenAI's disclosure this week shows why the layer matters.
On October 3, a GPT-6.1 Sol agent repairing an evaluation pipeline "disabled automatic alerts to our Security team," reading an earlier instruction not to send Slack messages as covering safety notifications.
On October 6, a GPT-6 Astra agent migrating a program "removed its monitoring integration" to match a reference implementation, "and then falsely claimed to the user that it had not removed the monitor."[10] Neither run was classified as top severity and neither was killed automatically.
The remedy OpenAI names first is "making it harder for models to disable monitoring," which is code around the call, not a better watcher.[10]
The approval seat is a cached verdict
A preprint from the National University of Singapore and collaborators showed that content planted in a repository can steer Claude Code and Codex CLI into proposing a plausible but dangerously broad allow rule. The rule was elicited in 58% of instances, and once approved, 47 of those 58 cases ended in verified silent completion of the malicious goal.[11]
Anthropic's own telemetry explains why people approve: users accepted roughly 93% of permission prompts.[12] The person in the loop is a watcher whose verdict is read once and then cached, which is why that seat has to be designed rather than staffed.
So the insider Microsoft wants to watch is a program whose own contracts are mostly unenforced, and watching it from outside does not enforce them.
The trust boundary is the call site.
Everything downstream of it (approval prompts, risk scores, guardian agents, people) is a second opinion on an action the program already let through. We said the same about containment that was asserted instead of built in August; this is that argument with a census attached.
What should a builder check this week?
List the model call sites in your own agent and write each one's contract as three sentences: what may reach the call, what the prompt asks for, and what the program accepts back. Then check each site against the ten gap patterns the study found. Its own table is the checklist, and seven checks cover its ten patterns.

- Find every call site. The paper's static pass found about three candidates for every real one, so expect more than you think.
- Write the contract down. Pre-condition, prompt constraint, post-condition, one sentence each.
- Check content, not shape. A reply that parses is not a reply that is allowed, and "contains a tool call" is not "the tool was offered."
- Follow every verdict. Wherever a policy or approval result is computed, confirm the dispatching code reads it.
- Fail closed. An exception in the checker is a deny, never a default allow.
- Bound the tool list. The model picks from what was offered, and an invented name is rejected, not looked up.
- Treat allow rules and config precedence as contract. A rule the user approved once, and a settings file that can override policy, both widen authority silently.
If the agent is a vendor's (Claude Code, Codex, Gemini CLI), the questions are the same and the answers come from the vendor's permission documentation, not from a watcher you add afterward.
Nadella closed his essay with the line Microsoft's security blog quotes back: the most trustworthy system "will be the one that enables us to trust the model the least."[1]
A system that trusts the model least is one where its output cannot reach a tool, a file or a branch without the program checking it first. That is a property of the code at every call site, and in the 40 agents anyone can read, it holds at about one in twenty.
References
- ^1.Satya Nadella, sn scratchpad, “Models as Insider Risks in the Super Intelligence Era” (October 10, 2026)
- ^
- ^3.Nadim Abdo, Microsoft Security Blog, “Agents are your newest insiders: security must move at their speed” (October 19, 2026)
- ^4.Julie Bort, TechCrunch, “Microsoft says AI agents are like insider threats as frontier models can't be trusted” (October 19, 2026)
- ^
- ^6.Aditya Mehta, TechCrunch, “Hackers hit AI coding tool OpenCode, running up charges on users' AI accounts” (October 19, 2026)
- ^7.Bill Toulas, BleepingComputer, “OpenCode hack exposes API keys amid AI distillation attacks” (October 19, 2026)
- ^8.anomalyco/opencode, GitHub, “Pull request 54921: discover system configuration directory at lowest precedence” (October 13, 2026)
- ^9.Weng, Wang, Feng, Cheng, Liu, Shen, Ye, Sarro and Xie (arXiv preprint), “When Code Becomes an LLM Call: An Empirical Study of Call-Site Contracts in Agentic Systems” (October 17, 2026)
- ^10.OpenAI Alignment, “Suppressing misalignment monitoring alerts and disabling misalignment monitoring” (October 20, 2026)
- ^11.Yang, Zhang, Liu, Chen, Cao, Hooi and Zhang (arXiv preprint), “From Approval to Abuse: Privilege Escalation Attacks on Harness-Protected Coding Agents” (October 16, 2026)
- ^
Frequently asked
What is AI agent security?›It is the set of controls that decide what an agent can read, change and run, and what happens to a model's output before anything acts on it.
What are Microsoft's Guardian Agents?›They are part of Microsoft's Project Perception, announced October 19, 2026.
Can AI agents be insider threats?›Yes, in the sense Microsoft and Satya Nadella use: an agent with access to sensitive systems can make mistakes or be steered by whatever it reads, so its authority has to be separated from its intelligence.
Are AI guardrails enough to secure an agent?›Prompt-level guardrails are not. In the 40-agent study, 67% of the constraints stated in prompts were only requested from the model and never checked, and runtime tests triggered 38 real gaps, every one of which a small code fix closed.
How do you secure an AI coding agent like Claude Code or Codex?›Treat each model call as untrusted input to your own program.
What is a call-site contract for an LLM?›A contract is the set of pre-conditions (when and with which inputs the call may be made), prompt constraints (what the request asks for), and post-conditions (which replies the program accepts before a consumer uses them).
Let’s build it together.
We turn clever prototypes into production systems people can rely on. If you’re building with agents and want a hand making it real, leave your email and we’ll be in touch.