Skip to content

The basic runtime for MACP#1

Merged
ajit-zer07 merged 5 commits intomainfrom
initial-runtime
Mar 5, 2026
Merged

The basic runtime for MACP#1
ajit-zer07 merged 5 commits intomainfrom
initial-runtime

Conversation

@ajit-zer07
Copy link
Contributor


PR Title

Implement MACP v0.1 Minimal Coordination Runtime

Summary

Introduces the core gRPC-based runtime for the Multi-Agent Coordination Protocol (MACP). This is the foundational implementation that provides session-based
message coordination between agents using a pluggable Mode system.

What's included

  • gRPC service layer — MACPService with SendMessage and GetSession RPCs, defined in proto/macp.proto and served via Tonic on 127.0.0.1:50051
  • Runtime kernel (src/runtime.rs) — Orchestrates validate → log → mode dispatch → apply response, serving as the central coordination engine
  • Pluggable Mode system (src/mode/) — A Mode trait with ModeResponse enum enabling extensible coordination strategies:
    • DecisionMode — Simple resolve-on-keyword mode
    • MultiRoundMode — Participant-based convergence with all_equal strategy
  • Session management — Thread-safe SessionRegistry with configurable TTL (default 60s, max 24h), lazy expiration, and state transitions (Open → Resolved/Expired)
  • Append-only log store (src/log_store.rs) — Per-session event logging with Incoming and Internal entry types
  • Comprehensive error handling (src/error.rs) — MacpError enum covering all validation and state errors
  • Demo/test clients — Three binary clients exercising happy paths, error paths, and multi-round convergence
  • Documentation — Architecture guide, protocol spec, and usage examples in docs/

Architecture highlights

  • The runtime provides "physics" (session invariants, logging, TTL, routing) while Modes provide coordination logic
  • Log-before-mutate ordering ensures auditability
  • Write lock held for entire message processing (noted as a future optimization opportunity)
  • No background cleanup yet — expired sessions remain in memory until restart

Test plan

  • cargo build compiles successfully
  • cargo test — all unit tests pass
  • cargo clippy — no warnings
  • cargo run starts the gRPC server on :50051
  • cargo run --bin client — basic decision mode demo succeeds
  • cargo run --bin fuzz_client — error path coverage passes
  • cargo run --bin multi_round_client — multi-round convergence demo succeeds

@ajit-zer07 ajit-zer07 merged commit 74e1131 into main Mar 5, 2026
7 checks passed
@ajit-zer07 ajit-zer07 deleted the initial-runtime branch March 17, 2026 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant