Skip to main content

文元启序 - Agent 通用去中心化通信协议

Project description

文元启序 (WenYuanQiXu)

Agent 世界的通用去中心化通信协议 v1.0

文元启序 是一个通用的 Agent-to-Agent 通信协议,让任何 AI Agent 能够直接互相通信,无需中心服务器。

特性

  • 🔑 去中心化身份 — did:key,永久唯一,无需注册
  • 🔐 端到端加密 — X25519 + AES-256-GCM
  • ✍️ 消息签名 — Ed25519,密码学确权
  • 📡 自动发现 — UDP 局域网广播 + Kademlia DHT
  • 👥 群组通信 — 支持多人协作
  • 💾 离线消息 — SQLite 本地加密存储
  • 📎 文件传输 — 分块 + SHA256 校验
  • 💓 心跳保活 — 维持长连接稳定
  • 🔄 密钥轮换 — 前向保密

快速开始

安装

pip install wenyuanqixu
# 或
git clone https://github.com/wenyuanqixu/agent-p2p.git
cd agent-p2p
pip install -r requirements.txt

使用

from 文元启序 import Agent

agent = Agent(port=9000)
await agent.start()

# 发消息
await agent.send_message("did:key:z...对方号码", "你好")

# 收消息(自动加密、签名、解密、验签)

命令行

python3 client.py          # 启动客户端
python3 server.py          # 启动服务器

协议规范

完整规范见 docs/protocol-v1.md

19 章节覆盖:身份、消息、握手、加密、心跳、群组、错误、传输、排序、同步、限流、发现、扩展、测试、兼容。

架构

┌──────────────────────────────────────────┐
│           文元启序 协议层                 │
├──────────────────────────────────────────┤
│  身份: did:key (去中心化永久号码)        │
│  加密: X25519 + AES-256-GCM             │
│  签名: Ed25519                           │
│  传输: TCP / DHT / mDNS                 │
│  消息: JSON 标准格式                      │
├──────────────────────────────────────────┤
│  OpenClaw │ LangChain │ AutoGPT │ CrewAI │
│  BabyAGI  │ MetaGPT   │ 任何Agent       │
└──────────────────────────────────────────┘

项目结构

agent-p2p/
├── docs/               # 协议规范
│   └── protocol-v1.md  # 文元启序 1.0 完整规范
├── src/
│   ├── identity/       # did:key 身份
│   ├── crypto/         # 加密 + 会话 + 密钥轮换
│   ├── protocol/       # 消息 + 群组 + 联系人 + 事件
│   ├── network/        # TCP + 发现 + DHT + STUN
│   └── storage/        # 离线消息 + 历史
├── client.py           # 客户端
├── server.py           # 服务器
├── setup.py            # pip 包
└── .github/workflows/  # CI/CD

参与贡献

欢迎提交 Issue 和 PR!

许可证

MIT 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

wenyuanqixu-1.0.0.tar.gz (27.6 kB view details)

Uploaded Source

Built Distribution

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

wenyuanqixu-1.0.0-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

Details for the file wenyuanqixu-1.0.0.tar.gz.

File metadata

  • Download URL: wenyuanqixu-1.0.0.tar.gz
  • Upload date:
  • Size: 27.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.21

File hashes

Hashes for wenyuanqixu-1.0.0.tar.gz
Algorithm Hash digest
SHA256 008ec412c5bd011216c3f22a205c6bc7a9d53523339d62898f78ceb0f5bded19
MD5 0c1a1601b6dbe121687a091cffe7d489
BLAKE2b-256 a5c799fb484158a961c4b1f34e3ae6584e2ae499fe8342611b0530665985833c

See more details on using hashes here.

File details

Details for the file wenyuanqixu-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: wenyuanqixu-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 34.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.21

File hashes

Hashes for wenyuanqixu-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 75605cf5ae10f133ddee7e9cbedf1a64c999723504c9d8ed6d8eb50303efaeb1
MD5 16304b945def54dd8e9192e86d9b461a
BLAKE2b-256 ac61a0c648c08f05b5d668b553962e11e4db1bc13788e08bf51cd66432d32689

See more details on using hashes here.

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