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.0.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.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: keep_protocol-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 fec77a076f9e399cf63b158d9f38e8d9bf1567f377ffbdd515bf230c23c23ca5
MD5 1ef5915a887f624861a495dabac51c03
BLAKE2b-256 94346e7a7d0ccabcae36836005ed238b480c61801977dd1524ca3f53584b475a

See more details on using hashes here.

Provenance

The following attestation bundles were made for keep_protocol-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: keep_protocol-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8330307519b8058d0918cf981b086b743cca158fe25a4e07a84f568c409f1fef
MD5 32c13756002910a6f7a25ce76baf107a
BLAKE2b-256 af05bc4a7bc5f47840cd9ad10f0a6303cdf0db6ffe4c7950bb9cb195b079fe84

See more details on using hashes here.

Provenance

The following attestation bundles were made for keep_protocol-0.1.0-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