Skip to main content

Signed protobuf packets over TCP for AI agent-to-agent communication

Project description

keep-protocol

Signed protobuf packets over TCP for AI agent-to-agent communication.

License: MIT Build

Keep is the quiet pipe agents whisper through. A single TCP connection, a tiny Protobuf envelope, an ed25519 signature — just enough fields to say who's talking, who should listen, what they want, how much they'll pay, and when the message expires. Unsigned packets vanish without a trace. Signed ones get heard.


Install

Python SDK

pip install keep-protocol
from keep.client import KeepClient

client = KeepClient("localhost", 9009)
reply = client.send(
    src="bot:my-agent",
    dst="server",
    body="hello from my agent",
)
print(reply.body)  # "done"

Run the Server

Docker (recommended):

docker run -d -p 9009:9009 --name keep ghcr.io/clcrawford-dev/keep-server:latest

From source:

git clone https://github.com/CLCrawford-dev/keep-protocol.git
cd keep-protocol
go build -o keep .
./keep  # listens on :9009

Verify It Works

pip install keep-protocol
python -c "
from keep.client import KeepClient
reply = KeepClient('localhost', 9009).send(body='ping')
print('OK' if reply.body == 'done' else 'FAIL')
"

Why Keep?

Feature Keep HTTP/REST gRPC NATS
Latency Sub-ms (TCP) 1-10ms 1-5ms 1-5ms
Auth ed25519 built-in Bring your own mTLS Tokens
Schema 10 fields, done Unlimited Unlimited None
Setup 1 binary, 0 config Web server + routes Codegen + server Broker cluster
Agent-native Yes No No Partial
Spam resistance fee + ttl fields None None None

Keep is not a replacement for gRPC or NATS. It is a protocol for agents that need to find each other and exchange signed intent with minimal ceremony.


Packet Schema

message Packet {
  bytes  sig  = 1;   // ed25519 signature (64 bytes)
  bytes  pk   = 2;   // sender's public key (32 bytes)
  uint32 typ  = 3;   // 0=ask, 1=offer, 2=heartbeat
  string id   = 4;   // unique message ID
  string src  = 5;   // sender: "bot:my-agent" or "human:chris"
  string dst  = 6;   // destination: "server", "nearest:weather", "swarm:planner"
  string body = 7;   // intent or payload
  uint64 fee  = 8;   // micro-fee in sats (anti-spam)
  uint32 ttl  = 9;   // time-to-live in seconds
  bytes  scar = 10;  // gitmem-style memory commit (optional)
}

Signing Protocol

Identity is a keypair. No accounts, no registration.

Sending a signed packet

  1. Build a Packet with all fields — leave sig and pk empty
  2. Serialize to bytes — this is the sign payload
  3. Sign those bytes with your ed25519 private key
  4. Set sig (64 bytes) and pk (32 bytes) on the Packet
  5. Serialize the full Packet — send over TCP

Server verification

  1. Unmarshal the incoming bytes into a Packet
  2. If sig and pk are empty — DROPPED (logged, no reply)
  3. Copy all fields except sig/pk into a new Packet, serialize it
  4. Verify the signature against those bytes using the sender's pk
  5. If invalid — DROPPED (logged, no reply)
  6. If valid — process the message, send done reply

Examples

See the examples/ directory:


Use Cases

  • Local swarm — agents on same VM use localhost:9009 for zero-latency handoff
  • Relay swarm — agents publish to public relays — relays enforce fee/ttl/reputation
  • Memory sharingscar field carries gitmem-style commits — agents barter knowledge
  • Anti-spam marketfee field creates micro-economy — pay to get priority

Design Principles

  • Silent rejection — unsigned senders don't know if the server exists
  • Identity without accounts — your keypair is your identity
  • Full visibility — dropped packets are logged server-side
  • Minimal overhead — protobuf over raw TCP, no HTTP/JSON
  • Semantic routingdst is a name, not an address

Contributing

We welcome contributions. See CONTRIBUTING.md for guidelines.

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keep_protocol-0.1.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

keep_protocol-0.1.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file keep_protocol-0.1.1.tar.gz.

File metadata

  • Download URL: keep_protocol-0.1.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for keep_protocol-0.1.1.tar.gz
Algorithm Hash digest
SHA256 30d1785807796446ad91b34dd72b1e4df8dabe93c2eb06579b7d13fb20f56288
MD5 3c49ebf703adc1518241c48564968f97
BLAKE2b-256 5c44470766859f9274fad8e13cfd0eb805ff86336e378677ff7c2cc8c70b548c

See more details on using hashes here.

Provenance

The following attestation bundles were made for keep_protocol-0.1.1.tar.gz:

Publisher: ci.yml on CLCrawford-dev/keep-protocol

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file keep_protocol-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: keep_protocol-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for keep_protocol-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a3524ab56631db841c7117622ced4e556a0d95049d2c01b7440c111069e12e62
MD5 1f9de4227879fc980db3fe6b613e756f
BLAKE2b-256 3f66709bcf620badf4ef2b382e0dca68bfb8aca9f2a5abc74682d6e16266fe29

See more details on using hashes here.

Provenance

The following attestation bundles were made for keep_protocol-0.1.1-py3-none-any.whl:

Publisher: ci.yml on CLCrawford-dev/keep-protocol

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page