Separation of duties between agents — study guide
The concept's fragments, read in order.
No run approves its own work
Splitting work across agents has reasons of its own, and one of them is independent review: a reviewer that did not write the draft catches what the author keeps reading past. This concept is about a different reason, and it is not about quality. It is about security. When the same party can both make a change and decide whether the change is acceptable, its own judgment is the only check, and a party that is wrong, misled or hijacked can pass its own work. The old answer is separation of duties: the one who does a thing is not the one who approves it.
Applied to agents, that means the run that builds is not the run that writes the tests that judge the build, and neither of them is the run that reviews. But a separation only counts if the controller enforces it: the program that starts the agents, holds the credentials and runs the checks. A role described in a prompt is a request. A role the controller assigns, with permissions it enforces and a change it inspects after the run, is a fact. Independence works the same way: it comes from separate runs, separate permissions and evidence the controller observed, not from an instruction to be impartial.
None of this overturns the advice that one agent is the honest default. Separation of duties does not require more agents. It requires that whatever produces the work cannot also change or pass the check that judges it, and that check can be ordinary code the controller runs, or a person. Where you do run several agents, each boundary between them is a place where this has to hold.
The running example is a coding agent with a builder, a test writer and a reviewer, because that is where the incidents in this concept come from. The principle applies to any multi-agent system: a research pipeline whose summarizer should not edit its sources, a triage agent that should not close the tickets it opened. What follows is the established practice and what carries over from it, a failure that shows the cost, roles as permissions, the check that enforces them, where independence really comes from, what a different model adds, why one agent's output is untrusted input to the next, and the confused deputy.
An old control, borrowed with care
Separation of duties is far older than software. NIST's glossary defines it as the principle that no user should be given enough privileges to misuse the system on their own, and gives the classic example: the person authorizing a paycheck should not also be the one who can prepare it. NIST's main catalog of security controls asks organizations to identify which duties must be separated and to set access permissions that support the split, to reduce the risk that one person can abuse a privilege without collusion. Saltzer and Schroeder named the design principle in 1975 as separation of privilege: access that depends on two independent conditions, two keys, so that one party's mistake or breach of trust is not enough on its own. It works like a company payment that one person raises and a different person must approve, so no one person can both create a payment and authorize it.
The two-person rule is the version enforced at the moment of action: the first person can be any authorized user, and the second can be any authorized user different from the first. Its strength rests on assumptions worth stating. The two judge separately and do not just echo each other. Getting both to cheat takes collusion, which is hard. The rule is enforced by the system, not merely written down. And the second person sees enough to recognize a problem. A second approver who signs everything adds little.
Some of this carries over to agents and some does not. The structural half carries over well: separate actors, permissions enforced by the system rather than by good intentions, and records of who did what. The independence half does not carry over unchanged. Two people bring different knowledge and must conspire to cheat. Two runs of the same model start from the same training and the same tendencies, and an instruction planted in text that both of them read needs no conspiracy to reach both. Even "different from the first" needs care: if every agent acts through one shared account, the system cannot tell one role from another, so identity has to come from the controller's records.
So with agents, separation of duties is mainly a way to limit what any one run can do alone, which code can enforce. It says much less about whether two runs will disagree when they should. That half has to be built separately, from evidence neither run produced.
The tester that could edit the code
Field recordIn one real system, an earlier agent framework had a testing role, and that role was allowed to edit code. In practice one agent ended up playing both parts, building the app and testing it. A later review of that framework also found work that no role owned at all: cutting releases, keeping the project's status, and reviewing the agents' work for security.
A duty with no owner has no boundary around it either.
Field recordThe cost showed once the project's separate testing machine was taken away partway through the build. Within about eleven days of its first commit, the project had cut 19 release tags, 11 of them on a single day, with 47 fix commits and 41 manual edits to a status file. The defects included a help button that did nothing, a refresh nobody could see, a front-end library that shipped as a 472-byte placeholder, and a version string that reported the wrong version. The record's verdict: "Every one passed CI and a health check and still shipped broken," because "the same agent that built it also tested it and shared its blind spots." Earlier, while the separate tester was still there, it had found a login response that leaked data, a metrics endpoint exposed to anyone, and an ingest endpoint that returned success and saved nothing.
The tests were not missing; they passed. That is the point. A tester that can edit the code under test can make the code and the tests agree, and even without editing anything it tests with the builder's own assumptions about what the code is for. Nothing malicious is needed. A shared blind spot is enough, and a check run by the party it checks works like a player who also referees the match: whatever their intentions, their calls are no check on their own play.
This is one project's record, not a measured rate, and the eleven-day span is approximate, read from the dates of the release tags. But the shape is general. If a role can both change the thing and judge it, you have one role with two names, and the fix is not a better prompt for the tester. It is a tester that cannot edit the code, run as a separate run, judged by what a check the controller ran actually observed.
A role is a list of permissions
Define each role by three lists: what it may read, what it may write, and what it may never do. A job title in a prompt, such as "you are the tester", tells the model what to attempt. The lists tell the controller what to allow, and only the second kind holds when the model is wrong or misled.
In one real system that runs coding agents under a controller, the roles look like this. The builder writes application code. It may not edit, skip or disable the acceptance checks, change the protected path those checks live on, change the rules a gate applies, approve its own work, publish or deploy. The test author writes the acceptance checks. It may not change application source, and it may not approve its own corrections to the checks. The reviewer reads the change and the evidence and returns a verdict as a result; it modifies nothing. A monitor that watches the live app may read telemetry and file or update reports, and nothing else. Every effect beyond the workspace, the commit, the merge, the deploy, is performed by the controller, never by a role. In that system's own build, each role writes only its own directories, the reviewer writes nothing, and everything else belongs to the owner.
Read the lists across and the design is visible: no role can both change the code and change, skip or pass the checks that judge it. Approval sits with none of the agents. Keeping the checks themselves out of the builder's reach, and deciding who may approve what, are subjects of their own; here the point is that each role's reach is a list someone wrote down and the controller enforces.
One run holds one role. If a single run could be the builder for one step and the test author for the next, its lists would merge and the separation would be gone. So the builder and the test author are separate runs, started separately, even when they use the same model. The role's prompt still describes the lists, because an agent that knows what will be checked wastes fewer runs, but the prompt is documentation of the boundary, not the boundary itself.
Check what the run actually changed
A permission list is a claim until something compares it with what happened. So after each run, what the run actually changed is checked, path by path, against the role's write list. In one real system, the check covers the two roles that write, the builder and the test author. It examines only committed changes since the branch split from its base, and it refuses to judge a working tree that still has uncommitted changes, because what is not committed is not what will be kept. It fails either role on any changed path outside its list, or on no change at all: a run whose job was to produce a change and produced none has not done its job. The reviewer's rule that it writes nothing comes from its instructions and the controller's design, not from this check.
A violation rejects the whole run. The controller does not keep the builder's source edits and quietly drop the one test file it also touched; as that system's design puts it, "there is no partial acceptance." There are two reasons. The parts may depend on each other: source code that passes only because a test was weakened is not good code with a bad test attached. And a run that broke its boundary once has shown that nothing it produced can be taken on trust, so picking out the good parts would mean someone deciding which parts were honest, which is the judgment the boundary existed to avoid.
The party that merges, not the run being checked, names which role to check and which branch. If a run could declare "I was the test author", it could choose the list it is judged against. Commits in that system carry a trailer naming the role, which makes history easier to read, but a trailer is text the role itself wrote, so it cannot be what decides which list applies.
Know what this check does not do. It sees which files changed, not whether the changes are any good: a builder that writes a wrong but in-bounds change passes the boundary and has to be caught by the tests and the review. And it sees the repository, not every effect a run might have had elsewhere. One review in the same system put it plainly: checking the repository after a run does not undo every side effect. Containing what a run can touch while it runs is the sandbox's job.
Independence is built, not asked for
A reviewer should not have written the draft, should not have seen the author's transcript, and should check against evidence the author did not produce. The question is how to make that true rather than hope for it. The answer is structure the controller sets up before the reviewer reads a single line.
Four pieces do the work. A separate run: the reviewer is a new session, not a continuation of the builder's, and its context is rebuilt from durable records (the task, the change, the check results) rather than carried over from anyone's transcript. When a role has to look again at something it produced itself, that look also happens in a fresh session. Separate permissions: the reviewer cannot change the code or the tests, and the builder cannot change the review. Evidence the controller observed: the reviewer is given the results of checks the controller ran itself, not the builder's account of how the tests went. And order: the test author writes the acceptance checks before the builder starts, so the checks cannot be shaped to fit the code.
None of these depends on which model each role uses. Two runs of the same model, set up this way, still cannot edit each other's work, still do not share a transcript, and are still judged on evidence neither of them produced. That is the independence you can enforce and verify, and it holds whether or not the two runs happen to think alike.
Compare a prompt.
Field recordIn one real system, an earlier framework's security-audit role was told to treat the code as if an external vendor had delivered it, to counter the bias of reviewing your own side's work. A later review gave the fair verdict: this shows the bias was considered, and "it does not establish that the bias was eliminated."
Research gives no stronger support. Studies of models judging their own output have reported a preference for their own answers, though that evidence is still tentative, and the work available does not establish that asking a model to adopt an outside reviewer's persona removes such a bias. The framing changes the words in the prompt and nothing else: the same context, the same permissions, the same evidence. It may still produce a sharper review, so keep it if it helps. Just do not count it as independence.
A different model is an extra seat
If the worry is that two runs of one model share blind spots, the obvious fix is to give the reviewer a different model. It helps less than it sounds. A 2025 study of more than 350 language models measured how often two models, when both got a question wrong, picked the same wrong answer. It used two public leaderboards. On the questions of one, each with three wrong options, two models erring at random would match one time in three; measured pairs matched about 60 percent of the time. On the other, the mean was about 42 percent (0.423) where chance was about 13 percent. Models from the same provider or with the same architecture agreed more, and larger, more accurate models tended to make the same errors as each other even across different providers and architectures. Those are multiple-choice questions, not code review, but the direction is clear: a different model is not the same thing as an independent judge.
It is not worthless either.
Field recordIn one real system, an experiment used two model families for judgment work and found their findings complementary rather than redundant: each caught things the other did not.
That is one experiment in one system, but it matches the sensible reading of the research. Errors overlap a good deal, not completely, so a second model can add findings at the cost of another run.
So treat a different model as an extra seat at the table, configurable and optional, never as the mechanism. The mechanism is the structure: a separate run, separate permissions and evidence the controller observed. Picture the alternative where only the model changes. A reviewer on a different model, running in the builder's session with the builder's permissions and reading the builder's own report of its test results, has none of the independence that matters, however different its training. Put the same different model into a properly separated run and it adds what diversity it has on top of a boundary that already holds.
The same caution applies to a model used as a grader anywhere: its verdicts mean little until they have been checked against people, and agreement between two models is weaker evidence than it looks, because they may agree for the same wrong reason.
Earlier output is untrusted input
Separating roles moves the risk to the handoffs. Everything the builder writes, its code, its comments, its commit messages, its structured result, is read by the test author, the reviewer and the controller. If any of it carries a wrong claim or an instruction planted in something the builder read, it arrives at the next role looking like work from a trusted colleague. So anything one agent writes is untrusted data when the next agent or the controller reads it. That is true of any multi-agent pipeline, and security guidance treats it as a risk class of its own: the OWASP Top 10 for Agentic Applications, released in December 2025, lists insecure communication between agents and the abuse of agent identity and privilege among its ten entries.
The mechanism is to parse, not to trust. Every result is checked against a closed shape, and fields the shape does not name are refused, so nothing can be smuggled through in an extra field. Where a result refers to something, the reference must be one of the values the controller itself listed. In one real system, a finding, a reported defect, must name a check from the controller's current list of checks, and if it names anything else the whole result is invalid and nothing from it is stored. The controller rebuilds the fields it keeps rather than passing the agent's version through, and a plan an agent writes is recorded as data, never executed.
Authorship needs the same treatment. An agent that can write commits can also write commit metadata, such as an author line or a trailer, that makes its commit look like the controller's or the owner's. So which commits belong to the controller comes from the controller's own records, "never from a commit's trailers alone, which a role could write." Identity should work like a building that knows who you are from the badge it issued and its own entry records, not from a name tag you wrote yourself.
The same rule covers an agent's description of its own work. Whether a person needs to look at a change is computed from the actual difference, not from the agent's summary of what it changed. As that system's design puts it, an agent's declaration "can add uncertainty ... it can never suppress a detected change." An agent may raise caution; only evidence can lower it.
The confused deputy
Separating roles creates a new way to lose: the less privileged role asks, and the more privileged one does it. Security has had a name for this since 1988, when Norm Hardy described a compiler on a timesharing system. The compiler was allowed to write files in its own home directory so it could record usage statistics. A user could also name a file to receive the compiler's debugging output. The billing file lived in that same home directory, so a user who could not write the billing file named it as the output file, and the compiler, using its own permission, wrote debugging output over it. The billing information was lost. Hardy's diagnosis: the compiler "runs with authority stemming from two sources," its own and its caller's, and had no way to keep them apart. It was not broken into. It was confused about whose authority it was using, like a trusted keyholder who unlocks a room because someone without a key asked nicely, using their own key on someone else's behalf.
Agent pipelines are full of deputies. The builder runs with little authority, but downstream something holds more: the controller that merges, the deploy step, an agent with write access that acts on findings filed by a read-only monitor, a reviewer whose verdict moves code forward. If text from the less privileged side, a finding, an issue, a field in a result, is enough to make the more privileged side act, then the separation can be bypassed simply by asking, and so it can by anyone able to plant text that the low-privilege role reads. Security guidance for AI-assisted coding names the same pattern in CI: an agent that reads attacker-controlled pull request content while holding secrets or write access is a confused-deputy risk.
The defenses are old ones, applied at each place one role's output becomes another's action. Act with the requester's authority: Hardy's fix let the compiler say, in effect, by the authority of my caller, open this file, and that request properly failed. For agents, that means checking each action against what the originating role or person may do, not against what the deputy could do. Carry authority with the request: a capability, a reference that both names the target and grants the right to it, means the deputy needs no broad standing power of its own to misuse. Keep that standing power narrow. And keep the most privileged steps off the request path entirely: in one real system, no agent's result format can even ask for a deployment, and the deploy step is fixed code acting on the controller's own records.
None of this is fully solved for language-model agents. A request in natural language mixes text from many sources, and tracking whose authority each part carries is hard. That is why the safest privileged step is one no agent's words can trigger at all.
Roles you can check
Running a coding agent you do not have to trust means that no single run can both produce the work and decide that the work is good. Concretely, the controller starts the test author first, in its own run, and it writes the acceptance checks. It starts the builder next, in another run, with a write list that covers application code and nothing else. When the builder finishes, the controller checks the committed change against that list and rejects the whole run on any stray path. Then it runs the checks itself and starts a reviewer in a fresh session, rebuilt from the records, that can read the change and the controller's evidence and whose rules allow it to write nothing. Every result is parsed against a fixed shape, authorship comes from the controller's records, and no request from a less privileged role is enough to make a more privileged step happen.
Each piece answers a failure that has happened. A tester that could edit the code let through a stream of defects that all passed CI. An instruction to review the code as an outsider would turned out to prove only that someone had thought about bias. And a role that can choose which role it is, or write the label that says who made a commit, has no boundary at all.
Be honest about what this buys. It limits what any one run can do alone and makes each run's work checkable by something it does not control. It does not make the work right: a builder can write wrong code inside its boundary, two runs of one model can share a blind spot, and a second model only partly helps, because models' errors overlap. The change check sees the repository, not every side effect. And a person with full access can still override any of it, which is why the approvals that matter belong to people, a subject of its own.
None of this is specific to code. Any multi-agent system where one agent's output feeds another's action, a research pipeline, a support desk, a robot planner whose plans another component executes, has the same question at every boundary: can the party that produced this also pass it? If the answer is yes, you have one role with two names.
Sources
The published studies, standards and guidance this page cites. Links open on other sites. Field records come from the author's own records and have no public source.
- Separation of Duty (SOD) (NIST CSRC Glossary) csrc.nist.gov
- SP 800-53 Rev. 5, Security and Privacy Controls for Information Systems and Organizations (NIST, 2020) csrc.nist.gov
- The Protection of Information in Computer Systems (Proceedings of the IEEE, 1975) web.mit.edu
- LLM Evaluators Recognize and Favor Their Own Generations (arXiv, 2024) arxiv.org
- Correlated Errors in Large Language Models (ICML 2025) arxiv.org
- OWASP Top 10 for Agentic Applications for 2026 (OWASP Gen AI Security Project, 2025) genai.owasp.org
- The Confused Deputy (or why capabilities might have been invented) (ACM SIGOPS Operating Systems Review, 1988) doi.org
- Secure Coding with AI Cheat Sheet (OWASP Cheat Sheet Series) cheatsheetseries.owasp.org