DEV Community

Jason
Jason

Posted on

Deep Dive into Markus Architecture: Memory, A2A Protocol & Multi-Agent Runtime

Deep Dive into Markus Architecture: Memory, A2A Protocol & Multi-Agent Runtime

Meta Description: Explore the Markus multi-agent architecture — a production-grade cognitive runtime featuring Tulving three-tier memory, Agent-to-Agent (A2A) protocol, Cognitive Preparation Pipeline, 9-state task governance, and Heartbeat-driven autonomous agents. Learn how AI agents think, remember, and collaborate.


1. Introduction

As AI agents evolve from simple chatbots into autonomous digital employees, the underlying architecture must support memory persistence, inter-agent communication, task governance, and self-directed operation. Markus is an open-source multi-agent runtime that takes a principled approach to all of these challenges.

Inspired by cognitive psychology, distributed systems, and production-grade software engineering, Markus provides a complete infrastructure for deploying teams of AI agents that can remember past interactions, communicate with each other, delegate tasks, follow governance policies, and even initiate work on their own through a Heartbeat mechanism.

This deep dive explores the core architectural components that make Markus a compelling choice for developers building multi-agent systems in production. We'll cover:

  • The three-layer architecture (Web UI → Org Manager → Agent Runtime)
  • Tulving three-tier memory (Procedural, Semantic, Episodic) and the Dream Cycle
  • The A2A protocol (Agent-to-Agent communication) with mailbox system and attention controller
  • Cognitive Preparation Pipeline (CPP) with four depth levels
  • Task governance: 9-state state machine, approval gates, trust levels, and workspace isolation
  • The Heartbeat mechanism for proactive agent behavior

2. The Three-Layer Architecture

Markus follows a clean separation of concerns with three distinct layers. Each layer has a clearly defined responsibility, and they communicate through well-defined interfaces.

2.1 Web UI (Presentation Layer)

The frontend is built with React + Vite + Tailwind CSS, providing a responsive dashboard that works across desktop and mobile. It offers workspaces for chat, project management, agent configuration (Builder), capability discovery (Hub), and system settings.

2.2 Org Manager (API / Governance Layer)

The Org Manager serves as the central API server. It handles:

  • Authentication & Authorization — user and agent identity management
  • Task Governance — state machine transitions, approval routing, and policy enforcement
  • Project Management — project creation, milestone tracking, deliverable management
  • Reporting & User Management — audit logs, team organization

2.3 Agent Runtime (Core Cognitive Layer)

The Agent Runtime is where the actual intelligence lives. It manages:

  • Agent lifecycle — creation, session management, sub-agent spawning
  • LLM Router — intelligent model selection, failover, circuit breaker
  • Tool System — tool registration, execution, sandboxing
  • Memory System — Procedural, Semantic, and Episodic tiers
  • A2A Communication — mailbox, message routing, delegation
  • Heartbeat Scheduler — autonomous periodic task execution
  • Context Engine — 24-segment system prompt assembly with KV-cache optimization

3. Tulving Three-Tier Memory System

Named after cognitive psychologist Endel Tulving, Markus implements a three-tier memory architecture that mirrors human memory systems. This is a defining feature of its cognitive architecture and one of the key differentiators from simpler agent frameworks.

3.1 Procedural Memory — "How to Act"

Procedural memory encodes the agent's identity, behavioral rules, and skill definitions. It answers the question: Who am I, and how should I behave?

Aspect Detail
Storage role/ROLE.md + Skill definition files
Content Agent identity, system prompts, behavior boundaries, action policies
Loading Prepended to the system prompt at every inference cycle
Mutability ROLE.md is immutable by the agent — only human users can modify core identity

This layer ensures that an agent cannot rewrite its own fundamental character.

3.2 Semantic Memory — "What I Know"

Semantic memory stores factual knowledge, verified patterns, workflows, and domain expertise.

Aspect Detail
Storage MEMORY.md (curated, always in prompt) + memories.json (observation buffer)
Capacity MEMORY.md: 3,000 characters per section, 15,000 total
Key Tools memory_save (save observation), memory_search (retrieve), memory_update_longterm (consolidate)

3.3 Episodic Memory — "What Happened"

Episodic memory records the agent's past experiences — tasks it performed, messages it received, sessions it participated in.

Aspect Detail
Storage sessions/*.json (current + recent), SQLite agent_activities (historical)
Retrieval recall_activity tool — query by task, type, or keyword
Use Case Contextual awareness, learning from past outcomes, continuity across sessions

3.4 The Dream Cycle — Memory Consolidation

Markus features an autonomous memory consolidation process called the Dream Cycle, inspired by how human brains consolidate memories during sleep. When memories.json exceeds 50 entries and consolidation hasn't run today, the system:

  1. Reviews all observations via LLM
  2. Merges duplicates, prunes outdated entries, identifies recurring patterns
  3. Promotes patterns appearing 3+ times to MEMORY.md
  4. Prunes source entries from memories.json

This ensures noise is filtered out, patterns are promoted, and storage stays bounded.


4. A2A Agent-to-Agent Communication Protocol

Agents don't work in isolation — they communicate. Markus implements a proprietary A2A protocol specifically designed for AI agent communication, built on a robust mailbox system.

4.1 Mailbox System

Every agent has a persistent mailbox:

  • OUTBOX — Messages the agent has sent (audit trail)
  • INBOX — Incoming messages waiting to be processed
  • MAIL — Processed messages (archived)

Messages are asynchronous by default — sending does not block either the sender or the receiver.

4.2 Synchronous vs. Asynchronous Communication

Mode Tool Behavior Use Case
Async agent_send_message (default) Fire-and-forget; sender continues Status updates, notifications
Sync agent_send_message({ wait\_for\_reply: true }) Sender blocks until response Questions, decisions

4.3 Attention Controller

The Attention Controller determines how the agent spends its cognitive cycles. In each execution loop, the agent: checks high-priority tasks, checks mailbox for new A2A messages, and processes pending tasks in priority order.


5. Task Governance System

Task governance is the backbone of Markus's reliability layer. Every piece of work flows through a precisely defined state machine.

5.1 9-State Finite State Machine

State Description
pending Created but not yet started
in_progress Assigned and actively being worked on
blocked Waiting on external dependency
review Submitted for peer review
completed Approved by reviewer
failed Execution error
rejected Requirement rejected
cancelled Explicitly cancelled
archived Historical reference

5.2 Submit-Review-Merge (SRM) Workflow

Markus's built-in quality gate: Worker submits, Reviewer inspects, Approves or rejects. This enforces a four-eyes principle on every deliverable.

5.3 Trust Levels

Level Autonomy
Probation Low — all tasks reviewed
Standard Medium — complex tasks need review
Trusted High — significant tasks only
Senior Full — can review others' work

6. The Heartbeat Mechanism

The Heartbeat transforms Markus from a reactive system into a proactive workforce that initiates work autonomously.

At configurable intervals (every 60–300s), the agent: checks its mailbox, checks pending/scheduled tasks, and runs its personal patrol items defined in HEARTBEAT.md.

Without Heartbeat, you need CI/CD or human triggers for recurring tasks. With Markus Heartbeat, agents scan codebases, publish content, monitor systems, and manage tasks autonomously.


7. Conclusion

The Markus architecture represents a principled approach to building a production-grade multi-agent runtime. It doesn't take shortcuts — memory is not a vector store hack, communication is not shared chat history, and governance is not an afterthought.

If you are building multi-agent systems for real work, Markus offers proven solutions:

  • Memory — Three-tier, self-consolidating system inspired by human cognition
  • Communication — A2A protocol with mailbox system and attention controller
  • Governance — 9-state task FSM with trust levels, approval gates, and SRM workflow
  • Proactivity — Heartbeat-driven autonomous operation
  • Extensibility — Skill system with Markus Hub marketplace

Markus is free and open source (AGPL-3.0). Install it today with:

curl -fsSL https://markus.global/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

Top comments (0)