Welcome to the Multi-Agent Coordination Protocol (MACP) Runtime documentation. This guide explains everything about the system in plain language, whether you are an experienced distributed-systems engineer or someone encountering multi-agent coordination for the first time.
The MACP Runtime — also called the Minimal Coordination Runtime (MCR) — is a gRPC server that helps multiple AI agents or programs coordinate with each other. Think of it as a traffic controller for structured conversations between autonomous agents: it manages who can speak, tracks the state of each conversation, enforces time limits, and determines when a conversation has reached its conclusion.
Version 0.3 of the runtime implements RFC-0001, introducing a formal protocol handshake, structured error reporting, a rich Decision Mode lifecycle, session cancellation, message deduplication, participant validation, mode-aware authorization, and a host of new RPCs for runtime introspection.
Imagine you are chairing a formal committee meeting:
- Someone opens the meeting — a
SessionStartmessage creates a new coordination session. - The chair announces the rules — the
Initializehandshake negotiates which protocol version everyone speaks and what capabilities the runtime supports. - Participants discuss and propose — agents send
Proposal,Evaluation,Objection, andVotemessages through the Decision Mode, orContributemessages through the Multi-Round Mode. - The committee reaches a decision — when the mode's convergence criteria are met, the session transitions to Resolved and the resolution is recorded.
- After the gavel falls, no more motions are accepted — once a session is resolved or expired, no further messages can be sent to it.
- The chair can also adjourn early — a
CancelSessioncall terminates the session before natural resolution.
The MACP Runtime manages this entire lifecycle automatically and enforces the rules at every step.
When multiple AI agents or programs need to work together, they need a way to:
- Negotiate a common protocol — agree on version, capabilities, and supported modes before any real work begins.
- Start a conversation — create a session with a declared intent, participant list, and time-to-live.
- Exchange messages safely — with deduplication, participant validation, and ordered logging.
- Track the state of the conversation — know whether it is open, resolved, or expired at any moment.
- Reach a decision — through a structured lifecycle (proposals, evaluations, votes, commitments) or through iterative convergence.
- Know when it is done — terminal states are enforced; resolved or expired sessions reject further messages.
- Cancel gracefully — terminate sessions explicitly with a recorded reason.
- Discover capabilities — query which modes are available, inspect manifests, and watch for registry changes.
Without a coordination runtime, each agent would need to implement all of this logic independently, leading to subtle bugs, inconsistent state machines, and fragile integrations. The MACP Runtime centralizes these concerns so that agents can focus on their domain logic.
The current protocol version is 1.0. Every Envelope must carry macp_version: "1.0" or the message will be rejected with UNSUPPORTED_PROTOCOL_VERSION. Before sending any session messages, clients should call the Initialize RPC to negotiate the protocol version and discover runtime capabilities.
A session is a bounded coordination context — like a conversation thread with rules. Each session has:
- A unique session ID chosen by the creator.
- A mode that defines the coordination logic (e.g.,
macp.mode.decision.v1ormacp.mode.multi_round.v1). - A current state:
Open,Resolved, orExpired. - A time-to-live (TTL) — how long the session remains open before automatic expiry (default 60 seconds, max 24 hours).
- An optional participant list — if provided, only listed senders may contribute.
- An optional resolution — the final outcome, recorded when the mode resolves the session.
- Version metadata — intent, mode_version, configuration_version, and policy_version carried from the
SessionStartPayload.
Every message is wrapped in an Envelope — a structured protobuf container that carries:
- macp_version — protocol version (
"1.0"). - mode — which coordination mode handles this message.
- message_type — the semantic type (
SessionStart,Message,Proposal,Vote,Contribute,Signal, etc.). - message_id — a unique identifier for deduplication and tracing.
- session_id — which session this belongs to (may be empty for
Signalmessages). - sender — who is sending the message.
- timestamp_unix_ms — informational timestamp.
- payload — the actual content (protobuf-encoded or JSON, depending on the mode and message type).
Every Send call returns an Ack — a structured response that tells you:
- ok —
trueif accepted,falseif rejected. - duplicate —
trueif this was an idempotent replay of a previously accepted message. - message_id and session_id — echoed back for correlation.
- accepted_at_unix_ms — server-side acceptance timestamp.
- session_state — the session's state after processing (OPEN, RESOLVED, EXPIRED).
- error — a structured
MACPErrorwith an RFC error code, human-readable message, and optional details.
Sessions follow a strict state machine with three states:
| State | Can receive messages? | Transitions to |
|---|---|---|
| Open | Yes | Resolved, Expired |
| Resolved | No (terminal) | — |
| Expired | No (terminal) | — |
- Open — the session is active and accepting messages. This is the initial state after
SessionStart. - Resolved — a mode returned a
ResolveorPersistAndResolveresponse, recording the final outcome. No further messages are accepted. - Expired — the session's TTL elapsed (detected lazily on the next message), or the session was explicitly cancelled via
CancelSession. No further messages are accepted.
Modes are pluggable coordination strategies. The runtime provides the "physics" — session invariants, logging, TTL enforcement, routing — while modes provide the "coordination logic" — when to resolve, what state to track, and what convergence criteria to apply.
Two modes are built in:
| Mode Name | Aliases | Description |
|---|---|---|
macp.mode.decision.v1 |
decision |
RFC-compliant decision lifecycle: Proposal → Evaluation → Objection → Vote → Commitment |
macp.mode.multi_round.v1 |
multi_round |
Participant-based convergence using all_equal strategy (experimental, not on discovery surfaces) |
An empty mode field defaults to macp.mode.decision.v1 for backward compatibility.
Signal messages are ambient, session-less messages. They can be sent with an empty session_id and do not create or modify any session. They are useful for out-of-band coordination hints, heartbeats, or cross-session correlation.
Client MACP Runtime
| |
|--- Initialize(["1.0"]) ------------>|
|<-- InitializeResponse(v=1.0) -------| (handshake complete)
| |
|--- Send(SessionStart, s1) --------->|
|<-- Ack(ok=true, state=OPEN) --------| (session created)
| |
|--- Send(Proposal, s1) ------------->|
|<-- Ack(ok=true, state=OPEN) --------| (proposal recorded)
| |
|--- Send(Vote, s1) ----------------->|
|<-- Ack(ok=true, state=OPEN) --------| (vote recorded)
| |
|--- Send(Commitment, s1) ----------->|
|<-- Ack(ok=true, state=RESOLVED) ----| (session resolved)
| |
|--- Send(Message, s1) -------------->|
|<-- Ack(ok=false, SESSION_NOT_OPEN) -| (rejected: terminal)
| |
|--- GetSession(s1) ----------------->|
|<-- SessionMetadata(RESOLVED) -------| (query state)
- gRPC over HTTP/2 — high-performance, type-safe RPC framework with streaming support.
- Protocol Buffers (protobuf) — binary serialization for efficient, schema-enforced message exchange.
- Rust — memory-safe, concurrent systems language with zero-cost abstractions.
- Tonic — Rust's async gRPC framework built on Tokio.
- Buf — protobuf linting and breaking-change detection.
You do not need to know Rust to understand the protocol or use the runtime — any language with a gRPC client can connect.
This runtime consists of:
- Runtime Server (
macp-runtime) — the main coordination server managing sessions, modes, and protocol enforcement. - Basic Client (
client) — a demo client exercising the happy path: Initialize, ListModes, SessionStart, Message, Resolve, GetSession. - Fuzz Client (
fuzz_client) — a comprehensive test client exercising every error path, every new RPC, participant validation, signal messages, cancellation, and multi-round convergence. - Multi-Round Client (
multi_round_client) — a focused demo of multi-round convergence with two participants reaching agreement.
| Document | What It Covers |
|---|---|
| protocol.md | Full MACP v1.0 protocol specification — message types, validation rules, error codes, mode specifications |
| architecture.md | Internal architecture — component design, data flow, concurrency model, design principles |
| examples.md | Step-by-step usage examples — client walkthroughs, common patterns, FAQ |
Terminal 1 — Start the server:
cargo runYou should see:
macp-runtime v0.3.0 (RFC-0001) listening on 127.0.0.1:50051
Terminal 2 — Run a test client:
cargo run --bin clientYou will see the client negotiate the protocol version, discover modes, create a session, send messages, resolve the session, and verify the final state.
- Read protocol.md to understand the full MACP v1.0 protocol specification.
- Read architecture.md to understand how the runtime is built internally.
- Read examples.md for practical, step-by-step usage examples.