nodus-protocol
Typed control-plane message contracts for Nodus AI systems.
Defines the wire format for request/response/event envelopes exchanged
between Nodus components (gateway, agents, channels). JSON codec with a
_type discriminator for safe deserialization. No required external
dependencies — pure stdlib.
Status: v0.1.0 — prepared, not yet published.
Install
pip install nodus-protocol
What it provides
| Component | Purpose |
|---|---|
RequestEnvelope |
Inbound request: id, method, params |
ResponseEnvelope |
Response: id, ok, result or error |
EventEnvelope |
Server-pushed event: event_type, payload, timestamp |
encode(envelope) |
Serialize to JSON string with _type discriminator |
decode(raw) |
Deserialize JSON string to typed envelope |
PROTOCOL_VERSION |
Current version string ("1.0") |
is_compatible(v) |
Check interoperability with another version |
Quick start
from nodus_protocol import RequestEnvelope, ResponseEnvelope, encode, decode
req = RequestEnvelope(id="req-001", method="agent.run", params={"objective": "hello"})
wire = encode(req)
# '{"_type": "request", "id": "req-001", "method": "agent.run", ...}'
decoded = decode(wire)
assert isinstance(decoded, RequestEnvelope)
assert decoded.method == "agent.run"
resp = ResponseEnvelope(id="req-001", ok=True, result={"run_id": "run-abc"})
Envelopes
RequestEnvelope — id (str), method (str), params (dict | None)
ResponseEnvelope — id (str), ok (bool), result (any | None), error (str | None)
EventEnvelope — event_type (str), payload (dict | None), timestamp (float, auto-set UTC epoch)
Codec
from nodus_protocol import encode, decode
wire = encode(envelope) # JSON str with "_type" discriminator
envelope = decode(wire) # RequestEnvelope | ResponseEnvelope | EventEnvelope
decode routes on _type. Raises ValueError on unknown type or malformed JSON.
Versioning
from nodus_protocol import PROTOCOL_VERSION, is_compatible
print(PROTOCOL_VERSION) # "1.0"
is_compatible("1.0") # True
is_compatible("1.1") # True (minor compatible)
is_compatible("2.0") # False (major mismatch)
Design
- No required dependencies. Pure stdlib (
json,dataclasses,datetime). _typediscriminator. Every encoded envelope includes_typesodecodecan reconstruct the correct class without out-of-band schema info.
Development
pip install -e ".[dev]"
pytest tests/ -q
License
MIT — see LICENSE.
Metadata
Release files for nodus-protocol 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nodus_protocol-0.1.0.tar.gz | 6.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nodus_protocol-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.0 kB
Release files / nodus_protocol-0.1.0.tar.gz
| Download URL | nodus_protocol-0.1.0.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
acceffa3f156785dc9f4f20a2ee54e52814245bf769323918c853c026132206e
|
|
BLAKE2b-256 checksum How to use checksums |
9c30b2f3e1c3f0cbc3e6050b5a0079ee725c427a106150c84132a25c6f732d3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / nodus_protocol-0.1.0-py3-none-any.whl
| Download URL | nodus_protocol-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4f9a2b3f42b36413086c872dc8405b6fb37479b37b6e3ce3d2f01e0b771e2172
|
|
BLAKE2b-256 checksum How to use checksums |
39c965499db8c1254c420e57a4a4c9a88f7040ec2bdba86a70ef9434824dcdce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|