A model writes. It does nothing else.
A large language model receives a sequence of tokens as input and generates a sequence of tokens as output. Every capability to act that it is credited with in practice, whether querying a search engine, running a calculation or changing a database record, belongs to a third-party program. Anthropic's technical documentation sums up this split of roles in one sentence: the model "returns a structured call that your application runs (client tools) or that Anthropic runs (server tools)". In plain terms, the neural network only formulates a structured request; the application code executes it.
The execution cycle comes down to four basic steps. The client application gives the model a catalog of tools, each defined by an identifier, a description and a JSON schema of arguments. In its response, the model emits either a text message or an invocation request flagged by stop_reason: "tool_use". The orchestration engine intercepts that structure, calls the matching function in the information system, then feeds the output back into the model's context in a tool_result block. The model then resumes generating, taking that result into account.
Between the action the model wants and its actual execution in the information system, there is always a deterministic function call. It is the only cut-off point where the company can say no.
Tools: the request to call is learned, the execution is code
How language models learn to invoke tools has been formalized in the academic literature since early 2023. In the paper Toolformer: Language Models Can Teach Themselves to Use Tools (Schick and coauthors, February 9, 2023), the researchers show how a model teaches itself to call on a calculator, a search engine, a translator or a calendar. The model decides which tool to call, at what point in the text and with which parameters. But what the network's weights encode is limited to the decision to emit a formatted string; running the tool remains conventional code.
This distinction governs the whole security architecture. The choice to invoke a tool results from probabilistic inference, sensitive to all the text present in the context window. By contrast, executing the call is the job of a deterministic program under your control. You do not govern the first with strict rules; you lock down the second completely.
The Model Context Protocol (MCP) standardizes this mechanism at industrial scale: tool servers expose their capabilities, a client declares them to the model, then routes the calls it generates. The official specification describes these tools as "model-controlled," meaning the model discovers and invokes them autonomously according to its reading of the context. The same document also carries an explicit warning that is often overlooked during integration:
For trust & safety and security, there SHOULD always be a human in the loop with the ability to deny tool invocations.MCP specification, version 2025-06-18, "Tools", User Interaction Model
The authors of the standard thus say it bluntly: responsibility for access control falls entirely on the client layer around the protocol. The vulnerabilities specific to this ecosystem are analyzed in detail in our dossier MCP and tool server security.
What is an agent, if not a model you keep rerunning?
A single function call is not enough to characterize an autonomous agent; it is iteration in a loop that changes the nature of the system. In its engineering guide Building effective AI agents, Anthropic draws a clear line between two families of architecture. On one side, workflows orchestrate models and tools along hard-coded execution graphs. On the other, agents are systems in which "LLMs dynamically direct their own processes and tool usage". The document condenses the technical architecture into a direct formula: in practice, agents are "typically just LLMs using tools based on environmental feedback in a loop".
The theoretical foundation of this architecture goes back to the paper ReAct: Synergizing Reasoning and Acting in Language Models (Yao and coauthors, submitted October 6, 2022). The researchers replace linear generation with an alternation between internal reasoning traces and action calls to the environment. In their words, these reasoning steps help the model "induce, track, and update action plans". Each action returns an observation from the environment, which feeds the next round of reasoning until the task is solved.
At each iteration of this loop, three operations follow one another: the model reads a context window that keeps growing, emits a new tool call, then the orchestrator runs the call and appends the raw output to the context. What the tool returns becomes the direct input of the next turn. As soon as an agent consults a web page, a ticket or an email, that external text is injected into the heart of its context on the same footing as the initial instructions. This is the exact mechanism of indirect prompt injection: the adversary has no need to interact with the agent's interface, only to drop instructions into a resource the agent will end up reading.
Anthropic's guide itself lists the barriers needed to contain this loop: define strict stopping conditions such as an iteration cap "to maintain control", build in pauses for human validation "at checkpoints or when encountering blockers", and test the system "in sandboxed environments, along with the appropriate guardrails". Each of these three safeguards lives in the orchestrator's code, never in the model's weights.
Memory: what survives from one turn to the next
As Anthropic's documentation illustrates, the second turn of an agentic session sends the model the entire conversation history, including the tool_use blocks it emitted and the tool_result blocks it received. The agent's perception of its task therefore depends entirely on what the application chooses to feed back into its context window.
To keep this state beyond a single session, agentic architectures rely on persistent memory that lets the agent "store and retrieve information across conversations in files you control", in other words read and write notes from one session to the next in storage controlled by the application. Technically, this memory is nothing more than one more tool: the model requests a write or a read, and the host program carries out the operation on disk or in a database.
For security, this persistence opens a vector for delayed contamination. Anything the agent writes to memory during one session will be reloaded as trusted context in later sessions. If the agent summarizes and memorizes an external document containing a hostile instruction, the malicious payload survives the end of the original task and reactivates later. The security of an agent's memory depends less on its storage format than on the provenance of the sources allowed to trigger a write.
Planning: a plan is text
When an agent breaks down a complex mission, it first drafts an action plan in natural language before working through the steps. At first sight, this upfront display gives the impression of a predictable roadmap that could be validated once and for all. In reality, this initial plan commits nothing about the rest of the execution: it is only one text generation among others, which the model freely rewrites at every turn of the loop according to the results its tools return, as the ReAct mechanism describes.
Validating the plan announced at the start of a session therefore amounts to judging a mere statement of intent that may fork at the first external read. The real operation materializes at one instant only: when the tool call leaves the loop to be executed. The risks specific to extended reasoning chains are the subject of our analysis Long-horizon reasoning and security.
Three places to put a control
In this architecture, a security mechanism can be inserted at three distinct levels, whose guarantees are very unequal.
| Where | What it is | What it sees | What it cannot guarantee |
|---|---|---|---|
| In the model | Alignment through training, defensive instructions in the system prompt. | The token sequence present in the context. | That the instruction is followed. As CERT-FR notes, defensive prompt wording "can be bypassed through injection attacks" (our translation). |
| Around the model, upstream | Prior inspection of incoming flows: detection classifiers, syntactic cleaning. | External data before it is inserted into the context window. | That nothing gets around it. Every new reading tool connected to the agent opens an additional input channel. |
| At the tool call | A deterministic evaluation applied to every action request before it runs. | The exact operation: tool name, arguments, recipient, and the sources read upstream. | Nothing escapes it, as long as every call into the information system passes through this cut-off point. |
The first approach relies on the docility of the very model it is meant to constrain. The second bets on exhaustive detection of malicious text at the entrance, when the nature of an agent is to multiply its sources of reading. Only the third level rests on an architectural invariant: whatever trick fooled the model, acting requires a structured call that code intercepts and executes.
This is exactly the cut-off point on which CERT-FR builds in its bulletin CERTFR-2026-ACT-016 of April 13, 2026:
human validation must be mandatory as soon as a system command or an action with a side effect is envisagedCERT-FR, CERTFR-2026-ACT-016, April 13, 2026 · our translation
The requirement targets neither the prompt nor the model: it falls on the tool invocation, whenever the operation produces a "side effect" beyond simple text generation.
Which combination makes an agent dangerous?
On June 16, 2025, Simon Willison summed up the precise conjunction that exposes an agent to hijacking under the name "lethal trifecta". The critical risk appears as soon as one agent combines three capabilities: access to confidential internal data, intake of untrusted external content and a channel for outgoing communication that can exfiltrate that information. As soon as these three properties coexist in one loop, he writes, "an attacker can easily trick it into accessing your private data and sending it to that attacker".
These three properties can be read directly off the catalog of tools connected to the agent, whatever model is chosen. Without an internal read connector, without exposure to sources you do not control or without an external write channel, the exfiltration chain cannot form. The danger therefore results from a choice of assembly and integration, whose legal implications are detailed in our study What the AI Act requires of an AI agent that acts.
What this changes for architecture
Three engineering rules follow directly from this anatomy of the agent.
- Control must apply to the tool call, never to the model's talk. The displayed plan and the chain of thought are only statistical generations; only the structured call changes the state of the information system.
- Policy enforcement must stay external to the model. Any guardrail that assumes the model follows its instructions gives way together with it under an injection.
- The decision engine must know the session's reading history. The legitimacy of a call depends on what triggered it: authorizing an external send without knowing whether the agent has just read an untrusted source means ruling blind.
SentinelOS sits inline between your AI agents and all the tools they call. It evaluates every action before it runs, including when the instruction comes from an external document the agent read during its loop.
The next parts of this library go deeper on each of these building blocks: the overall architecture of agent security and the organization of human oversight when the action held back requires a person's decision.
Where to place the control points
- They document the loop architecture of every agent. Declared tool catalog, the component in charge of execution, iteration caps and persistent memory mechanisms are inventoried before go-live.
- They run every agent against Willison's three conditions. As soon as an agent combines internal data access, external content reading and an output channel, they remove one of the three links or interpose a blocking control on every outgoing call.
- They house the rules engine in the orchestrator rather than the prompt. A central cut-off point, placed between the emission of the call block and its actual execution, guarantees that the model can neither get around nor modify the policy.
- They compartmentalize writes to persistent memory. Every update to an agent's long-term memory is traced and protected against persisting content from unverified external sources.
- They attach to every tool call the context read upstream. The log records in a single entry the requested operation and the documents present in the context window at the moment of the decision.
- They calibrate their policies in listening mode on real traffic. Observing the actual execution loops for several weeks identifies precisely the calls with side effects before blocking is turned on.
SentinelOS judges every action of your agents before it leaves, holds the ones that matter for a person, and signs every decision. Installed on your premises.
Discover SentinelOSSources
- Anthropic, "Tool use with Claude", Claude platform documentation (how client tools work, stop_reason: "tool_use", tool_result, memory tool). platform.claude.com
- Anthropic, "Building effective AI agents". anthropic.com
- Yao, Zhao, Yu, Du, Shafran, Narasimhan, Cao, "ReAct: Synergizing Reasoning and Acting in Language Models", arXiv:2210.03629, submitted October 6, 2022. arxiv.org
- Schick, Dwivedi-Yu, Dessì, Raileanu, Lomeli, Zettlemoyer, Cancedda, Scialom, "Toolformer: Language Models Can Teach Themselves to Use Tools", arXiv:2302.04761, February 9, 2023. arxiv.org
- Model Context Protocol, specification version 2025-06-18, "Tools - Model Context Protocol". modelcontextprotocol.io
- Simon Willison, "The lethal trifecta for AI agents: private data, untrusted content, and external communication", June 16, 2025. simonwillison.net
- CERT-FR, "Vulnérabilités et risques des produits d'automatisation par IA agentique sur les postes de travail", CERTFR-2026-ACT-016, April 13, 2026. cert.cyber.gouv.fr
