Skip to main content

Nuncio Python SDK (nuncio)

License: Apache-2.0 Python Versions

Python SDK for the Nuncio Communication Protocol—the open-source, cooperative peer-to-peer agent communication standard.


🌟 Overview

Nuncio makes agent‑to‑agent and tool-using communication simple, bi-directional, and robust. It gives you a clean, versioned binary envelope, a predictable handshake, and native patterns for routing, negotiation, text streaming, and errors—all over WebSockets using Google Protocol Buffers (v3).

This SDK implements the Nuncio specification, making it easy to:

  • Build Nuncio Clients that connect to any peer or router.
  • Create Nuncio Server Routers that coordinate and route messages between agents.
  • Utilize Standardized Envelopes for RPC execution, streaming chunks, capability negotiation, and peer discovery.
  • Suspend Workflows cleanly using native human-in-the-loop approval intercepts.

📦 Installation

Install the official package via pip:

pip install nuncio

Or using uv:

uv pip install nuncio

🚀 Quickstart

Get a P2P agent connection running in less than a minute.

1. Start the Nuncio Router/Server

Create a server that routes envelopes to agents based on their specific roles (e.g. RESEARCH_AGENT):

from nuncio.server import NuncioServer

# Initialize the router server
server = NuncioServer(host="127.0.0.1", port=8080)
print("Starting Nuncio Router on port 8080...")
server.run()

2. Connect Client A (The Tool-Providing Responder)

This client registers as RESEARCH_AGENT and responds to requests:

import asyncio
from nuncio.client import NuncioClient, NuncioBuilders
from nuncio.nuncio_pb2 import MessageType

async def main() -> None:
    # Initialize connection registration
    client = NuncioClient(
        uri="ws://localhost:8080/nuncio",
        role="RESEARCH_AGENT",
        agent_id="research-alpha",
        token="demo-token",
        capabilities=["web_search", "code_eval"],
    )
    await client.connect()
    print("Research Agent online & waiting for tasks...")

    while True:
        incoming = await client.recv_envelope()
        
        # Respond to requests
        if incoming.type == MessageType.REQUEST:
            print(f"Received Request: {incoming.request.intent} (ID: {incoming.request.request_id})")
            
            response = NuncioBuilders.response(
                intent=incoming.request.intent,
                request_id=incoming.request.request_id,
                content="Search results: Nuncio is an open agent protocol.",
                confidence=0.98,
            )
            
            # Send back the correlated response envelope
            env = client.build_envelope(MessageType.RESPONSE)
            env.response.CopyFrom(response)
            await client.send_envelope(env)

asyncio.run(main())

3. Connect Client B (The Coordinating Requester)

This client connects as COORDINATOR_AGENT and requests tools/delegations from any available research agent on the network:

import asyncio
from nuncio.client import NuncioClient, NuncioBuilders
from nuncio.nuncio_pb2 import MessageType

async def main() -> None:
    client = NuncioClient(
        uri="ws://localhost:8080/nuncio",
        role="COORDINATOR_AGENT",
        agent_id="coordinator-main",
        token="demo-token",
        capabilities=[],
    )
    await client.connect()
    print("Coordinator Agent online.")

    # Target any agent matching the logical role 'RESEARCH_AGENT'
    request = NuncioBuilders.request(intent="search_agent_protocol")
    env = client.build_envelope(MessageType.REQUEST)
    env.request.CopyFrom(request)
    env.target_role = "RESEARCH_AGENT"  # Symmetric routing target
    
    await client.send_envelope(env)
    print("Task dispatched...")

    # Wait for the bi-directional response
    incoming = await client.recv_envelope()
    if incoming.type == MessageType.RESPONSE:
        print(f"Response Received: {incoming.response.content}")
    elif incoming.type == MessageType.ERROR:
        print(f"Error Received: {incoming.error.message}")

asyncio.run(main())

⚖️ License

Nuncio is open-source software licensed under the Apache License 2.0. See the LICENSE file for details.

Metadata

Release files for nuncio 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nuncio 0.1.3
File Size Uploaded Provenance Actions
nuncio-0.1.3.tar.gz 23.6 kB Without provenance Details for nuncio-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nuncio 0.1.3
File Interpreter ABI Platform Actions
nuncio-0.1.3-py3-none-any.whl Python 3 none any Details for nuncio-0.1.3-py3-none-any.whl

Total release size: 47.0 kB

Release files / nuncio-0.1.3.tar.gz

Download URL nuncio-0.1.3.tar.gz
Size 23.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4da1fb2e2234c4c94b4ea182745e570c59ee81447694173551d95d49d5d0e328
BLAKE2b-256 checksum
How to use checksums
002057047bee2bca398aa1ae960e1a222e4c7362f07cc52ee3d8d3e25a1999f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / nuncio-0.1.3-py3-none-any.whl

Download URL nuncio-0.1.3-py3-none-any.whl
Size 23.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88a670f3d608299373d4004ec361f84a604250720b09baaf2405de87da1165a0
BLAKE2b-256 checksum
How to use checksums
5fc03edfe10a282604bdd3bebfd3113e0a9f413987e32c70c3dc0ff74748395d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Security for nuncio 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files No provenance

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