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.
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
- Build a
Packetwith all fields — leavesigandpkempty - Serialize to bytes — this is the sign payload
- Sign those bytes with your ed25519 private key
- Set
sig(64 bytes) andpk(32 bytes) on the Packet - Serialize the full Packet — send over TCP
Server verification
- Unmarshal the incoming bytes into a
Packet - If
sigandpkare empty — DROPPED (logged, no reply) - Copy all fields except
sig/pkinto a new Packet, serialize it - Verify the signature against those bytes using the sender's
pk - If invalid — DROPPED (logged, no reply)
- If valid — process the message, send
donereply
Examples
See the examples/ directory:
- python_basic.py — Minimal SDK usage
- python_raw.py — Raw TCP + signing without the SDK (educational)
- mcp_tool_definition.py — Expose keep as an MCP tool
Use Cases
- Local swarm — agents on same VM use
localhost:9009for zero-latency handoff - Relay swarm — agents publish to public relays — relays enforce fee/ttl/reputation
- Memory sharing —
scarfield carries gitmem-style commits — agents barter knowledge - Anti-spam market —
feefield 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 routing —
dstis 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fec77a076f9e399cf63b158d9f38e8d9bf1567f377ffbdd515bf230c23c23ca5
|
|
| MD5 |
1ef5915a887f624861a495dabac51c03
|
|
| BLAKE2b-256 |
94346e7a7d0ccabcae36836005ed238b480c61801977dd1524ca3f53584b475a
|
Provenance
The following attestation bundles were made for keep_protocol-0.1.0.tar.gz:
Publisher:
ci.yml on CLCrawford-dev/keep-protocol
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
keep_protocol-0.1.0.tar.gz -
Subject digest:
fec77a076f9e399cf63b158d9f38e8d9bf1567f377ffbdd515bf230c23c23ca5 - Sigstore transparency entry: 898643711
- Sigstore integration time:
-
Permalink:
CLCrawford-dev/keep-protocol@d7d8c23897616186bca4ca0d6f85b0a76cb12335 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/CLCrawford-dev
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@d7d8c23897616186bca4ca0d6f85b0a76cb12335 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8330307519b8058d0918cf981b086b743cca158fe25a4e07a84f568c409f1fef
|
|
| MD5 |
32c13756002910a6f7a25ce76baf107a
|
|
| BLAKE2b-256 |
af05bc4a7bc5f47840cd9ad10f0a6303cdf0db6ffe4c7950bb9cb195b079fe84
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
keep_protocol-0.1.0-py3-none-any.whl -
Subject digest:
8330307519b8058d0918cf981b086b743cca158fe25a4e07a84f568c409f1fef - Sigstore transparency entry: 898643764
- Sigstore integration time:
-
Permalink:
CLCrawford-dev/keep-protocol@d7d8c23897616186bca4ca0d6f85b0a76cb12335 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/CLCrawford-dev
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@d7d8c23897616186bca4ca0d6f85b0a76cb12335 -
Trigger Event:
push
-
Statement type: