Skip to main content

Cryptographic peer-to-peer agent coordination (Python bindings for agent-mesh)

Project description

agent-mesh

agent-mesh

Cryptographic peer-to-peer agent coordination.

No broker. No scp'd tokens. No centralized configuration.

CI PyPI License


A small Rust workspace that gives multi-agent systems a shared root of trust (ed25519 user key, cross-signed by your existing GitHub SSH key) and direct, verifiable peer messaging.

Two agents that share a user identity discover each other on the LAN, authenticate via cert chain at the QUIC handshake, and exchange signed envelopes — without a broker in the middle and without scp'ing tokens around.

CLI: amesh (workspace member agent-mesh-cli). Libraries:

  • agent-mesh-core — identity types, signed envelopes.
  • agent-mesh-discovery — LAN discovery via mDNS.
  • agent-mesh-transport — authenticated QUIC transport via iroh.
  • agent-mesh-bus — high-level pub/sub + request/reply.
  • agent-mesh-py — Python bindings (PyPI package agent-mesh).

License: Apache-2.0.

Python install

pip install newt-agent-mesh

(The PyPI distribution name is newt-agent-mesh because agent-mesh is blocked by PyPI's similarity check — see the note in pyproject.toml. The Python import path is unchanged: import agent_mesh.core.)

This installs the Python package agent_mesh with submodules .core, .discovery, .transport, .bus. The amesh CLI binary ships separately — install it with cargo install --path agent-mesh-cli if you want it on $PATH.

Discovery (Phase 1)

amesh can announce itself on the LAN and list every other agent it sees there, with no broker or central registry. Service type: _agent-mesh._udp.local.

# Terminal A — announce this agent for 5 minutes, advertising
# `ollama` and `vllm` capabilities under the role `inference-worker`.
amesh announce --capability ollama --capability vllm \
                --role inference-worker --duration 5m

# Terminal B — list everyone on the LAN for the next 5 seconds.
amesh peers --listen 5s

# Or only those sharing our user fingerprint:
amesh peers --listen 5s --same-user

Sample amesh peers output:

listening for peers for 5s...

discovered 2 peer(s):

AGENT          SAME?  ROLE@HOST                     PORT   CAPABILITIES
abcd12345678   yes    inference-worker@host-a       0      ollama,vllm
ef9876543210   no     orchestrator@host-b           0      orchestrator

The fingerprints in mDNS TXT records are claims; verification happens during the Phase 2 transport handshake (below).

Transport (Phase 2)

Phase 2 layers an authenticated QUIC transport on top of Phase 1 discovery. Two architectural notes:

  • The agent's ed25519 signing key doubles as its iroh EndpointId, so a peer who knows your agent fingerprint already knows enough to address your iroh endpoint. No separate "node ID" to manage.
  • After ALPN negotiation (agent-mesh/v1), both ends exchange cert chains and enforce the auto-team rule fail-closed: if peer user_pubkey != ours and no pact exists, the handshake rejects before any payload data crosses the boundary.

The CLI splits "I want to be discovered" from "I want to be reachable":

Subcommand Discoverable? Reachable (QUIC)?
amesh announce yes no (publishes port 0)
amesh listen yes yes (binds + announces)

End-to-end smoke (same user on two terminals):

# Terminal A — bind QUIC, announce on mDNS, accept envelopes
amesh listen --duration 60s
# prints:
#   listening on udp/<port>
#     agent_fp=<fp>
#     user_fp =<user_fp>

# Terminal B — within that 60s window:
amesh send <fp-from-terminal-A> --payload '{"hello":"world"}'
# Terminal A then prints one JSON line per received envelope:
#   {"sender_agent_fp":"...","sender_user_fp":"...","sequence":0,
#    "payload":{"encoding":"utf8","text":"{\"hello\":\"world\"}"}}

If you point amesh send at a peer that belongs to a different user, the handshake closes the connection cleanly and both sides report auto-team check failed: ....

Python Usage

Install the wheel:

pip install newt-agent-mesh

(See the install section above for why the distribution name is newt-agent-mesh and not agent-mesh. The import path is unchanged.)

Identity round-trip — no network required:

import agent_mesh.core as core

# Generate a user key (root of trust).
user = core.UserKey.generate()
print("user fp:", user.fingerprint().hex())

# Issue an agent key signed by that user.
meta = core.AgentMetadata(
    role="my-agent",
    host="my-machine",
    capabilities=["inference"],
    issued_at="2026-05-29T00:00:00Z",
)
agent = core.AgentKey.issue(user, meta)
print("agent fp:", agent.fingerprint().hex())

# Build and verify a signed envelope.
recipient = core.Recipient.topic("hello/world")
env = core.SignedEnvelope(agent, recipient, sequence=1, payload=b"hi")
env.verify()  # raises core.MeshError on tamper

Request/reply over an authenticated mesh — needs mDNS on the LAN:

import asyncio
import agent_mesh.core as core
import agent_mesh.bus as bus


async def main() -> None:
    user = core.UserKey.generate()
    meta = core.AgentMetadata(
        role="echo",
        host="localhost",
        capabilities=["test"],
        issued_at="2026-05-29T00:00:00Z",
    )
    server_agent = core.AgentKey.issue(user, meta)
    client_agent = core.AgentKey.issue(user, meta)

    server_bus = await bus.Bus.bind(user, server_agent, 0)
    client_bus = await bus.Bus.bind(user, client_agent, 0)

    topic = bus.Topic(user.fingerprint(), "echo")
    server_bus.handle_requests(topic, lambda body: b"echo: " + body)

    # Let mDNS settle.
    await asyncio.sleep(0.5)

    reply = await client_bus.request(
        server_bus.agent_fingerprint(),
        topic,
        b"hi",
        timeout_ms=5000,
    )
    print(reply)  # b'echo: hi'

    await server_bus.close()
    await client_bus.close()


asyncio.run(main())

The handler must return bytes directly. Async handlers (callables that return a coroutine) are recognized and rejected in this release; wrap any async work in asyncio.run(...) inside the sync handler.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

newt_agent_mesh-0.5.20260528-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

newt_agent_mesh-0.5.20260528-cp312-cp312-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

newt_agent_mesh-0.5.20260528-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

newt_agent_mesh-0.5.20260528-cp311-cp311-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

newt_agent_mesh-0.5.20260528-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

newt_agent_mesh-0.5.20260528-cp310-cp310-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

newt_agent_mesh-0.5.20260528-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

newt_agent_mesh-0.5.20260528-cp39-cp39-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file newt_agent_mesh-0.5.20260528-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for newt_agent_mesh-0.5.20260528-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 88ba239d1b0c413d2fd855c5430e66531715fc79676f3499049c22c972ceb2d5
MD5 77bf7b5ec9a82aad63bf11f44aba1363
BLAKE2b-256 b29d2b078cdf8a033b755572b3540153463258ae3c688106d33a597226eb1d4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for newt_agent_mesh-0.5.20260528-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on Gilamonster-Foundation/agent-mesh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file newt_agent_mesh-0.5.20260528-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for newt_agent_mesh-0.5.20260528-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9f055ce84dcd389fbd15540d8e97725c65c1c698ea011a37fc0d741860bccb22
MD5 cea5410d589ca749364a8ed597295d4c
BLAKE2b-256 7f5b83de189d88e49e9779cb97ac3c5dafb578d30d6f3bee94ee38c5cd9581d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for newt_agent_mesh-0.5.20260528-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on Gilamonster-Foundation/agent-mesh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file newt_agent_mesh-0.5.20260528-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for newt_agent_mesh-0.5.20260528-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 43c0138718cf1fe373af5330e8827e5691943c8b4d24dd66f4ed5ecf9c148e08
MD5 bd5f154d4652e7f0ecaf1083f3664399
BLAKE2b-256 1b2d7950ccfdcf1faa937b8fde1f447dfa81c66201e1be290cac7d1bd0f4d05b

See more details on using hashes here.

Provenance

The following attestation bundles were made for newt_agent_mesh-0.5.20260528-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on Gilamonster-Foundation/agent-mesh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file newt_agent_mesh-0.5.20260528-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for newt_agent_mesh-0.5.20260528-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d9fc0ddf2f83f2f209ea8373f0678e3226259697750dcc3dd6a1981ef882d953
MD5 6723c54eadbefc78bfd394cf3c3f2c74
BLAKE2b-256 a7b18124c915aaae102dabd97873b1db9c7313a691310040a6fb4584d2e51a11

See more details on using hashes here.

Provenance

The following attestation bundles were made for newt_agent_mesh-0.5.20260528-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on Gilamonster-Foundation/agent-mesh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file newt_agent_mesh-0.5.20260528-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for newt_agent_mesh-0.5.20260528-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f6aa748aae1237bc964b8a5cf4285ea558c22d15bb575f2e4a18af3a64fe51b7
MD5 de32aeb7fc45ff726166790d45fb105f
BLAKE2b-256 036e377746db53c71697c270d88499de0f52539e53fca1c58bc9aa33d527be19

See more details on using hashes here.

Provenance

The following attestation bundles were made for newt_agent_mesh-0.5.20260528-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on Gilamonster-Foundation/agent-mesh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file newt_agent_mesh-0.5.20260528-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for newt_agent_mesh-0.5.20260528-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3320dce3fd72d538a57139baa4b68e5c8878f1e79f3f66a5107477d5acd43759
MD5 ec171123f4cd1cc267b620d9f373ef68
BLAKE2b-256 718ac2e8ac396dfacb4d0f9ab0ffbf04e80edba73ed97c00ba3171e99ccee5ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for newt_agent_mesh-0.5.20260528-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: release.yml on Gilamonster-Foundation/agent-mesh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file newt_agent_mesh-0.5.20260528-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for newt_agent_mesh-0.5.20260528-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7478acc9fbcf2ab77075bb47bfc9a513f80a349634660076692fd4d950f3e467
MD5 a378687abfaae7849d47c38eb39c7886
BLAKE2b-256 ed991b74a1f55816e3f8efa4051bbf84b7c6e2abd7d179c093a64f8d9b31c3d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for newt_agent_mesh-0.5.20260528-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on Gilamonster-Foundation/agent-mesh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file newt_agent_mesh-0.5.20260528-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for newt_agent_mesh-0.5.20260528-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e079f5d624ac5213cefb6e80439f62bb01c221041e86da5332be5fc6df0b919f
MD5 731429b91e30a90f9abf1eaac039cea7
BLAKE2b-256 e78478ff179f0a02672703571df1468002131d39336d1fd2980df0026c271a15

See more details on using hashes here.

Provenance

The following attestation bundles were made for newt_agent_mesh-0.5.20260528-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: release.yml on Gilamonster-Foundation/agent-mesh

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