All articles
14 min read
#LangChain#Agents#Multi-Agent#Architecture

Around Three Agents, I Start Considering Message-Passing

I compare shared fields and append-only messages, with explicit ownership, inbox tracking and supervisor routing.

On this page

Update, October 2026. I corrected this article's share description and tightened some wording in the body. The reason is in the update section near the end.

Why this matters

I use a planner, a researcher and a writer as an illustrative coordination example. Suppose they all read and write the same LangGraph AgentState, with no explicit owner for each field. I examine who may change a result, which version a reader expects and what recovery should retain. This is an architectural walkthrough, not a production incident report or a benchmark of agent counts.

For example, a later planner step could replace a result the writer still expects to use. A reused session identifier could expose an older result if I had not isolated the checkpoint. A router could dispatch completed work again if completion state and result ownership disagree. I make those assumptions explicit before choosing between shared fields and messages; I do not infer a universal failure threshold from this example.

Shared state is not wrong. I stop trusting it when several agents coordinate through overlapping writes. Around three agents, I start considering message-passing with a supervisor as a design heuristic: agents send typed messages, and one router decides who runs next. The important question is where that model starts to break, and what I replace it with when I need durable state, deterministic recovery, reproducible evals, and cost under control.

1. The three failure modes of shared blackboards

A shared blackboard is any design where multiple agents read from and write to the same state object without explicit ownership. I examine this risk in shared Python dicts, LangGraph fields without reducer annotations, and database records that several agents may replace without a version check.

Failure mode 1: write conflicts. When two agents write the same field, the merge rule decides the outcome. With no reducer, two writes to the same key inside one parallel super-step do not silently merge — LangGraph rejects that concurrent update with InvalidUpdateError; the host must handle the exception. LangGraph documents reducers as the mechanism for defining how concurrent updates to a state key are combined in its Graph API reference. The quieter failure is cross-step: a later node overwrites a field an earlier node set, and the lost write may not be visible unless I inspect state at each checkpoint. Either way, the coordination model forces an explicit choice.

Failure mode 2: stale reads. Agent B reads state that Agent A wrote two steps ago. An older snapshot can be valid in either a sequential or a parallel pipeline. It becomes a correctness bug when the reader requires a newer version but receives the old one. If Agent B assumes the researcher's output is current but the planner has since changed the research direction, Agent B can answer a question that is no longer being asked.

Failure mode 3: stale checkpoint replay. Checkpointing a multi-agent system means saving shared state at a point in time. In LangGraph, checkpoint persistence and thread state are documented in the persistence guide. Replaying an older checkpoint is a design choice: it restores the historical state captured at that point in the workflow when I select that checkpoint for execution. The failure occurs when I treat that historical state as the current workflow state, or when my recovery design does not preserve the intended checkpoint lineage during branching and recovery. LangGraph documents replay, branching, and checkpoint selection in its time-travel documentation. If Agent C reads state, does work, and is checkpointed, then Agent A overwrites the same fields, replaying from Agent C's checkpoint can restore a version that does not include Agent A's later updates. That replay may be internally consistent while still being unsuitable for recovery if my workflow expects those later updates to remain in the active lineage.

I do not treat these as LangGraph bugs or checkpointer bugs. They can arise when ownership and version expectations are left implicit. If I add locks, versioned fields, and read-your-writes guarantees around shared state, I am choosing to rebuild parts of a distributed database, which is not the coordination primitive I choose for this agent-system design.

2. The message bus alternative

A message bus changes the coordination model. Instead of reading from a shared object, agents send typed messages to one another through an explicit channel. No agent reads another agent's "current output" directly. It receives a message that was deliberately sent to it.

In LangGraph, I usually model this with Annotated[list[Message], operator.add] as the primary coordination channel, using the reducer mechanism documented in the LangGraph Graph API, combined with a supervisor node that reads the message queue and routes based on message type and content rather than on global state fields. This is my design choice, not a required LangGraph architecture; LangChain documents supervisor-based multi-agent orchestration as one available pattern in its multi-agent guide.

The practical difference is ownership. Each agent produces a Message with an explicit to, from_, type, and payload. In this design, the supervisor reads the queue, dispatches messages to the appropriate agent, and the agent processes its inbox. State is still shared — the messages list is global — but writes are constrained by the append reducer. No agent writes to "its" fields; it only appends to the shared channel.

from typing import Annotated, Literal, TypedDict
import operator

class Message(TypedDict):
    id: str
    from_: str
    to: str
    type: Literal["request", "result", "error", "status"]
    payload: dict

class AgentState(TypedDict):
    messages: Annotated[list[Message], operator.add]  # append-only
    session_id: str
    completed_agents: Annotated[set[str], operator.or_]

What changes: the researcher does not write to research_results. It sends Message(from_="researcher", to="writer", type="result", payload={"findings": ...}). The writer node filters state["messages"] for messages addressed to it and processes its inbox. Filtering alone does not define an inbox: each agent also records consumed message IDs or an inbox offset durably, so replay or re-entry does not process the same message again. I make message handling idempotent so that a repeated delivery with the same message ID does not produce a second side effect. There is no shared field both agents write to; there is only a channel both append to.

3. The supervisor pattern and when it earns its cost

A supervisor agent is a router with memory in this design. It receives messages, decides which agent runs next, and maintains global task status. It also adds a model call to routing steps. Under the illustrative assumption of one routing call per step, a 10-step pipeline can add 10 LLM calls.

The cost is real. I use a supervisor only when the control it adds is worth that cost for the workflow.

Without a supervisor, adding a new agent can require updating every agent that might hand off to it. Changing routing logic can require updating edge functions. Debugging why a task stalled can require reading through the message queue manually.

With a supervisor, I centralize routing logic. Adding a new agent can mean registering the agent with the supervisor's routing configuration or tool interface. When I persist or log the supervisor's decision, I can represent it in a logged decision or emitted message. Debugging a stalled task can then start with the supervisor's last recorded decision.

As a personal rule of thumb, I start considering a supervisor around three agents. Below that, peer-to-peer handoffs with conditional edges are often cheaper and easier to inspect. At three or more agents, centralized routing can be worth the extra calls, especially when the agent set is still changing.

The supervisor anti-pattern is using the supervisor as a glorified if-else router, with explicit rules like "if the user mentions Python, route to the coder". A supervisor adds value in my design when it needs to track task state across multiple steps. It adds little when it only pattern-matches on one field. If the routing logic fits in a switch statement, I remove the supervisor and use conditional edges.

4. Tool governance in multi-agent systems

When I move from one agent to many, tool access becomes a correctness concern, not just a security concern. An agent with access to tools outside its intended role may select them, especially if its context includes instructions from another agent that suggest doing so.

I use a simple principle: tool access should match agent role, not agent capability. The researcher agent should not have write access to the file system even if the underlying model can generate valid file-write commands. The writer should not have search tools even if it could use them to "verify" its output — that is the researcher's job.

# Researcher: read-only tools
researcher_agent = create_react_agent(
    llm,
    tools=[search_web, fetch_url, read_document],
    prompt="You retrieve and synthesize information. Do not write or modify files."
)

# Writer: write tools only, no search
writer_agent = create_react_agent(
    llm,
    tools=[write_draft, format_output],
    prompt="You write and format content based on researcher findings. Do not search."
)

# Supervisor: routing tools only, no domain tools
supervisor_agent = create_react_agent(
    llm,
    tools=[route_to_researcher, route_to_writer, mark_complete],
    prompt="You coordinate the research and writing workflow."
)

I do not treat this primarily as a security measure. I use it to reduce the agent's action space to what is appropriate for its role. In this configuration, the tool lists enforce that the researcher has no file-write tool, the writer has no search tool, and the supervisor has no domain-action tool.

5. Failure detection and recovery

When delivery and logging are persisted explicitly, a message-passing design gives me records I can inspect: the queue, sent messages, received messages, and requests with no recorded response. I use the durable message and checkpoint records described in my multi-agent-systems artifact and the LangGraph persistence guide to define failure detection and recovery.

The recovery primitive is straightforward: if an agent has not responded within a timeout, the supervisor can re-route the request or escalate to human-in-the-loop (HITL). This requires that every request message has an id and that the supervisor maintains a registry of outstanding requests.

from typing import Annotated, Literal, TypedDict
import time

class SupervisorState(TypedDict):
    messages: Annotated[list[Message], operator.add]
    outstanding: dict[str, float]  # message_id -> sent_at timestamp
    escalated: Annotated[set[str], operator.or_]

def supervisor_node(state: SupervisorState) -> dict:
    now = time.time()
    for msg_id, sent_at in list(state["outstanding"].items()):
        if now - sent_at > 30:  # 30-second timeout
            outstanding = dict(state["outstanding"])
            outstanding.pop(msg_id)  # remove before emitting recovery
            return {
                "outstanding": outstanding,
                "escalated": {msg_id},
                "messages": [Message(
                    id=new_id(),
                    from_="supervisor",
                    to="hitl",
                    type="request",
                    payload={"reason": f"Agent timeout on message {msg_id}"}
                )]
            }
    pending = [m for m in state["messages"] if m["to"] == "supervisor" and m["type"] == "result"]
    # route based on pending results ...

Before emitting the recovery message, I remove the request from outstanding and mark its ID as escalated. The registry needs to record that transition so a replay or another supervisor invocation can distinguish an already escalated request from a new one.

I treat this pattern — an outstanding-request registry with timeout and escalation — as a timeout monitor and dead-letter recovery pattern. It is similar in spirit to a circuit breaker, but its purpose is to detect stalled work and route recovery rather than prevent calls to a failing dependency. It makes the recovery state explicit instead of leaving the workflow waiting indefinitely without a recorded transition.

6. Coordination patterns by system size

I choose the coordination model based on the number of agents and how they interact. These ranges are my own heuristics:

2 agents: Direct handoff. Agent A runs, writes output to a named field with a clear reducer, and Agent B reads that field. No supervisor is needed. A conditional edge routes from A to B based on A's output status. This is the simplest design I use for this problem shape. I avoid adding coordination machinery before I need it.

3–5 agents: Supervisor with message bus. The supervisor routes between agents. Agents communicate through the append-only message channel, not through named fields. Each agent filters its inbox and tracks consumed message IDs or an inbox offset durably. The supervisor decides which message should trigger which agent. This is the range where I often start to prefer explicit routing and durable message history.

5+ agents or dynamic sets: Hierarchical supervisor. A top-level supervisor delegates to sub-supervisors. Each sub-supervisor manages a team of specialized agents. The top-level supervisor talks to sub-supervisors, not directly to domain agents. This adds coordination overhead while making boundaries more explicit. Each sub-supervisor can be developed and tested independently.

I do not treat the transition between these tiers as arbitrary, but I also do not treat the counts as fixed rules. I look for the failure modes. With 2 agents, write conflicts can be easier to reason about because there are only two writers. As the agent count grows and parallelism increases, persisted append-only channels can provide a message history I can inspect. When a single supervisor becomes a routing bottleneck, I consider hierarchical delegation.

The category frame

I use shared state for a single agent when its schema and update rules are explicit. I do not use it as the primary coordination model for a team of agents with overlapping write access. The failure modes — write conflicts, stale reads, and stale checkpoint replay — are coordination risks I check as I add parallelism.

Message-passing with a supervisor is not architecturally pure; it is a pragmatic trade. When I persist the queue and delivery records, I can inspect them when debugging. When I persist outstanding-request state, I can requeue timed-out messages when recovery requires it. Adding an agent becomes an explicit routing-configuration or tool-interface change. In a 10-step system, the extra routing calls may be justified when debugging and recovery matter more than latency.

If you are debugging state corruption, routing instability, or checkpoint replay bugs in a multi-agent system, you can write me with the failure mode and trace shape. These failure modes have recognizable mitigation patterns, but the right choice depends on the workflow and recovery requirements.

Update — October 2026

The share description of this article said that message-passing with a supervisor "stays deterministic". The body does not support that. Section 3 says the supervisor adds a model call to routing steps, and a model call is not deterministic. What the body supports is narrower: message-passing makes ownership explicit, and I can log the supervisor's routing decision where I can inspect it. The share description now presents the design comparison. I also frame the opening as an illustrative example, so it does not imply a measured failure threshold or a publicly evidenced production incident.

FAQ

When does shared state start to break in multi-agent systems?

I stop trusting shared state when several agents coordinate through overlapping writes. As a personal heuristic, I start considering a supervisor around three agents; with 3–5 agents, I often prefer a supervisor with an append-only message bus and durable message history.

What are the main failure modes of a shared blackboard?

I check for three coordination risks: write conflicts, stale reads, and stale checkpoint replay. These are not necessarily LangGraph or checkpointer bugs; they can follow from a coordination model where multiple agents read from and write to the same state object without explicit ownership.

How does a message bus reduce shared-state coordination bugs?

A message bus changes ownership. Agents do not write to each other's fields or read another agent's current output directly. Each agent appends typed messages with explicit to, from_, type, and payload fields, then processes messages addressed to its inbox. I track consumed message IDs or inbox offsets durably and make processing idempotent to prevent repeated work after replay or re-entry.

When is a supervisor worth the extra LLM calls?

I use a supervisor only when centralized routing, task-state tracking, and observable decisions are worth the added calls for the workflow. It earns its cost when routing logic changes often, the agent set is still changing, or debugging should start from the supervisor's last recorded decision.

How should tool access be assigned across agents?

I assign tool access by agent role, not by model capability. The researcher gets read-only tools, the writer gets write and formatting tools, and the supervisor gets routing tools. This constrains each agent's available actions to those appropriate for its role.

Share this article

Want something similar? See services and prices

Related articles

  • State as the API: Three LangGraph Designs

    I compare three LangGraph state designs: flat fields, nested models, and explicit reducers, with routing and replay constraints.

    Jan 8, 202511 min read
    #LangGraph#LLM#Multi-Agent#Orchestration
  • How I Evaluate CrewAI and LangGraph for Recovery

    I compare roles, routing, structured state, memory, and recovery through explicit design criteria and official documentation.

    Jan 15, 20255 min read
    #CrewAI#Multi-Agent#LangGraph#Production
  • MCP in production: a checklist

    I check seven things before an MCP server touches real data: hints, token audience, scopes, OAuth discovery, local servers, state handles, logs.

    Oct 24, 20269 min read
    #MCP#Security#Agents#Production