This series explores what problems actually show up when several agents work on the same task, which ones message passing solves, and which ones it quietly ignores.
Short version: message passing gets bytes from one agent to another. It doesn't tell anyone what the group currently believes, who is allowed to change that belief, or what happens when two agents disagree. Those three things are where multi-agent systems break in production.
A failure that isn't a bug
Take a support setup with three agents. A triage agent reads the ticket and classifies it. A fraud agent checks the account. A refund agent issues refunds under a limit.
Triage tags the ticket "refund, low risk" and messages both agents at the same time. The refund agent sees a valid request under its limit and pays out. Four seconds later the fraud agent finishes and flags the account, because it found three chargebacks from the same card last month.
Nothing crashed. Every message arrived. Each agent did exactly what it was told with the information it had. The system still made the wrong decision, because there was no shared place where "fraud check: pending" lived, and no rule saying the refund decision had to wait for it.
That's the gap. Delivery worked. Coordination didn't.
Four questions every multi-agent system answers
Every system with more than one agent answers these, either on purpose or by accident:
- Who is this? When agent B gets a request "from agent A", how does it know it's really A and not something pretending to be A?
- Are they allowed? Even if it is A, should A be able to call B, write that piece of state, or ask B to act on someone else's behalf?
- What do we all believe right now, and who may change it? This is shared context. It needs structure and owners, not just a big object everyone writes into.
- What happens when we disagree? Two agents want different values for the same thing. Something has to decide, and it shouldn't be "whoever wrote last".
The first two are trust. The third is shared context. The fourth is conflict resolution. Message passing touches none of them.
What shared context is (and what it isn't)
People use "context" for at least four different things, and mixing them up causes most of the confusion I see in design reviews.
- The message log. Everything the agents said to each other. Useful for debugging, terrible as a source of truth, because the latest message isn't necessarily the current fact.
- An agent's own memory. What one agent remembers across sessions about a user or a task. Private to that agent.
- The knowledge base. Documents and data that agents search. Mostly read-only during a run.
- Shared run state. The small, structured set of facts and decisions the agents working on _this_ task agree on right now. "Ticket category is refund." "Fraud check is pending." "Refund approved by: nobody yet."
Shared context is the last one. It's closer to a database row than to a conversation. And like any shared database row, it needs rules about who can write what.
You could try to skip it and just paste everything into each agent's prompt. That works for two agents and a short task. Past that, you're paying for tokens of stale information, each agent sees a slightly different snapshot depending on when it was called, and you still have no way to stop one agent from contradicting another.
The principles we design by
These came from building and breaking our own workflows, not from a whiteboard:
State is data with owners, not a whiteboard anyone scribbles on. Every important key should have one agent responsible for it. Others can read it, add evidence next to it, or propose a change. They don't silently overwrite it.
The server enforces, the model proposes. An LLM is good at judging whether a refund looks reasonable. It is not where you check that the amount is positive, that the caller is allowed, or that nobody wrote in between. Those checks belong in code the model can't talk its way around.
Identity comes from the platform, not from the message. If an agent's identity is a field in the request body, any compromised component can claim to be anyone. Identity has to be issued and verified by something the agents don't control.
Every decision leaves a trace. When a write is refused, a proposal is rejected or a human overrides an agent, you should be able to see who, when and why. Trust without an audit trail is just hope.
How DNotifier handles it
DNotifier answers all four questions in the platform, so you don't have to rebuild them in every workflow.
Shared context. Every workflow run has a shared state object, ctx.state, that all agents in the run read and write. Agents run in sequence with ctx.runAgent or in parallel with ctx.runAgents. Remote agents, running in another process or service, receive the run's state with the call, and their changes are merged back into the caller's state when they reply.
Here's the triage agent from the example:
async run(ctx) {
ctx.state.ticket = { id: ctx.input.ticketId, category: "refund" };
ctx.state.fraudCheck = "pending";
const fraud = await ctx.runAgent("fraud-check", { input: ctx.state.ticket });
ctx.state.fraudCheck = fraud.content;
return { next: ctx.state.fraudCheck === "clear" ? "refund" : "review" };
}The refund agent reads ctx.state.fraudCheck before paying. That one change removes the race from the example.
Trust. Each agent run gets a short-lived identity issued by the platform, and the server reads the caller from it, never from the request. Each agent declares who may call it, with scopes, and everything else is denied. Tool permissions an agent asks for have to be approved by the project owner or a project policy. Calls carry their chain, so a blocked agent can't reach a sensitive one by going through a trusted middle agent.
Conflict resolution. Every key in shared state has an owner and a write rule: owner approves, append, sum or max, last write wins, or read-only. Writes are version-checked, so an agent that read stale data gets a conflict with the fresh value instead of overwriting someone else's work. Writes from non-owners become proposals the owner accepts or rejects.
Validation and escalation. Keys can carry a JSON Schema and server-side rules, so invalid writes are refused without a model judging them. When agents still disagree, each key's escalation policy decides: a judge agent, a weighted vote, or a person through the approvals inbox, with a timeout and a safe default.
Earned trust. Content from other agents is tagged with its source and never treated as instructions by default. Each agent has a trust score built from its traced history, used for vote weights and review rules.
Everything is traced. Every step, state change, call, denial, conflict, proposal and escalation shows up in Traces, and the trust and state screen in the portal puts who-can-call-whom, pending proposals and trust scores in one place.
The rest of this series takes each of these in turn: why it matters, how to design it well, and how it works in DNotifier.
Habits that help on any platform
Whatever you build on, a few habits make multi-agent state much easier to live with:
- Give each agent its own keys in shared state and treat them as single-writer. If two agents contribute to the same thing, let each write its own key and have a later step combine them.
- Store decisions with their reason and author:
{ value: "approved", by: "refunds", why: "under limit, fraud clear" }. Future you will want that. - Make "pending" an explicit state. Most races come from an agent assuming a check already happened.
- Turn on observability and look at the state timeline for a few real runs. You'll usually spot the first conflict in under ten minutes.
The rest of this series
- Multi-agent systems need shared context, not just message passing (this post)
- Agent identity: how an agent proves who it is
- Who can call whom: agent-to-agent authorization
- Requested vs granted: tool permissions and the audit trail
- Conflict resolution on shared state
- Version-checked writes and proposals
- Consensus for AI agents: judges, votes and humans
- Agent-to-agent prompt injection and earned trust
If you want the bigger picture of how agents coordinate first, start with how to build multi-agent systems and multi-agent orchestration patterns.
FAQ
What's the difference between shared context and agent memory?
Agent memory belongs to one agent and usually lasts across sessions. Shared context belongs to one task (one run) and is read and written by every agent working on it. You want both, and you want them kept apart.
Is message passing enough for two agents?
Often, yes. With two agents and a strict turn order there's little to conflict over. Problems start with parallel agents, agents that can call each other freely, or any agent that can take an irreversible action.
Do I need a consensus algorithm like Raft or Paxos?
Usually not. Those keep copies of the same data in agreement when machines crash. Agents disagree about judgments, not about which copy of a log is current. What you need is a decision policy per piece of state. Part 7 goes into this.
How does DNotifier share state with remote agents?
The run's ctx.state is sent along when a workflow calls a remote agent, and the remote agent's changes are merged back into the caller's state when it replies. Those writes go through the same ownership rules and version checks as local ones.



