Safety and guardrails
An agent's risk is the set of actions it can take. Everything else — the prompts, the reasoning, the tone — is commentary until something executes.
11.1The action surface is the risk surface
A model that only produces text has a bounded failure mode. If it fabricates a citation or writes something insulting, a person reads the output and decides what to do with it. That person is the executor, and every consequence passes through someone with the opportunity, however often skipped, to notice a problem. Safety work on text systems therefore concentrated on the content of the text. Agent engineering inherited that framing largely unexamined, and it is the wrong one, because an agent removes the human executor by design. When a model emits a call to send a message and a runtime dispatches it, the output has become an action, and the properties that matter stop being properties of text.
The risk of a deployment is therefore determined by the set of actions available to the agent, and only weakly by the quality of the model driving it. Two teams can deploy the same model with the same prompt and the same evaluation suite, and one deployment can be essentially harmless while the other can destroy a production database, because one holds a read-only credential and the other an administrative one. No improvement in the model's judgement closes that gap, since the gap is not in the model. Before asking whether a model is good enough for a job, enumerate what the job requires the agent to be able to do, and treat that enumeration as the security specification.
Sorting actions by reversibility is more useful than sorting by apparent severity, because reversibility determines whether a mistake is a nuisance or an incident. Reading a file changes nothing and is dangerous only in combination with a channel that moves information outward. Writing to a scratch directory is undone by deletion. Writing to a version-controlled tree is undone by revert, which is cheap but requires that someone notice. Sending a message is not reversible at all — the recall feature in most clients is a request rather than a guarantee, and the recipient's copy already exists on a server the agent does not control.
Reversibility is a property of the action together with its surrounding infrastructure rather than of the action alone. Deleting a row from a table with point-in-time recovery and a thirty-day window is reversible; deleting the same row from a table without backups is not. Pushing a commit to a branch is reversible; pushing to a branch a deployment pipeline watches is not, because the push reaches users before anyone reviews the diff. Classifying an action surface therefore requires understanding the systems the actions touch, which is ordinary systems engineering that cannot be delegated to the model. It also means an organisation can move an action from the irreversible column to the reversible one by investing in infrastructure, and that investment often buys more safety per unit of effort than any change to prompting.
The second structural idea is the trust boundary between model output and executor. In a conventional program the code that decides to act and the code that acts are written by the same engineers under the same review. In an agent the deciding component is statistical, its inputs include text from sources the engineers do not control, and its outputs cannot be constrained by proof. The executor is ordinary deterministic software. The boundary between them is the only place where deterministic control is possible, and therefore the place where security properties belong. A permission check written into a system prompt is a request the model will usually honour; the same check in the dispatch layer is a property of the system. These differ in kind rather than degree.
Treating dispatch as the enforcement point changes how tools are written. A tool is not a convenience wrapper around an interface; it is where everything the agent may not do gets enforced. If the agent should not message addresses outside the organisation, the recipient check belongs inside the send implementation, where it runs regardless of what the model was persuaded to attempt. If it should not read outside a project directory, path canonicalisation belongs inside the read implementation, before the filesystem is touched. Engineers used to writing thin adapters find this uncomfortable, because it puts policy in what feels like the wrong layer. The alternative puts policy where an adversary can talk past it.
| CLASS | EXAMPLES | RECOVERY | DEFAULT POSTURE |
|---|---|---|---|
| Read-only, local | Read a file, query a replica | None needed; no state change | Allow within scope |
| Read-only, external | Fetch a page, call an interface | None, but introduces untrusted input | Allow with provenance tagging |
| Reversible write | Scratch file, branch, draft | Delete or revert, cheap | Allow in a scoped workspace |
| Costly-reversible write | Commit to main, update a record | Revert plus notification; needs detection | Allow with audit log |
| Externally visible | Send a message, open a request | Retraction is social, not technical | Confirmation gate |
| Irreversible | Transfer funds, drop a table, publish | None | Human approval, always |
11.2Prompt injection and the shared channel
Prompt injection is the class of attacks in which text the system treats as data gets interpreted as instruction. In the direct form the person interacting with the agent supplies the text themselves, typically to exceed the constraints the operator intended. Its threat model is bounded, because attacker and principal are the same person and the damage is limited to what that person could already attempt. Indirect injection is the serious class: the adversarial text arrives through content the agent processes in the course of its work — a retrieved page, a document in shared storage, a code comment in a dependency, a message in the inbox it was asked to triage, or its own memory from an earlier session. The attacker never addresses the agent and may have planted the text long before it existed.
The durability of this class is structural. A model receives one token sequence. The system prompt, the user request, retrieved content, and tool output all arrive in that sequence, distinguished only by formatting conventions that are themselves tokens. There is no mechanism comparable to the separation between code and data in hardware, and no analogue of prepared statements, where the parser is structurally incapable of promoting a parameter into syntax. The model computes attention over everything shown and produces a continuation; whether a span was meant as instruction is a semantic judgement it makes rather than a property the architecture enforces. Every defence works by making that judgement more reliable, and a more reliable judgement is still a judgement.
The comparison frequently drawn to scams and social engineering is a technical claim rather than a rhetorical one. Social engineering against people has not been solved after decades, because the faculty the attack exploits is the same one that makes the target useful — a receptionist who cannot be persuaded by a plausible stranger also cannot help a legitimate visitor. The same tension holds here. A model trained to ignore every instruction found in retrieved content becomes useless for following a runbook, executing a configuration file, or acting on a ticket description. The published responses are correspondingly non-final: adversarial training, automated red-teaming pipelines, monitoring, rapid patching, and user controls. Each reduces success rates against known techniques; none establishes a guarantee.
The concrete vectors determine where instrumentation belongs. Retrieved documents are the canonical case, sometimes carrying text in styling invisible to a human reading the same page. Tool output is a second vector that engineers forget is untrusted, since a tool feels like part of the system even when it returns an attacker-controlled payload. Code comments matter for coding agents, where dependency source is read into context as routine. Memory poisoning is the highest-leverage vector for agents with persistence, because one successful injection writes text reloaded into every later session, converting a one-time compromise into a standing one. Cross-agent injection arises where one agent's output becomes another's input, and the receiving agent typically applies less scrutiny to a peer than to a web page — inverting the appropriate level of trust when the peer may itself be compromised.
Since the class cannot be eliminated, the useful defences limit what a success can accomplish. Least privilege is the most effective: an agent holding no payment credential cannot be induced to make a payment, however persuasive the text. Capability scoping narrows this further with task-specific, short-lived credentials. Separating a privileged component that never sees untrusted content from an unprivileged one that processes it, with a structured interface between them, means injected instructions reach only the part that cannot act. Human confirmation on irreversible actions works because it inserts a principal who was not in the token stream. Provenance tracking, which tags each span with its source and denies tool authority to spans from untrusted fetches, is the closest available analogue to the separation the architecture lacks.
These should be described as containment rather than solutions, and the distinction has operational content. A solution would let an engineer stop reasoning about the attack. Containment means the blast radius is bounded, and the bound holds only while its assumptions hold — that the credential really is scoped, that the confirmation gate cannot be satisfied by the model itself, that the privileged component really never receives untrusted text through a path a colleague added later without knowing the invariant existed. Containment decays silently when a system is modified, which is why the audit practice below asks what stopped an attack and whether that thing was designed to stop it.
| VECTOR | ENTRY POINT | PERSISTENCE | PRIMARY CONTAINMENT |
|---|---|---|---|
| Retrieved content | A search or fetch tool | One turn | Provenance tagging; no tool authority from fetched spans |
| Tool output | A third-party response | One turn | Schema validation; untrusted by default |
| Code comments | Repository or dependency read | Until the code changes | Least privilege on the agent's credentials |
| Shared documents | A storage tool | Until the document is edited | Scoped read paths; provenance in context |
| Memory store | A prior session write | Indefinite | Write review; no instruction-shaped entries |
| Peer agent message | An inter-agent channel | Propagates | Structured schemas rather than free text |
11.3Privacy and the say-do gap
Privacy evaluation for models grew up around question answering: show a scenario, ask whether disclosure would be appropriate, score the answer against human judgement. This fits agents poorly, and not because the questions are badly written. An agent does not answer a question about whether to disclose a colleague's medical leave; it drafts a message while holding a calendar, an inbox, and a directory in context, and the disclosure happens as a side effect of composing something helpful. The two measurements come apart.
PrivacyLens measures this directly. Its construction proceeds in three stages from a base of privacy norms. The authors assembled 493 privacy-sensitive seeds, each a structured tuple naming a data type, a subject, a sender, a recipient, and a transmission principle, drawn from privacy regulation, the literature on vulnerable groups, and crowdsourcing. Each seed expands into a vignette placing the norm in a concrete situation, and each vignette expands again into an agent trajectory: a sandboxed environment with tools, an instruction such as drafting a message, and a context holding the sensitive detail, which was never the subject of the request.
That structure lets the same norm be probed two ways. In the question setting the model is asked whether a disclosure would be acceptable and scored for accuracy. In the action setting the model is placed in the trajectory, acts through the tools, and its final artefact is examined for whether the sensitive information appears. The reported leakage rates are 25.68 per cent for one frontier model and 38.69 per cent for another, and these hold even when the prompt contains explicit privacy instructions. The comparison that names the phenomenon is sharper: models answer almost all trajectory-level probing questions correctly, identifying the disclosure as inappropriate, and then leak on roughly a quarter to well over a third of the corresponding actions. The model is asked about the situation it is then placed in, gives the right answer, and behaves otherwise.
The mechanism is not a failure of knowledge. In the probing setting the disclosure is the topic, so attention rests on the norm. In the action setting the model is pursuing a task, the disclosure is incidental to a paragraph that is otherwise responsive, and nothing marks the moment as a decision point. Helpfulness and norm compliance compete, and helpfulness is what the model is actively optimising. A model's ability to articulate a privacy policy therefore says little about whether a system built on it will respect one, and safety cases assembled from question-answering benchmarks measure the wrong variable. Mitigation has to intervene at the moment of action, which is the design behind work placing an instructor model inside the execution loop to emit step-specific guidance rather than relying on a static instruction at the top of the prompt.
A fixed scenario set leaves open what risks nobody thought to write down. Simulation-based work addresses this by searching rather than enumerating: agents interact in privacy-critical situations while models act as optimisers over the resulting trajectories, alternately improving an attacker's instructions and a defender's. The discovered strategies escalate on both sides. Attacks begin as direct requests and develop into impersonation and consent forgery, where the attacker manufactures the appearance of authorisation from the data subject. Defences begin as simple rules and develop into identity-verification state machines tracking what has been established about a counterparty before releasing anything. Both generalise across scenarios and models, which makes the discovered defences reusable and the discovered attacks a test suite nobody on the team wrote.
A third result changes what counts as sensitive rather than how it escapes. Agentic models with search can re-identify participants in an interview corpus released with identifying details removed, linking several to specific published works and in some cases uniquely identifying the subject. The quasi-identifiers were not names or dates but the shape of the research described — domain terminology, niche problem settings, distinctive contributions — none of which is a personal identifier and all of which survive conventional anonymisation. The agentic setting is the enabling factor because re-identification requires searching, synthesising, and matching across many sources, work previously expensive enough to serve as a practical barrier. Decomposing the task into individually benign subtasks also circumvents safeguards that would refuse the request stated plainly.
The operational conclusion is that privacy evaluation must test actions rather than answers, and must treat aggregation as a capability the agent has. Testing actions means running the agent end to end with sensitive material planted in context, inspecting every outbound artefact for whether it appears, and scoring the artefact rather than the model's commentary about it. Treating aggregation as a capability means a classification scheme labelling fields sensitive or not is insufficient, because a set of individually harmless fields can identify a person once the agent can cross-reference them. Granting a search tool changes what the agent's existing context means, which is an escalation of privilege that appears in no access control list.
| FINDING | IMPLICATION FOR ENGINEERING |
|---|---|
| Stated judgement does not predict action | Score outbound artefacts, not model self-reports |
| Leakage persists under privacy-enhancing prompts | A prompt instruction is not a control |
| Risks found by search rather than enumeration | Adopt discovered attacks as a regression suite |
| Aggregation re-identifies anonymised subjects | Field-level classification fails once search is available |
| In-loop guidance beats static instruction | Intervene at the decision point, not at the top of the prompt |
11.4Sandboxing, permissions, and output guardrails
A sandbox is the set of physical limits on what a process can touch, and specifying one means enumerating dimensions that are individually easy to overlook. The filesystem dimension covers readable and writable paths, and requires canonicalising them before checking, since links and relative traversal defeat naive prefix matching. The network dimension should default to denial with an explicit allowlist, because unrestricted outbound access is an exfiltration channel regardless of every other control. Secrets are their own dimension: environment variables, mounted credential files, and cloud metadata endpoints all leak into a process not deliberately isolated from them. Processor and memory limits bound exhaustion. Wall-clock limits bound runaway loops, which are common because a model that cannot complete a task often retries indefinitely. Child process creation, if permitted, escapes any limit enforced only on the parent. Output size limits matter because reading a very large file both exhausts budget and floods context with attacker-controlled text.
Permission models sit above the sandbox and govern which capabilities are available for a given piece of work. The dominant early pattern is standing credentials: an account is provisioned once, its token placed in the environment, and every task carries the full authority of that account. This is simple and has the property that the blast radius of any compromise equals the account's total authority across all tasks for the lifetime of the token. Per-task scoping issues a distinct short-lived credential for each unit of work, carrying only the authority that unit requires, so an agent handling one ticket receives a token valid for that ticket's records and expiring with the task. The cost is an issuing service and a way to express what a task needs; the benefit is that a successful injection during one task cannot reach another's data.
Capability tokens generalise this by moving authority into unforgeable references rather than identity lookups. Instead of the agent presenting an identity and the resource checking permission, the agent presents a token encoding the permitted operation and target, minted when the orchestrator decided the task warranted it. The advantage is that the model never holds ambient authority it might be persuaded to redirect: it holds a token for appending to one document, and no persuasion converts that into a token for deleting another. Confirmation gates are the third mechanism and deserve care in design. A gate firing on every action trains users to approve reflexively, destroying the value while keeping the cost. A gate should fire on the irreversible class, present the concrete parameters of the pending call rather than a summary the model wrote, and be satisfiable only by a principal outside the model's control.
Output guardrails inspect what the agent produces before it reaches a person or an external system. They catch a real set of problems: recognisable secrets, well-formed identifiers, known-toxic content, and outputs violating a format contract. Their limits follow from what they can see. A guardrail inspecting text cannot determine whether a claim is true, cannot tell whether disclosing a colleague's appointment violates a norm without knowing the relationship and the circumstances of collection, and cannot recognise sensitive information that has been paraphrased, translated, or split across several outputs. The leakage results bear directly on this, since the leaked material in those trajectories is ordinary prose about ordinary people, containing no pattern a regular expression could match.
Arranging these as three layers clarifies which is doing the work. The input layer filters or annotates what enters context, catching some injection attempts and failing against novel phrasings. The action layer sits at dispatch and decides whether a call executes, using the sandbox, the permission model, and the gates. The output layer inspects what is emitted. Only the action layer prevents harm, because only it sits between the model's decision and a change in the world. The input layer reduces the frequency of bad decisions without bounding them. The output layer runs after any tool call in the same turn has already executed, so for an agent that has already sent a message, it is inspecting a description of something that happened. This is not a criticism of the other layers, which are cheap and catch real problems; it is a statement about where the guarantee lives and which layer deserves the hardest review.
When a check could plausibly sit in more than one layer, place it at the last point where the information needed to decide is available and the harm has not yet occurred. Recipient validation belongs at dispatch, because the recipient is known then and the harm occurs at send. Detecting a leaked credential belongs at the output layer only if it would otherwise reach a person; if the agent is about to write it into a public repository, the check belongs inside the write tool, where it can block rather than report. Checks performable only after the fact, such as reconciling a day's actions against expected patterns, belong in monitoring, and their role is detection rather than prevention.
| LAYER | SEES | CATCHES | CANNOT CATCH |
|---|---|---|---|
| Input | Incoming context and requests | Known injection strings, prohibited requests | Novel phrasing; content adversarial only in combination |
| Action | The proposed call and its parameters | Out-of-scope, irreversible, unauthorised calls | Harm from calls individually in scope |
| Output | Emitted text and artefacts | Formatted secrets, identifiers, format violations | Semantic norm violations; anything already dispatched |
11.5Red-teaming, liability, and responsible deployment
Red-teaming an agent differs from red-teaming a model because the objective differs. Model red-teaming seeks outputs the developer did not want. Agent red-teaming seeks state changes the operator did not authorise, so the exercise is organised around the action surface rather than around topics. A workable procedure starts from the action inventory ranked by irreversibility and works downward from the worst. For each action it asks how an adversary who cannot address the agent directly could cause it to occur, which forces the attempt through indirect injection — text planted in a document the agent will retrieve, a ticket it will process, or a memory entry it will reload. Direct attempts should also run, but they establish a weaker result, since someone who can type into the agent's input is often a legitimate user whose authority it already reflects.
The most valuable output is not the list of attacks that succeeded but the record of what stopped the ones that failed, together with a judgement about whether that thing was designed to stop them. An attack that failed because the model declined is a different result from one that failed because the credential lacked scope. The second is a property of the system that holds across model versions, prompt revisions, and unseen phrasings. The first is a property of one checkpoint's behaviour on one phrasing, and it can disappear on the next upgrade with no code changing and no test failing. Recording the distinction turns the report into a specification of which controls are real, and it frequently reveals that a deployment believed to be defended in depth rests on model judgement at several points the team assumed were mechanisms.
Liability is where the engineering picture meets the legal one, and the organising distinction is between a system that suggests and one that acts. A tool producing a recommendation that a qualified person reviews and adopts places that person as the decision-maker, and existing frameworks for professional responsibility and product liability apply in roughly familiar form. An agent that executes removes the intervening judgement, and the question of who bears responsibility becomes genuinely contested. Candidates include the operator who deployed the agent and set its authority, the provider whose model produced the decision, the integrator who wrote the tools, and whoever supplied the content that induced the behaviour. Most jurisdictions have not settled this, so the practical exposure is not merely the harm but the cost of litigating an unsettled question, and it scales with the authority granted.
Audit logs determine how that question is answered in practice and should be designed as evidence rather than as debugging aids. A debugging log is written for the engineers who built the system, is often sampled, may be truncated, and is retained for weeks. An evidentiary log must establish what the agent did, when, under whose authority, on what input, and with what approval, in a form that remains credible when produced by an adverse party years later. That implies complete rather than sampled capture of every invocation with its parameters, the identity and scope of the credential used, the identity of any approver together with what that approver was shown at the moment of approval, the model version, and the provenance of context content. It implies append-only storage with integrity protection and retention matched to limitation periods rather than to storage cost. The record of what an approver saw is easy to omit and impossible to reconstruct afterwards, and it is what distinguishes informed authorisation from a rubber stamp.
Disclosure obligations arise along several independent axes and are better tracked as a checklist than handled case by case. Recipients of agent-generated communication increasingly have a regulatory expectation of knowing they are not corresponding with a person. Data subjects whose information the agent processes have rights that may include notice of automated processing, and the re-identification result complicates the common assumption that anonymised data falls outside those regimes. Regulated sectors impose their own duties on automated advice, recordkeeping, patient information, and decisions affecting candidates and employees. Internal disclosure matters as well, since staff supervising agents need to know what the agent can do without asking, which is often the only way an operator discovers that a team quietly expanded a tool set.
Responsible deployment ties these together into a process. Staged rollout expands authority as evidence accumulates rather than granting it at launch: an observation phase where the agent proposes and a person executes, with disagreement measured; a supervised phase where it executes reversible actions and irreversible ones only with approval; and an expanded phase relaxing approval for specific classes where the observed error rate justifies it, with the irreversible class typically gated indefinitely. Capability thresholds make the expansion criteria explicit in advance, so the decision is made against a standard set before anyone was invested in the outcome. Incident response requires the ability to revoke credentials immediately, enumerate every action within a window, and notify affected parties — each exercised in a drill beforehand, since the enumeration requirement tends to fail on first contact when logs turn out to have been sampled.
Published scaling policies provide the reference structure for the threshold pattern, defining capability levels by analogy to biosafety levels, each bound to a set of required safeguards, with external evaluation before deployment at the higher levels. The load-carrying commitment is what happens when an evaluation fails: development pauses until the safeguards exist, and amending the policy requires approval from outside the delivery organisation so the commitment cannot be quietly relaxed under schedule pressure. An organisation deploying an agent over a customer database will not adopt those thresholds, but it can adopt the mechanism — write down which capabilities require which safeguards, write down what will not ship if they are absent, and place the authority to relax that commitment somewhere other than with the team whose schedule it constrains. That last provision is what makes a policy a constraint rather than a statement of intent, and it is the part most often omitted when the pattern is copied.
| STAGE | AGENT AUTHORITY | HUMAN ROLE | EXIT CRITERION |
|---|---|---|---|
| Observation | Proposes only; executes nothing | Executes every action | Disagreement below threshold over N tasks |
| Supervised | Executes reversible actions | Approves irreversible ones | Override rate below threshold |
| Expanded | Executes named reversible classes | Approves irreversible; audits samples | Reviewed on schedule, not automatically |
| Restricted | Reduced after an incident | Full review of the window | Root cause closed and a control added |
Red-team the action surface
Enumerate every action your agent can take and rank them by irreversibility. For the top three, attempt to trigger each using only indirect injection through content the agent retrieves. Report what stopped you — and be honest if it was luck rather than design.