Overview
Real-time memory sync enables multiple agent instances, devices, or systems to share memory updates instantly. When one agent learns something, all related agents know it immediately. This is essential for enterprise deployments, multi-device users, and collaborative agent systems.
Use Cases
Multi-Device Sync
User's agent on phone learns something → Laptop agent knows instantly
Agent Fleet Coordination
Support agent learns customer preference → All customer-facing agents updated
Collaborative Agents
Research agent finds information → Writing agent uses it immediately
Live Dashboards
Agent memory changes → Admin dashboards update in real-time
Architecture
┌─────────────────────────────────────────────────────────────┐
│ Agent Instances │
│ │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │Agent A │ │Agent B │ │Agent C │ │Agent D │ │
│ │(Phone) │ │(Laptop) │ │(Support)│ │(Admin) │ │
│ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ │
│ │ │ │ │ │
└───────┼──────────────┼──────────────┼──────────────┼────────┘
│ │ │ │
└──────────────┼──────────────┼──────────────┘
│ │
▼ ▼
┌─────────────────────────────────────────────────────────────┐
│ Real-Time Message Bus │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Pub/Sub Channels │ │
│ │ ├── user:{user_id}:memories │ │
│ │ ├── tenant:{tenant_id}:shared │ │
│ │ └── system:global │ │
│ └─────────────────────────────────────────────────────┘ │
└──────────────────────────┬──────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Persistent Memory Store │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Vector Store │ │ Event Log │ │
│ │ (Qdrant) │ │ (Kafka/Redis) │ │
│ └─────────────────┘ └─────────────────┘ │
└─────────────────────────────────────────────────────────────┘
Message Flow
Memory Write
↓
↓
- user:{user_id}:memories (user's other devices)
- tenant:{tenant_id}:shared (if shared memory)
↓
↓
5. Each agent updates local cache
Memory Read
↓
↓
↓
Channel Design
User-Scoped Channels
`user:{user_id}:memories`
Tenant-Scoped Channels
`tenant:{tenant_id}:shared`
Topic Channels
`topic:{topic_id}:updates`
Event Schema
Memory Event
MemoryEvent:
├── event_id: unique identifier
├── event_type: create | update | delete
├── timestamp: when it occurred
├── memory:
│ ├── id: memory identifier
│ ├── content: memory text
│ ├── embedding: vector (optional, can recompute)
│ ├── type: fact | preference | conversation
│ └── metadata: additional context
├── source:
│ ├── agent_id: which agent created
│ ├── session_id: which session
│ └── user_id: whose memory
└── channels: which channels to publish to
Sync Strategies
Eager Sync
Push all updates immediately:
Lazy Sync
Batch and push periodically:
Pull-Based Sync
Subscribers request updates:
Conflict Resolution
Last-Write-Wins
Simple, deterministic:
Vector Clocks
Track causality:
Merge Strategies
For different memory types:
Caching Layer
Local Cache
Each agent maintains:
Cache Invalidation
When update received:
Cache Warming
On agent start:
Implementation Technologies
Message Bus Options
Persistence Layer
Client Libraries
// Subscribe to user memory updates
const subscription = memoryBus.subscribe(
`user:${userId}:memories`,
(event) => {
localCache.apply(event);
notifyAgent(event);
}
);
// Publish memory update
await memoryStore.save(memory);
await memoryBus.publish(
`user:${userId}:memories`,
{ type: 'create', memory }
);