ISEK
ISEK copied to clipboard
[Feature Request] Add P2P Communication Support via JS libp2p
๐งฉ Motivation
To make the agent network more decentralized and resilient, we need to support peer-to-peer (P2P) communication as a core protocol layer. This allows agents and nodes to communicate directly without requiring centralized message brokers or RPC servers.
๐ Proposal
Integrate libp2p (JavaScript) into the framework to provide the following capabilities:
โ Goals
- Support P2P transport layer using
libp2p - Each Node instance can:
- Generate or load a
PeerId - Connect to other peers using
multiaddr - Expose a protocol handler (e.g.,
/a2a/1.0.0) - Send/receive messages to/from other nodes
- Generate or load a
๐ง Tasks
- Initialize
libp2pnode in ourP2PTransportclass - Implement basic stream handling (
libp2p.handle()andlibp2p.dialProtocol()) - Enable dynamic peer discovery (mDNS or Bootstrap)
- Define a custom protocol for A2A messaging (
/a2a/1.0.0) - Expose
P2PTransportas a pluggable transport forA2AProtocol
๐งช Example
const node = await createLibp2p({
peerId,
addresses: { listen: ['/webrtc'] },
transports: [webSockets(), webRTC()],
connectionEncryption: [noise()],
streamMuxers: [yamux()],
services: {
identify: identifyService(),
ping: pingService(),
},
});
node.handle('/a2a/1.0.0', ({ stream }) => {
// handle incoming A2A message
});
๐ฆ Benefits
- Enable decentralized coordination between nodes
- Eliminate dependency on centralized messaging infrastructure
- Prepare foundation for MCP (Multi-node Coordination Protocol)
๐ง References
We welcome feedback, design input, and implementation help ๐