# Send AgentMesh to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "agentmesh",
    "name": "AgentMesh",
    "source": "tencent",
    "type": "skill",
    "category": "通讯协作",
    "sourceUrl": "https://clawhub.ai/cerbug45/agentmesh",
    "canonicalUrl": "https://clawhub.ai/cerbug45/agentmesh",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/agentmesh",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=agentmesh",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "examples/01_simple_chat.py",
      "examples/02_multi_agent.py",
      "examples/03_persistent_keys.py",
      "examples/04_llm_agents.py"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "agentmesh",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-29T01:43:59.218Z",
      "expiresAt": "2026-05-06T01:43:59.218Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=agentmesh",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=agentmesh",
        "contentDisposition": "attachment; filename=\"agentmesh-0.1.1.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "agentmesh"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/agentmesh"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/agentmesh",
    "downloadUrl": "https://openagent3.xyz/downloads/agentmesh",
    "agentUrl": "https://openagent3.xyz/skills/agentmesh/agent",
    "manifestUrl": "https://openagent3.xyz/skills/agentmesh/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/agentmesh/agent.md"
  }
}
```
## Documentation

### AgentMesh SKILL.md

WhatsApp-style end-to-end encrypted messaging for AI agents.
GitHub: https://github.com/cerbug45/AgentMesh | Author: cerbug45

### What Is AgentMesh?

AgentMesh gives every AI agent a cryptographic identity and lets agents
exchange messages that are:

PropertyMechanismEncryptedAES-256-GCM authenticated encryptionAuthenticatedEd25519 digital signatures (per message)Forward-secretX25519 ECDH ephemeral session keysTamper-proofAEAD authentication tagReplay-proofNonce + counter deduplicationPrivateThe Hub (broker) never sees message contents

No TLS certificates. No servers required for local use. One pip install.

### Requirements

Python 3.10 or newer
pip

### Option 1 – Install from GitHub (recommended)

pip install git+https://github.com/cerbug45/AgentMesh.git

### Option 2 – Clone and install locally

git clone https://github.com/cerbug45/AgentMesh.git
cd AgentMesh
pip install .

### Option 3 – Development install (editable, with tests)

git clone https://github.com/cerbug45/AgentMesh.git
cd AgentMesh
pip install -e ".[dev]"
pytest           # run all tests

### Verify installation

python -c "import agentmesh; print(agentmesh.__version__)"
# → 1.0.0

### Quick Start (5 minutes)

from agentmesh import Agent, LocalHub

hub   = LocalHub()                  # in-process broker
alice = Agent("alice", hub=hub)     # keys generated automatically
bob   = Agent("bob",   hub=hub)

@bob.on_message
def handle(msg):
    print(f"[{msg.recipient}] ← {msg.sender}: {msg.text}")

alice.send("bob", text="Hello, Bob! This is end-to-end encrypted.")

Output:

[bob] ← alice: Hello, Bob! This is end-to-end encrypted.

### Agent

An Agent is an AI agent with a cryptographic identity (two key pairs):

Ed25519 identity key – signs every outgoing message
X25519 exchange key – used for ECDH session establishment

from agentmesh import Agent, LocalHub

hub   = LocalHub()
alice = Agent("alice", hub=hub)

# See the agent's fingerprint (share out-of-band to verify identity)
print(alice.fingerprint)
# → a1b2:c3d4:e5f6:g7h8:i9j0:k1l2:m3n4:o5p6

### Hub

A Hub is the message router. It stores public key bundles (for discovery)
and routes encrypted envelopes. It cannot decrypt messages.

HubUse caseLocalHubSingle Python process (demos, tests, notebooks)NetworkHubMulti-process / multi-machine (production)

### Message

@bob.on_message
def handle(msg):
    msg.sender     # str  – sender agent_id
    msg.recipient  # str  – recipient agent_id
    msg.text       # str  – shortcut for msg.payload["text"]
    msg.type       # str  – shortcut for msg.payload["type"] (default: "message")
    msg.payload    # dict – full decrypted payload
    msg.timestamp  # int  – milliseconds since epoch

### Sending messages with extra data

alice.send(
    "bob",
    text     = "Run this task",
    task_id  = 42,
    priority = "high",
    data     = {"key": "value"},
)

All keyword arguments beyond text are included in msg.payload.

### Chaining handlers

# Handler as decorator
@alice.on_message
def handler_one(msg):
    ...

# Handler as lambda
alice.on_message(lambda msg: print(msg.text))

# Multiple handlers – all called in registration order
alice.on_message(log_handler)
alice.on_message(process_handler)

### Persistent keys

Save keys to disk so an agent has the same identity across restarts:

alice = Agent("alice", hub=hub, keypair_path=".keys/alice.json")

File is created on first run (new keys).
File is loaded on subsequent runs (same keys = same fingerprint).
Store this file securely – it contains the private key.

### Peer discovery

# List all agents registered on the hub
peers = alice.list_peers()   # → ["bob", "carol", "dave"]

# Check agent status
print(alice.status())
# {
#   "agent_id": "alice",
#   "fingerprint": "a1b2:…",
#   "active_sessions": ["bob"],
#   "known_peers": ["bob"],
#   "handlers": 2
# }

### 1. Start the hub server

On the broker machine (or in its own terminal):

# Option A – module
python -m agentmesh.hub_server --host 0.0.0.0 --port 7700

# Option B – entry-point (after pip install)
agentmesh-hub --host 0.0.0.0 --port 7700

### 2. Agents connect from anywhere

# Machine A
from agentmesh import Agent, NetworkHub
hub   = NetworkHub(host="192.168.1.10", port=7700)
alice = Agent("alice", hub=hub)

# Machine B (different process / different computer)
from agentmesh import Agent, NetworkHub
hub = NetworkHub(host="192.168.1.10", port=7700)
bob = Agent("bob", hub=hub)

bob.on_message(lambda m: print(m.text))
alice.send("bob", text="Cross-machine encrypted message!")

### Network hub architecture

┌──────────────────────────────────────────────────────┐
│                   NetworkHubServer                   │
│  Stores public bundles.  Routes encrypted envelopes. │
│  Cannot read message contents.                       │
└──────────────────────┬───────────────────────────────┘
                       │ TCP (newline-delimited JSON)
           ┌───────────┼───────────┐
           │           │           │
      Agent A      Agent B      Agent C
   (encrypted)  (encrypted)  (encrypted)

### Cryptographic stack

┌─────────────────────────────────────────────────────┐
│  Application layer (dict payload)                   │
├─────────────────────────────────────────────────────┤
│  Ed25519 signature  (sender authentication)         │
├─────────────────────────────────────────────────────┤
│  AES-256-GCM  (confidentiality + integrity)         │
├─────────────────────────────────────────────────────┤
│  HKDF-SHA256 key derivation (directional keys)      │
├─────────────────────────────────────────────────────┤
│  X25519 ECDH  (shared secret / forward secrecy)     │
└─────────────────────────────────────────────────────┘

### Security properties

AttackDefenceEavesdroppingAES-256-GCM encryptionMessage tamperingAES-GCM authentication tag (AEAD)ImpersonationEd25519 signature on every messageReplay attackNonce + monotonic counter deduplicationKey compromiseX25519 ephemeral sessions (forward secrecy)Hub compromiseHub stores only public keys; cannot decrypt

### What the Hub can see

✅ Agent IDs (to route messages)
✅ Public key bundles (required for discovery)
✅ Metadata: sender, recipient, timestamp, message counter
❌ Message contents (always encrypted)
❌ Payload data (always encrypted)

### Examples

FileWhat it showsexamples/01_simple_chat.pyTwo agents, basic send/receiveexamples/02_multi_agent.pyCoordinator + 4 workers, task distributionexamples/03_persistent_keys.pyKeys saved to disk, identity survives restartexamples/04_llm_agents.pyLLM agents (OpenAI / any API) in a pipeline

Run any example:

python examples/01_simple_chat.py

### Agent(agent_id, hub=None, keypair_path=None, log_level=WARNING)

MethodDescriptionsend(recipient_id, text="", **kwargs)Send encrypted messagesend_payload(recipient_id, payload: dict)Low-level sendon_message(handler)Register message handler (decorator or call)connect(peer_id)Pre-establish session (optional, auto-connects)connect_with_bundle(bundle)P2P: connect using public bundle directlylist_peers()List all peer IDs on the hubstatus()Dict with agent statefingerprintHuman-readable hex identity fingerprintpublic_bundleDict with public keys (share with peers)

### LocalHub()

MethodDescriptionregister(agent)Register an agent (called automatically)deliver(envelope)Route an encrypted envelopeget_bundle(agent_id)Get a peer's public bundlelist_agents()List all registered agent IDsmessage_count()Number of messages routed

### NetworkHub(host, port=7700)

Same interface as LocalHub, but communicates with a NetworkHubServer over TCP.

### NetworkHubServer(host="0.0.0.0", port=7700)

MethodDescriptionstart(block=True)Start listening (block=False for background thread)

### Low-level crypto (advanced)

from agentmesh.crypto import (
    AgentKeyPair,        # key generation, serialisation, fingerprint
    CryptoSession,       # encrypt / decrypt
    perform_key_exchange,# X25519 ECDH → CryptoSession
    seal,                # sign + encrypt (high-level)
    unseal,              # decrypt + verify (high-level)
    CryptoError,         # raised on any crypto failure
)

### CryptoError: Replay attack detected

You are sending the same encrypted envelope twice.
Each call to send() produces a fresh envelope – do not re-use envelopes.

### CryptoError: Authentication tag mismatch

The envelope was modified in transit.
Check that your transport does not corrupt binary data (use JSON-safe base64).

### ValueError: Peer 'xxx' not found on hub

The recipient has not registered with the hub yet.
Ensure both agents are created with the same hub instance (LocalHub) or
connected to the same hub server (NetworkHub).

### RuntimeError: No hub configured

You created Agent("name") without a hub.
Pass hub=LocalHub() or hub=NetworkHub(...) to the constructor.

### Contributing

git clone https://github.com/cerbug45/AgentMesh.git
cd AgentMesh
pip install -e ".[dev]"
pytest -v

Issues and PRs welcome at https://github.com/cerbug45/AgentMesh/issues

### License

MIT © cerbug45 – see LICENSE
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: cerbug45
- Version: 0.1.1
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-04-29T01:43:59.218Z
- Expires at: 2026-05-06T01:43:59.218Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/agentmesh)
- [Send to Agent page](https://openagent3.xyz/skills/agentmesh/agent)
- [JSON manifest](https://openagent3.xyz/skills/agentmesh/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/agentmesh/agent.md)
- [Download page](https://openagent3.xyz/downloads/agentmesh)