Multi-Agent Protocol (MAP) - A protocol for observing, coordinating, and routing messages within multi-agent AI systems
npm install multi-agent-protocolA JSON-RPC based protocol for observing, coordinating, and routing messages within multi-agent AI systems.
Unlike protocols designed for single-agent interaction (ACP) or peer-to-peer agent delegation (A2A), MAP provides a window into a multi-agent system with visibility into its internal structure, agent relationships, and message flows.
MAP provides a standardized way for:
- Clients to observe and interact with agent systems (with configurable visibility)
- Agents to communicate, form hierarchies, and join scopes
- Systems to federate and route messages across boundaries
| Protocol | Relationship | Visibility | Primary Use |
|----------|--------------|------------|-------------|
| MCP | Agent → Tool | N/A | Tool invocation |
| ACP | Client → Agent | Opaque | Single-agent sessions |
| A2A | Agent → Agent (peer) | Opaque | Cross-org delegation |
| MAP | Client → System | Transparent | Internal orchestration |
| Package | Description |
|---------|-------------|
| @multi-agent-protocol/sdk | TypeScript SDK for MAP |
``bash`
npm install @multi-agent-protocol/sdk
`typescript
import { ClientConnection, createStreamPair } from '@multi-agent-protocol/sdk';
// Connect to a MAP server
const client = new ClientConnection(stream, { name: 'My Client' });
await client.connect();
// Subscribe to events
const subscription = await client.subscribe({
eventTypes: ['agent.registered', 'agent.state.changed'],
});
for await (const event of subscription) {
console.log(event.type, event.data);
}
`
- Real-time streaming - Subscribe to events with backpressure support
- Auto-reconnection - Exponential backoff with subscription restoration
- Permission system - 4-layer access control (system, participant, scope, agent)
- Federation - Connect multiple MAP systems with envelope-based routing
- Causal ordering - Events released in dependency order
The protocol schema is defined in schema/:
- schema.json - Complete JSON Schema for all MAP message types
- meta.json - Method metadata, tiers, and error codes
``
multi-agent-protocol/
├── docs/ # Design specifications
├── schema/ # JSON Schema and metadata
│ ├── schema.json # Protocol message schemas
│ └── meta.json # Method tiers and error codes
└── ts-sdk/ # TypeScript SDK implementation
├── src/ # Source code
└── docs/ # SDK-specific docs (gap analysis)
`bashInstall dependencies
npm install
Protocol Methods
The protocol defines 27 methods across three tiers:
Core (Required):
map/connect, map/disconnect, map/send, map/subscribe, map/unsubscribe, map/agents/list, map/agents/getStructure (Recommended): Agent lifecycle (
register, spawn, unregister, update, stop, suspend, resume), scope management (scopes/create, join, leave), and structure queriesExtensions (Optional): Federation (
federation/connect, federation/route), session management, and steering (map/inject`)MIT
Created and maintened by the sudocode team.