Skip to main content

Nexus Mesh — Python SDK

The official Python SDK for Nexus Protocol, the universal open-source coordination protocol for AI agents.

Nexus lets agents — regardless of language, framework, or vendor — discover each other, communicate with end-to-end encryption, and collaborate on distributed tasks.

pip install nexus-mesh

The distribution is named nexus-mesh; the import module is nexus_sdk.


Quick start

Start the coordination hub:

nexus hub

Write a worker agent:

import asyncio
from nexus_sdk import NexusAgent

async def compute(input_data, task):
    return {"result": input_data["a"] + input_data["b"]}

async def main():
    agent = NexusAgent(
        name="calc_bot",
        capabilities=["calculate"],
        roles=["worker"],
    )
    agent.on_task(compute)
    await agent.connect()
    await asyncio.Future()   # stay online

asyncio.run(main())

Delegate work from an orchestrator:

from nexus_sdk import NexusAgent

orchestrator = NexusAgent(name="lead", roles=["admin"])
await orchestrator.connect()

# Find an agent by capability, then hand it a task
found = await orchestrator.discover(capabilities=["calculate"])
result = await orchestrator.submit_task(
    title="Add two numbers",
    assignee=found["agents"][0]["name"],
    input_data={"a": 20, "b": 22},
)
# {"result": 42}  — encrypted end-to-end in transit

Bridge an existing framework agent

Wrap a LangChain, CrewAI, AutoGen, or LlamaIndex agent without changing a line of it — it becomes discoverable and receives delegated tasks like a native Nexus agent:

from nexus_sdk.adapters.langchain import NexusLangChainAdapter

agent = NexusLangChainAdapter(my_agent_executor, name="analyst", capabilities=["market_analysis"])
await agent.connect()

Orchestrate multiple agents

from nexus_sdk import NexusPipeline

pipeline = (
    NexusPipeline(orchestrator)
    .step("Translate", capabilities=["translate"])
    .step("Calculate", capabilities=["calculate"],
          input_fn=lambda prev: {"expression": prev["translated_text"]})
)
result = await pipeline.run({"text": "compute forty two doubled"})

fan_out(orchestrator, branches, capabilities=...) runs independent branches in parallel instead. Full guide: docs/AGENT-INTEGRATION.md.


Features

  • End-to-end encryption — RSA-2048-OAEP + AES-256-GCM. The hub routes ciphertext it cannot read.
  • Verifiable identity — SHA-256 fingerprints over roles, permissions, and capabilities.
  • JWT authentication — every message after registration carries a hub-signed token.
  • Role-based access control — per-agent policies enforced at the hub.
  • Discovery — locate agents by capability, role, metadata, or name.
  • Distributed tasks — async lifecycle: pending → running → completed / failed.
  • Federation — hub-to-hub peering across organizations, encryption preserved end to end.
  • Immutable audit log — Merkle-chained events; retroactive edits break the chain.
  • Rate limiting — token-bucket throttling per agent.
  • Developer CLInexus hub | discover | ping | ask | task | keygen | dashboard | docs.

API summary

Method Purpose
connect() Open the connection and obtain a JWT
send(to, content) Fire-and-forget encrypted message
ask(to, content) Encrypted request, awaits the reply
discover(...) Find agents by capability, role, or metadata
submit_task(title, assignee, input_data) Delegate a task and await its result
who_is(name) Fetch an agent's certified identity and public key
on_message / on_request / on_task Register inbound handlers

Full reference: docs/API-REFERENCE.md


Documentation

License

Apache 2.0

Download files

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

Source Distribution

nexus_mesh-0.2.0.tar.gz (43.4 kB view details)

Uploaded Source

Built Distribution

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

nexus_mesh-0.2.0-py3-none-any.whl (51.0 kB view details)

Uploaded Python 3

File details

Details for the file nexus_mesh-0.2.0.tar.gz.

File metadata

  • Download URL: nexus_mesh-0.2.0.tar.gz
  • Upload date:
  • Size: 43.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for nexus_mesh-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4e9aa571c0ef86a9e614c18c372dd8c54dc7eced21ecd2a4c66d7d6ec959f24e
MD5 824e2db2a9312848bd1cd050c3c5b8ef
BLAKE2b-256 21aac5dac18b78f6a1d7643089228bd726e618da9589e95632c344c4b5d61d2c

See more details on using hashes here.

File details

Details for the file nexus_mesh-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: nexus_mesh-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 51.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for nexus_mesh-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af995b191a926d92d8a0cf4a27ff636f48de5187270508f02380f529ff5f79c1
MD5 96a74a486ce8ebdd8a09110aef941428
BLAKE2b-256 bdc1f8dc915faaca45c14789fddea527e18b5137d04f56a9262f644255cf6ff5

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page