Semantic Interoperability Layer for AI Agents β a lightweight extension of MCP (Model Context Protocol) built for the era of agentic AI meshes.
Status: Active development β v0.1 core is stable. See docs/plans/ for the current implementation roadmap.
Agent Semantic Protocol enables AI agents to communicate by meaning, not schema. Instead of exchanging rigid JSON tool calls, agents share semantic intent vectors β compact float32 embeddings that describe goals in a shared latent space. Any agent that understands the vector space can negotiate, delegate, and collaborate β without pre-registered APIs.
| Concept | Description |
|---|---|
| Intent Vector | A []float32 embedding (e.g. 384-dim sentence-transformer) that encodes the semantic goal of a request |
| Spontaneous Negotiation | Agents advertise capabilities and bid on intents without a central broker |
| Dynamic Discovery | A TTL-based capability registry lets agents appear/disappear at runtime |
| Federated Trust (DIDs) | Each agent has a did:agent-semantic-protocol:<sha256(pubkey)> identifier backed by an Ed25519 key-pair |
| Distributed Workflows | Accepted intents unfold into ordered workflow steps, dispatched across capable peers via libp2p |
| Feature | MCP (Anthropic) | Google A2A | Agent Semantic Protocol |
|---|---|---|---|
| Message format | JSON-RPC 2.0 | JSON (task objects) | Protobuf wire + intent vectors |
| Capability model | Static tool registry | Static skill cards | Dynamic, TTL-based discovery |
| Negotiation | None (direct call) | None | Spontaneous cosine-similarity ranking |
| Identity / trust | None | None | Ed25519 DIDs, federated trust graph |
| Transport | HTTP/SSE | HTTP | libp2p (TCP/QUIC/WebRTC) |
| Peer topology | Clientβserver | Clientβserver | P2P mesh |
| Semantic routing | No | No | Yes (vector similarity) |
| Distributed workflows | No | Task delegation only | Yes (multi-step, multi-agent) |
agent-semantic-protocol/
βββ proto/agent-semantic-protocol.proto # Protobuf message definitions (reference)
βββ core/
β βββ types.go # Go struct definitions
β βββ encoding.go # Protobuf wire encode/decode (no codegen required)
β βββ did.go # DID generation, verification, trust graph
β βββ handshake.go # Cryptographic handshake protocol
β βββ negotiation.go # Intent negotiation + cosine ranking
β βββ discovery.go # Capability discovery registry
β βββ encoding_test.go # Unit tests (encoding, DID, cosine, discovery)
β βββ signing_test.go # Unit tests (per-message Ed25519 signing)
βββ p2p/
β βββ host.go # libp2p AgentHost wrapper
β βββ host_test.go # Integration tests (handshake, intent, announce)
β βββ protocol.go # WorkflowOrchestrator, convenience helpers
βββ picoclaw/
β βββ client.go # Adapter for Picoclaw AI assistant API
βββ examples/
β βββ simple-handshake/main.go # Two agents handshake over TCP
β βββ negotiation-demo/main.go # Full intent β negotiation β workflow loop
βββ docs/
β βββ spec.md # Protocol specification
β βββ plans/ # Versioned implementation plans
βββ .github/workflows/ci.yml # GitHub Actions CI
gitgit clone https://github.com/agent-semantic-protocol-protocol/agent-semantic-protocol
cd agent-semantic-protocol
go mod download # fetch all dependencies (including libp2p)
# Run the handshake demo
go run ./examples/simple-handshake/main.go
# Run the negotiation + workflow demo
go run ./examples/negotiation-demo/main.go
ββββββββββββββββββββββββββββββββββββββββββββββββ
β Agent Semantic Protocol v0.1 β Simple Handshake Demo β
ββββββββββββββββββββββββββββββββββββββββββββββββ
β Agent Alpha started
Peer ID : 12D3KooW...
DID : did:agent-semantic-protocol:3a7f...
Caps : [nlp reasoning intent-parsing]
β Agent Beta started
...
ββ Performing Agent Semantic Protocol Handshake βββββββββββββββββββββββββββββββββββββ
[Beta] β Handshake from "agent-alpha" caps=[nlp reasoning intent-parsing]
[Alpha] β Handshake complete!
Peer caps : [code-generation math vector-search storage]
Protocol : 1.0.0
make test
# or: go test -v -race ./...
import (
"github.com/agent-semantic-protocol-protocol/agent-semantic-protocol/core"
"github.com/agent-semantic-protocol-protocol/agent-semantic-protocol/p2p"
)
// 1. Create an agent identity
agent, _ := core.NewAgent("my-agent", []string{"nlp", "summarisation"})
// 2. Start a P2P host
host, _ := p2p.NewHost(ctx, agent)
// 3. Register intent handler
host.OnIntent(func(peerID peer.ID, intent *core.IntentMessage) *core.NegotiationResponse {
h := core.DefaultNegotiationHandler(agent)
resp, _ := h(intent)
return resp
})
// 4. Send an intent to a known peer
intent, _ := core.CreateIntent(agent,
[]float32{0.8, 0.2, 0.9}, // embedding
[]string{"summarisation"},
"Summarise this document",
)
resp, _ := host.SendIntent(ctx, targetPeerID, intent)
bus := core.NewNegotiationBus()
bus.Register("agent-b", core.DefaultNegotiationHandler(agentB))
intent, _ := core.CreateIntent(agentA, vector, []string{"code-generation"}, payload)
resp, _ := bus.Negotiate("agent-b", intent)
client := picoclaw.NewClient("https://api.picoclaw.io",
picoclaw.WithAPIKey("pk_..."),
picoclaw.WithAgentID("my-picoclaw-agent"),
)
// Register as a Agent Semantic Protocol negotiation handler
bus.Register("picoclaw", client.AsNegotiationHandler())
The core/ package uses protowire directly and does not require generated code. If you want the generated *.pb.go files for gRPC or reflection:
make proto # requires protoc + protoc-gen-go
make test and make lint β all must pass.feat:, fix:, docs:, β¦).Please read docs/spec.md before proposing wire-format changes β backward compatibility is critical.
| Version | Feature | Status |
|---|---|---|
| v0.1 | Core protocol, handshake, negotiation, discovery, p2p transport | β |
| v0.1 | Capability announcement handling in P2P (MsgCapability β DiscoveryRegistry) |
β |
| v0.1 | P2P integration tests (handshake, intent accept/reject, announce) | β |
| v0.1 | Per-message Ed25519 signing (IntentMessage, NegotiationResponse) |
β |
| Version | Feature |
|---|---|
| v0.2 | QUIC transport (pending quic-go TLS session-ticket fix), WebRTC support |
| v0.2 | Signature verification on receive (currently signed but not verified on inbound) |
| v0.3 | Federated DID resolution (DID document over DHT), zk-SNARK capability proofs |
| v1.0 | Stable wire format, MCP gateway adapter, multi-language SDKs (Python, TypeScript) |
See docs/plans/ for detailed implementation plans with exact file paths and test commands.
MIT β see LICENSE.