Senior · 7 chapters
Inter-agent communication
Message passing vs shared memory vs structured handoff payloads, and what is lost at every boundary
Most multi-agent bugs are boundary bugs, and a lossy or opaque handoff can make every downstream agent appear unreliable.
Read these first
What you will know
Design a structured handoff payload rather than passing free text
Include typed fields for goals, constraints, evidence, uncertainty, and ownership so the receiver does not have to reconstruct protocol from prose.
Show information being lost at a boundary
Compare the source context with the received representation and identify omissions, truncation, stale state, or ambiguity that could change the next action.
Compare message passing, shared memory, and structured handoffs on the same task
The choice changes visibility, coupling, synchronization, replayability, and the blast radius of stale or incorrect state.
Instrument a handoff so the loss is visible
Record schema versions, payload sizes, selected fields, timestamps, correlation IDs, and validation failures without logging secrets or unrestricted prompt content.
Decide what must cross a boundary and what must not
Keep only decision-relevant state at the boundary; redundant history increases latency and privacy exposure while missing constraints produces unsafe work.
Chapters
- 1
A missing constraint should be a validation failure, not a surprise
Agents that hand work over with a paragraph of prose make the receiver reconstruct a protocol out of it. Typed fields for goal, constraints, evidence, uncertainty and ownership turn an absent constraint into an error at the boundary rather than a behavioural difference nobody notices three steps later. Typed payloads are usually larger, so arguing for them on token efficiency misses the point and produces schemas with constraints buried in a notes field.
- 2
A tolerant reader outlives the schema its sender is on
The objection that kills typed payloads in design reviews is that a schema change breaks the boundary, and it deserves a real answer rather than a denial. Additive changes with optional fields and a receiver that ignores what it does not recognise let the two sides deploy independently; a breaking change needs a version on the payload, a window where both versions are accepted, and a defined behaviour — reject loudly, or handle at the older version — when a receiver meets a version from the future. This is also where prose keeps its one genuine advantage: it carries whatever the schema has no field for, and it evolves without a coordinated change on both sides, which is exactly the flexibility a schema trades away for the validation failure it buys.
- 3
A conclusion without its basis invites the receiver to invent one
A pricing agent sends a customer ID and a final number; the approval agent keeps rejecting correct quotes, citing assumptions pricing never made. Given a conclusion and nothing else, the receiver reconstructs a plausible derivation from its own defaults and finds that it disagrees. Setting what the sender held against what actually arrived is how you make that loss concrete instead of arguing about which agent is worse.
- 4
Over-passing is the invisible failure, not the safe one
A planner's payload carries the plan, the whole customer conversation, every retrieved document, its own reasoning trace, and a card number that came along inside one record. Redacting the card treats privacy as the only defect and leaves the executor deciding which of several thousand tokens constrain it, which is the judgement that drops constraints. Only what changes the receiver's next action crosses; then find out whether trimming actually cost anything. The reasoning trace is the case where that rule is hardest to apply and worth working through: the constraints it discovered and the uncertainty it settled do change the next action, while the derivation itself does not, and shipping the derivation conditions the executor on the planner's path instead of informing it.
- 5
Three readers and an on-call engineer mean shared state
Agent A computes a routing configuration that B, C and D each need during the run, and a human wants to see it while the run is still in flight. That is the shape shared state fits, where a structured handoff fits one sender and one receiver. Choosing between message passing, shared memory and typed handoffs changes visibility, coupling, synchronisation, replayability and how far stale state can spread.
- 6
Log the payload's shape when you may not log its contents
Five hours went into finding which of four agents lost a customer's stated constraint, because the handoffs were free text buried inside prompts. Security vetoes logging payload contents, and answering a data-minimisation objection with access control is the argument that loses a review. Record shape instead: schema version, total size, which optional fields were populated, the correlation ID, timestamps at both ends, and every validation failure.
- 7
Three unreliable agents downstream of one rewritten sender
Three teams each want a more expensive model, roughly tripling spend, and all three agents sit immediately below an agent that was rewritten six weeks ago. Three agents failing on the same missing input presents exactly like three separately unreliable agents. Upgrading one as an experiment cannot settle it, because a stronger model partially repairs an ambiguous payload wherever the fault lies, and that partial gain then reads as confirmation.
External resources
- Agent2Agent (A2A) Protocolgithub.com
The spec for structured task messages between agents that share no memory.
- Handoffs — OpenAI Agents SDKopenai.github.io
Code for typed handoff payloads and controlling what history transfers.
- MCP, ACP, and A2A: The Growing World of Inter-agent CommunicationCamunda
Maps which protocol solves which boundary problem, and what each drops.
- Understanding multi-agent handoffsLangChain
Shared-state vs handoff tradeoffs shown in a running LangGraph app.
- A2A vs MCP: AI Agent Communication ExplainedIBM Technology
Clear line between calling a tool and delegating to a peer agent.