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.1.tar.gz (27.7 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.1-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wenyuanqixu-1.0.1.tar.gz
  • Upload date:
  • Size: 27.7 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.1.tar.gz
Algorithm Hash digest
SHA256 e2e2c366ede0ee8a3cd6a186195d64bb00fb265cb8dead2647971b3a66a42cc3
MD5 fb556731efd151fd4ea45e18281a71cf
BLAKE2b-256 a5bc32e6ecf2b9a3a0f0f0aee45d48a240dc6fa30622d29b64492a13d91c3d8b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wenyuanqixu-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ff4485be7d0ce1b5e94ca217c2734f214f50a9a9658f04654b88244141e5419f
MD5 8de1918077895755a7687e3a3dc8e3eb
BLAKE2b-256 1f08b41058582eff78721c9cffda80171f66ef6de13f1d0491c539eda4ea67d1

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