Skip to content
sync ai agents

Shared memory vs message passing: where agent state lives

Updated November 2026

Give agents one shared memory when they run in one codebase and must work from a single consistent view. Have them pass messages when they belong to different teams or frameworks and should keep their internals private. With shared memory, every agent reads and writes one store, such as graph state or a blackboard. With message passing, agents send each other explicit payloads, such as handoff inputs or A2A messages, and each agent owns its own state.

At a glance

Shared memorymessage passing
What it isLangGraph state is part of the Graph API, which defines agent workflows as a graph of state, nodes, and edges.A2A is an open standard for communication between AI agents, whatever framework or vendor built them.
Where the data livesLangGraph keeps a shared snapshot of the application as state, usually a typed schema, and stores that data in channels named after the state keys.A2A defines a message as a single turn of communication between a client and an agent, and an artifact as a tangible output generated during a task.
Merging and orderingLangGraph state uses last-write-wins on most channels, while channels with a reducer combine values, for example by appending to a list.A2A requires implementations to deliver events in the order they were generated, and each stream must receive the same events in the same order.
Visibility between agentsLangGraph lets a node write to any channel in the graph state, including channels outside its declared input schema.A2A treats the remote agent as an opaque black-box system whose internal workings, memory, and tools stay hidden.
Human-in-the-loopLangGraph uses Command, which updates state while routing to the next node, including resume after an interrupt.A2A sets a goal of native support for long-running tasks and interactions that may involve human-in-the-loop scenarios.
DurabilityLangGraph checkpointers persist a thread's graph state as checkpoints for short-term, thread-scoped memory.A2A says not all Messages are guaranteed to be persisted in the Task history, and the agent is responsible for deciding which ones are.
Execution and transportLangGraph advances in discrete super-steps, and nodes that run in parallel share one super-step.A2A communication occurs over HTTP(S) with JSON-RPC 2.0 as the payload format for all requests and responses.

How does each one coordinate agents?

LangGraph coordinates agents through the state they share. Its nodes read state, do work, and return updates, and LangGraph applies them through each channel's reducer. With no reducer, updates overwrite the previous value, and a custom reducer can append to a list instead. Decide per key what should happen when two agents update it in the same step.

A2A coordinates through requests and results. Its core model is for clients to send messages that start a task producing one or more artifacts, and the agent's response is either a Task or a Message. The spec says results SHOULD be returned as artifacts, which separates communication from data output. A server-generated contextId can group related Task objects across a series of interactions.

A2A's docs say MCP stays within one agent and connects it to APIs and enterprise applications, while A2A crosses the boundary between agents. In MCP's own architecture, servers receive only necessary contextual information and the full conversation history stays with the host.

When should you choose LangGraph shared state?

When should you choose A2A messages?

Can you use them together?

Yes, with each doing its own job. A2A's docs divide the stack so that a framework builds the agent, MCP gives it context, a runtime hosts it, and A2A connects it to other agents. In a combined system, graph state can hold what your own agents share, while A2A messages carry requests to agents you do not run.

Inside LangGraph you can also keep part of the state private. When parent and subgraph schemas differ, you invoke the subgraph inside a node function, a setup the docs call common for keeping a private message history per agent. That node function transforms the parent state on the way in and maps the results back on the way out. Confluent describes a similar mix in which a blackboard becomes a data streaming topic of messages that worker agents produce and consume. The guide on keeping context in sync covers the working details.

What should you watch out for?

What else should you know?

Which sources does this page use?

Where can you go deeper?