MagenticOS

Two Agents, One Machine: When Multiple AI Agents Collide

Ian Daily · · 7 min

Two Agents, One Machine: When Multiple AI Agents Collide

You started a second agent because the first one was slow. The first was halfway through a refactor. The second was asked to fix a failing test in the same checkout. It ran the suite, saw a dozen new failures caused by the half-finished refactor, and did what a diligent agent does: it fixed them, by putting the old function signatures back. The first agent re-read a file, found its own change missing, assumed it had made a mistake, and applied the change again.

Twenty minutes later both reported success. Each was right about its own account of the work. The repository was in a state neither of them intended and you did not ask for.

That is what running multiple AI agents on one machine looks like today. Two deciders share every file, port, credential and budget the machine has, neither can see the other, and nothing underneath them was designed for the case. The machine assumes one decider. You now have several, and they have never been introduced.

A machine built for one decider

Personal computers have always run many programs at once. What they have not had is many independent parties deciding what to do next. The programs contended for memory and processor time, and the operating system refereed that well. Everything above that level, which file to edit, which server to restart, which branch to be on, was settled by the one person at the keyboard.

You can see the assumption in the tools. File locking on Linux is a courtesy, not a rule. The flock manual page says it directly: flock places advisory locks only, and a process with suitable permissions is free to ignore the lock and perform I/O on the file anyway. A lock works when every program involved agrees to check for it. An agent editing a file through a general-purpose write tool has agreed to nothing.

Version control tells the same story from the other side. Git added multiple working trees so that one repository can have more than one branch checked out at a time, and by default it refuses to check out the same branch in two of them. The people who built it understood that one working directory fits one line of work. That is a convention for humans who know they are about to do two things at once. Your agents do not know.

What two agents actually share

The shared checkout is the incident people recognize first. The list is longer.

No part of this needs a confused model or a hostile prompt. Two competent agents, each behaving reasonably within what it can see, are enough.

Authority is the worse half

Resource collisions are annoying and mostly recoverable. The authority problem is harder, because it does not look like a failure when it happens.

Both agents are running as you. We have written about what that does to the record in Your Agent Is Logged In as You: every downstream log names a human who was not there. With two agents the problem compounds. The log now names one human for the actions of two separate deciders, and when something goes wrong you cannot ask which of them did it, because as far as the machine is concerned there is no “which.”

Permissions pool the same way. You allowed the first agent to delete files in a build directory because its task needed that. The grant was made to a tool, or a terminal, or a user account, and the second agent sits behind the same one. It now holds a permission you gave for a purpose it knows nothing about. Least privilege, applied per user, means both agents get the union of everything either was ever allowed.

Then there is the quietest version. One agent writes a notes file, a commit message, a comment in the code. The other reads it as context and acts on it. Nobody approved that handoff. One agent has just given the other instructions through the file system, and neither they nor you can tell it happened.

Why each agent believes it is fine

An agent’s picture of the world is single-writer. It read the file, so it knows what the file says. When the file turns out to say something else, the available explanations are “I made a mistake” or “the environment is flaky,” and both lead to the same response: put it back the way I wanted it. That is the refactor being applied twice. Each agent is repairing the other’s work in good faith.

The research on multi-agent systems is sobering here, and it covers the easy case. The Berkeley-led study Why Do Multi-Agent LLM Systems Fail? catalogued fourteen distinct failure modes across popular multi-agent frameworks and grouped them into three categories, one of which is misalignment between agents. Those were agents designed to cooperate, built by one team, sharing a protocol and a channel. They still lost track of each other.

The two agents on your laptop have none of that. They come from different vendors, were started in different windows for different reasons, and share no channel except the side effects they leave on your disk.

What the arrangement should be

Telling agents to be careful is not the fix. As we argued in Instructions Are Not Controls, a sentence in a prompt is a request. And “run one at a time” is not the fix either; people run two because one is slow, and they will keep doing it. A correct arrangement has a few properties, described here as what should exist rather than as a feature list.

Each agent is a distinct party to the machine. Not a tab, not a child process of your shell. Something with its own name that the system can tell apart from you and from every other agent, so that “who did this” always has an answer.

Claims on shared things are real. If one task is working in a directory, holding a port, or partway through a change, that fact is visible to anything else that wants the same thing, and it is enforced by the system instead of observed by courtesy. Advisory locking is fine among programs written to cooperate. Agents were not.

A conflict is an outcome that gets reported. When the thing an agent read has changed underneath it, the right result is neither a silent overwrite nor a silent repair. The agent is told, the human can see it, and someone decides.

Authority does not pool. A grant made for one task belongs to that task. A second agent on the same machine starts with what it was given and nothing else. This is the argument of The Sandbox Is the Wrong Unit for AI Agents seen from a different angle: the unit of authority is the action and its purpose, not the account everything happens to run under.

Budgets belong to tasks. The low-priority job cannot spend the important job’s quota, because they never shared one.

The record keeps them apart. Every action carries which agent took it, on which task. Receipts for agent actions are much less useful if two agents sign with the same name.

Why a framework cannot do this

Orchestration frameworks handle contention between their own agents, and the good ones do it carefully. The limit is scope. A framework sees the agents it launched. It does not see the coding agent in your editor, the one in your terminal, the scheduled job that wakes at nine, or whatever your colleague’s script starts over SSH.

Contention happens over things all of them touch: the file system, the network, the credentials, the person. The only layer every one of those agents passes through, whoever built them, is the operating system. The same layer has refereed processor time between programs for sixty years. Refereeing intent between deciders is the same job at a higher level, and no one has taken it on yet.

What to do this week

You do not need a new operating system to avoid the worst of this.

These are conventions, and conventions hold until the day someone is in a hurry. That is the reason to want the guarantee one layer down.

Where we are with it

We are building an operating system on the premise that agents are parties to the machine: each one named, each one holding only what it was given, each one visible to the person it works for. We are in alpha, and we are not claiming that several agents can share a machine today without ever stepping on each other. What we are sure of is the shape of the problem. A computer that assumes one decider will keep being surprised by the second one, and it will keep reporting success while it happens.