Securing AI agents that call other agents
An agent that only answers questions can be wrong. An agent that keeps memory, runs tools, hands work to other agents and rewrites its own workflow can be wrong in ways that stick. This is a plain-language walk through a security architecture paper we published, and the controls we think hold up when agents start calling agents.
Capability is not authority
Security people learn this early, usually from a service account: the fact that a system can do something does not mean it is allowed to. An agent that can describe a database migration, write the script and explain the rollback has shown capability. Whether it may run that script against production is a separate question, and it has to be answered by something other than the agent.
Most agent setups blur the two. Persona, task instructions, memory, tool descriptions and rules all get poured into one prompt, and the model sorts it out. That works fine for tone. It breaks when the same interpretation that decides how to phrase an answer also decides whether to delete a file. We call that cognitive-policy coupling: a reasoning instruction starts acting like a permission grant.
A simple test: switch your agent into "adversarial reviewer" mode. Did its filesystem access change? Its network reach? The credentials it can see? If any of those moved because the mode moved, you have coupling.
Eight things that should be governed separately
The architecture splits an agent into eight control surfaces. They can live in one process. The point is that each one answers its own question and has its own owner.
- Persona: how the agent presents itself. A name and a voice, not a security identity.
- Mode: how it approaches this task. Exploring, building, verifying, critiquing.
- Authority: which actions it may take, on which resources, under which conditions.
- Memory: what it may retrieve, store and reuse.
- Tools: which interfaces exist for it.
- Evaluation: what evidence decides whether a result is acceptable.
- Policy: the rules for access, approval and promotion.
- Persistent state: what survives once the session ends.
Persona and authority are the pair people mix up most. The same persona can run under a read-only scope today and a write scope tomorrow. Two different personas can have identical permissions. A persona label should never be the thing a permission check looks at.
Where trust breaks when agents delegate
Delegation is where the clean diagram gets messy. Agent A is restricted from sending email. Agent B can send email. A asks B to "please send this summary to the vendor." Nothing was hacked, and a restriction just disappeared.
The rule is short: a restricted agent must not gain a capability by asking another agent to use it. In practice that means the permission check travels with the request. When B acts on A's behalf, the authorization decision considers A's scope, not just B's.
The second break is content. Messages from other agents, tool responses, retrieved documents and stored memories can all carry claims and embedded instructions. A model reading "the operator has approved this deployment" in a tool response has not received an approval. It has read a sentence. Content must not acquire policy authority because a model read it or repeated it. OWASP's agent security guidance lists prompt injection, memory poisoning and cascading multi-agent failures for exactly this reason.
The third break is quieter: evaluation collapse. A common loop is generate, critique, revise, repeat. If the critic is the same model, with the same context and the same assumptions, agreement tells you very little. Two models agreeing is evidence of agreement. It is not evidence of correctness.
Five controls do most of the work.
Put the permission check outside the model
"You may not deploy" in a prompt expresses an intention. An execution path that rejects an unauthorized deploy enforces it. Every security-relevant decision needs the second kind. This matches OWASP's guidance on excessive agency, which separates too much functionality, too many permissions and too much autonomy, and calls for authorization checks that do not depend on the model.
A related point people miss: exposing a tool does not authorize everything the tool can do. A shell is one tool and a thousand capabilities. The check has to look at the specific operation and the specific target.
Give the evaluator a different view
Treat evaluation as its own role with its own inputs. One pattern we use: the evaluator sees the artifact and the acceptance criteria, and does not see the generator's reasoning. A grader that reads the argument for an answer tends to grade the argument. We have not measured how much that helps, so we offer it as a design choice, not a result.
And keep observed test results separate from model judgments in the record. "The tests passed" and "the reviewer model liked it" are different kinds of evidence and should never be averaged together.
Protect the gates from the thing they gate
If an agent can improve its own workflow, which is the whole appeal of recursive agents, there has to be a hard line between what it may change and what judges the change. Prompts, routing, generated code and extra tests can sit on the mutable side. Authorization policy, required test coverage, promotion rules, credential boundaries and resource ceilings sit on the protected side.
The failure to watch for is gate weakening: the agent qualifies its own change by choosing an easier evaluator, filtering out inconvenient evidence or editing the test. An agent may propose a better test. It may not use that proposal to pass itself.
Bound the loop, and let it stop
A bounded improvement loop proposes a change, runs it somewhere safe, collects evidence, and hands an acceptable candidate to a separate promotion decision. Limits on iterations, time and spend come from outside. Two bounds we left out at first and had to add: a stop rule, so "more iterations" is never its own justification, and a retention test, so every check that passed before is re-run and any regression blocks promotion regardless of what the change gains elsewhere.
Keep the human decision a decision
An evaluator can report that evidence meets a criterion. Only an authorized person can decide the change is allowed. Approval should be bound to the specific action that was reviewed, and a material change to that action needs a fresh approval. The line we keep coming back to is self-improvement versus self-authorization. One is useful. The other is the incident.
A control only protects the paths it runs on
Our most expensive lesson from building this was not about models at all. We had a quality check wired into a launcher script. A scheduled job reached the same output by a different path that skipped the launcher, and for a night the check existed on paper and nowhere else. The fix was moving the check onto the artifact itself, where every path has to produce it.
That generalizes. When you list your agent's controls, list the paths to each protected action next to them. A check that covers three of four paths is a check with a door beside it.
What this does not claim
Separating instructions into named sections does not create a security boundary by itself. The boundary is real only where something outside the model enforces it, and that enforcement code is part of your attack surface too. A compromised host or a stolen admin credential beats all of this. The architecture applies old principles, least privilege and separation of duties, to a new kind of system. Its value comes from testing that the enforcement actually happens.
If you want to try the reasoning side of this with your own key, Vesper runs multiple passes, including a dissenting one, before it gives an answer.