Skip to main content

ROAR Protocol — Python SDK. Standalone implementation of the 5-layer agent communication standard.

Project description

roar-sdk

ROAR Protocol — Python SDK. 5-layer agent communication standard.

PyPI Python License

Design by @kdairatchiProwlrBot/roar-protocol


Install

pip install roar-sdk                    # core: types, client, server (pydantic only)
pip install 'roar-sdk[http]'            # + httpx for HTTP transport
pip install 'roar-sdk[websocket]'       # + websockets transport
pip install 'roar-sdk[ed25519]'         # + Ed25519 signing (cryptography)
pip install 'roar-sdk[server]'          # + fastapi + uvicorn for serving
pip install 'roar-sdk[server,ed25519]'  # full stack

Quick Start

from roar_sdk import AgentIdentity, ROARMessage, MessageIntent, ROARClient, ROARServer

# Layer 1: identity
agent = AgentIdentity(display_name="my-agent", capabilities=["code"])

# Layer 4: build and sign a message
msg = ROARMessage(
    **{"from": agent, "to": other},
    intent=MessageIntent.DELEGATE,
    payload={"task": "review"},
)
msg.sign("shared-secret")

# Layer 3: send over HTTP
client = ROARClient(agent, signing_secret="shared-secret")
response = await client.send_remote(
    to_agent_id=other.did,
    intent=MessageIntent.DELEGATE,
    content={"task": "review"},
)

What's in the Box

Module What it gives you
AgentIdentity, AgentCard Layer 1 — W3C DID-based agent identity
AgentDirectory, SQLiteAgentDirectory Layer 2 — in-memory and persistent discovery
ROARHub Layer 2 — federated hub with REST API
DiscoveryCache Layer 2 — TTL+LRU discovery cache
ROARClient, ROARServer Layer 3 — HTTP client and server
create_roar_router Layer 3 — FastAPI router (HTTP + WebSocket + SSE)
ROARMessage, MessageIntent Layer 4 — unified message format
sign_ed25519, verify_ed25519 Layer 4 — asymmetric signing
DelegationToken, issue_token Layer 4 — scoped capability grants
EventBus, StreamFilter Layer 5 — real-time event streaming
IdempotencyGuard Layer 5 — deduplication
DIDDocument, DIDKeyMethod, DIDWebMethod Identity — W3C DID documents
AutonomyLevel, CapabilityDelegation Identity — graduated autonomy model
MCPAdapter, A2AAdapter, ACPAdapter Adapters — MCP, A2A, ACP bridges
detect_protocol Adapters — auto-detect incoming protocol

Server Example

from fastapi import FastAPI
from roar_sdk import AgentIdentity, MessageIntent, ROARMessage, ROARServer
from roar_sdk.router import create_roar_router

identity = AgentIdentity(display_name="code-reviewer", capabilities=["code-review"])
server = ROARServer(identity, signing_secret="shared-secret")

@server.on(MessageIntent.DELEGATE)
async def handle_delegate(msg: ROARMessage) -> ROARMessage:
    return ROARMessage(
        **{"from": server.identity, "to": msg.from_identity},
        intent=MessageIntent.RESPOND,
        payload={"review": "LGTM"},
        context={"in_reply_to": msg.id},
    )

app = FastAPI()
app.include_router(create_roar_router(server, rate_limit=60))
# uvicorn main:app --port 8089

Protocol Adapters

from roar_sdk import MCPAdapter, A2AAdapter, ACPAdapter
from roar_sdk.adapters.detect import detect_protocol, ProtocolType

# Auto-detect incoming format
protocol = detect_protocol(raw_json)

if protocol == ProtocolType.MCP:
    msg = MCPAdapter.mcp_to_roar(tool_name, params, agent)
elif protocol == ProtocolType.A2A:
    msg = A2AAdapter.a2a_task_to_roar(task, sender, receiver)
elif protocol == ProtocolType.ACP:
    msg = ACPAdapter.acp_message_to_roar(acp_msg, ide, agent)

Links

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

roar_sdk-0.3.1.tar.gz (38.6 kB view details)

Uploaded Source

Built Distribution

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

roar_sdk-0.3.1-py3-none-any.whl (53.1 kB view details)

Uploaded Python 3

File details

Details for the file roar_sdk-0.3.1.tar.gz.

File metadata

  • Download URL: roar_sdk-0.3.1.tar.gz
  • Upload date:
  • Size: 38.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for roar_sdk-0.3.1.tar.gz
Algorithm Hash digest
SHA256 9ed8b241f3126de0f2b42ba0c0c36ef85df1c60b71c5102bf9a5150abc0b52d5
MD5 9aa9a4e067dbc803221b8bdc1a296298
BLAKE2b-256 24db2d1516a7a9e2a2723c0fb8c9ac83a2730bec66c92496d3ae8744f79b3a0d

See more details on using hashes here.

File details

Details for the file roar_sdk-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: roar_sdk-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 53.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for roar_sdk-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eabbcf2bc6462e7618bfd9b7524874ec73178e2fc3b9be8e1e0cd3d288025275
MD5 661fe42da67697a490b6d7f8b77fcce3
BLAKE2b-256 9e94849b859e9e22aa852007b3baca97163abd0f4bef3b16046b0cf14eee7cc0

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