Inferensys

Glossary

Memory Pub/Sub

Memory Pub/Sub is a messaging pattern for multi-agent systems where agents publish memory updates to topics and subscribe to updates from others, enabling scalable, decoupled coordination.
Developer reviewing multi-agent chat interface on laptop, agent conversation logs visible, casual coding session at WeWork desk.
MULTI-AGENT COMMUNICATION PATTERN

What is Memory Pub/Sub?

Memory Pub/Sub (Publish/Subscribe) is a foundational messaging architecture for coordinating memory updates and state synchronization across autonomous agents in a distributed system.

Memory Pub/Sub is a decoupled messaging pattern where agent components (publishers) broadcast state changes or events to named channels (topics) without knowing the recipients. Other components (subscribers) asynchronously receive these messages by expressing interest in specific topics, enabling scalable, event-driven communication for multi-agent systems. This architecture is central to implementing shared memory and eventual consistency models without tight coupling between agents.

In practice, a Memory Event Bus often implements this pattern, allowing agents to publish memory transactions, checkpoints, or observability signals. Subscribers use these updates to maintain local caches, trigger workflows, or log activity. This pattern is critical for distributed memory fabrics and supports leader-follower replication strategies by propagating write operations from a leader to followers, ensuring all agents operate on a coherent view of the system's evolving state.

ARCHITECTURAL PRIMITIVES

Core Components of a Memory Pub/Sub System

A Memory Pub/Sub system decouples agents that produce state updates (publishers) from those that consume them (subscribers) via a central message broker. This pattern is fundamental for scalable, asynchronous coordination in multi-agent systems.

01

Publisher

An agent or process that generates and emits memory events or state updates to the system. Publishers categorize events into logical topics (e.g., agent:location, task:completed) without knowledge of which subscribers, if any, will receive them. This decoupling is the core of the pattern.

  • Role: Initiates communication by pushing messages.
  • Key Action: publish(topic, message)
  • Example: An agent completing a navigation step publishes an event to the agent:movement topic containing its new coordinates.
02

Subscriber

An agent or process that registers interest in one or more topics and receives relevant messages as they are published. Subscribers implement a callback or handler function that is invoked asynchronously by the broker when a matching event arrives.

  • Role: Listens for and reacts to specific events.
  • Key Action: subscribe(topic, callback_handler)
  • Example: A monitoring agent subscribes to the system:alert topic to log and escalate any error events published by other agents.
03

Message Broker

The central routing infrastructure that accepts published messages, filters them by topic, and distributes copies to all active subscribers for that topic. It manages connection state, message queues, and delivery semantics.

  • Core Functions: Topic-based routing, connection management, persistence (optional).
  • Delivery Semantics: Defines guarantees like at-most-once, at-least-once, or exactly-once delivery.
  • Examples: Redis Pub/Sub, Apache Kafka, RabbitMQ, or a custom in-memory broker.
04

Topic

A named channel or category that acts as an address for messages. It is the primary routing key used by the broker to match publishers with subscribers. Topics provide a layer of abstraction, allowing publishers and subscribers to evolve independently.

  • Structure: Often a hierarchical string (e.g., sensor/floor1/temperature).
  • Wildcards: Systems may support pattern-based subscriptions (e.g., sensor/floor1/*).
  • Purpose: Enables selective broadcasting; subscribers receive only messages relevant to their subscribed topics.
05

Event / Message Payload

The structured data packet containing the state update or notification being communicated. The payload is opaque to the broker but must be serializable. In agentic memory systems, it often contains semantic embeddings, agent state, or action results.

  • Common Formats: JSON, Protocol Buffers, Avro.
  • Typical Fields: event_id, timestamp, source_agent, topic, data (the core payload).
  • Example: {"agent_id": "nav_01", "timestamp": 1712345678, "data": {"x": 105, "y": 42}}
06

Subscription Model & Patterns

Defines how subscribers express interest and how messages are delivered. Beyond simple 1:1 topic matching, advanced patterns enable complex coordination.

  • Fan-Out: A single message from one publisher is delivered to many subscribers (broadcast).
  • Durable Subscriptions: The broker retains messages for offline subscribers, delivering them upon reconnection.
  • Queue Groups: Multiple subscribers to the same topic form a competing consumers group, where each message is delivered to only one member, enabling load balancing.
  • Pattern Subscription: Subscribing using wildcards (e.g., agent.*.status) to receive messages from a family of topics.
ARCHITECTURAL PATTERN

How Memory Pub/Sub Works in Multi-Agent Systems

Memory Pub/Sub (Publish/Subscribe) is a foundational messaging architecture for decoupling communication in multi-agent systems, enabling scalable and dynamic information sharing.

Memory Pub/Sub is a messaging pattern where agent components called publishers broadcast categorized memory updates (events) to logical channels called topics, without knowing the specific recipients. Other components, called subscribers, asynchronously receive only the events for topics to which they have explicitly subscribed. This creates a loosely coupled architecture, allowing agents to join, leave, or change their information interests dynamically without disrupting the entire system. The pattern is central to implementing event-driven coordination and shared situational awareness across an agent fleet.

In practice, a centralized event bus or distributed messaging middleware (e.g., Apache Kafka, Redis Pub/Sub) typically implements the topic routing. When an agent's working memory or long-term knowledge graph is updated, it publishes an event containing the new state or fact. Subscribing agents ingest these events to update their own context windows or trigger planning loops. This pattern is crucial for eventual consistency models and enables sophisticated workflows like cross-agent reflection and distributed goal decomposition without direct point-to-point communication overhead.

MEMORY PUB/SUB

Frequently Asked Questions

A messaging pattern where senders (publishers) categorize messages into topics without knowledge of the receivers (subscribers), who receive messages for topics they have subscribed to.

Memory Pub/Sub (Publish/Subscribe) is a messaging pattern where autonomous agents communicate state changes by publishing events to logical channels (topics) without knowing the subscribers, and interested agents receive those events by subscribing to relevant topics. It works by decoupling the producer of a memory update from its consumers through a central event bus or message broker. When an agent performs an action or updates its internal state, it publishes a structured event (e.g., agent:task_completed, memory:vector_updated) to a broker. The broker then forwards copies of that event to all other agents that have previously subscribed to that specific topic, enabling asynchronous, scalable, and loosely-coupled coordination.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.