Wool's wire protocol — gRPC and protobuf bindings.
Project description
wool-protocol
Wool's wire protocol definitions — protobuf schemas, generated Python bindings, gRPC service wrappers, and the service registry.
Importable as wool.protocol.
Installation
From PyPI
pip install wool-protocol
From source
git clone https://github.com/wool-labs/wool-protocol.git
cd wool-protocol
pip install .
Running tests
git clone https://github.com/wool-labs/wool-protocol.git
cd wool-protocol
pip install '.[dev]'
pytest
Wire protocol
Wool uses a binary wire protocol built on Protocol Buffers and gRPC for all communication between clients and workers.
Dispatch sequence
The Worker.dispatch RPC uses a server-streaming pattern. The client sends a single Task message and receives a stream of Response messages:
sequenceDiagram
Client->>Worker: Task
alt accepted
Worker-->>Client: Response(Ack)
alt coroutine
Worker-->>Client: Response(Result)
else async generator
loop each iteration
Worker-->>Client: Response(Result)
end
else failure
Worker-->>Client: Response(Exception)
end
else rejected
Worker-->>Client: Response(Nack)
end
Task fields
| # | Field | Type | Description |
|---|---|---|---|
| 1 | version |
string |
Wire protocol version (envelope) |
| 2 | id |
string |
Unique task identifier (envelope) |
| 3 | caller |
string |
Identifier of the calling client (envelope) |
| 4 | tag |
string |
Routing tag for worker selection (envelope) |
| 5 | proxy_id |
string |
Unique identifier of the originating proxy |
| 6 | proxy |
bytes |
cloudpickle-serialized proxy reference for callbacks |
| 7 | callable |
bytes |
cloudpickle-serialized coroutine or async generator |
| 8 | args |
bytes |
cloudpickle-serialized positional arguments |
| 9 | kwargs |
bytes |
cloudpickle-serialized keyword arguments |
| 10 | timeout |
int32 |
Execution timeout in seconds |
Response types
- Ack — The worker accepted the task and started processing. Carries the worker's
versionstring for observability. - Nack — The worker rejected the task. The
reasonfield describes why (e.g., major version mismatch, unparseable version). No further responses follow a Nack. - Result — A cloudpickle-serialized return value. Coroutine tasks yield exactly one result; async generator tasks yield one per iteration.
- Exception — A cloudpickle-serialized exception from the remote execution. Terminates the stream.
Serialization
Wool uses a hybrid serialization approach:
- Protobuf envelope — Structured metadata fields (
id,version,caller,timeout, etc.) are native protobuf fields for efficient parsing and forward compatibility. - cloudpickle payloads — The
callable,args,kwargs, andproxyfields are serialized with cloudpickle and stored asbytesfields. This allows arbitrary Python objects to be transmitted without schema changes. - Results and exceptions —
Result.dumpandException.dumpare cloudpickle-serialized bytes.
Version compatibility
The wire protocol follows PEP 440 versioning. A servicer accepts tasks from any client whose protocol version is less than or equal to its own within the same major version. For example, a servicer running 1.3.0 will accept tasks from a client running 1.0.0, but not from one running 1.4.0. There is no forward compatibility guarantee from client to servicer.
- Minor and patch releases are backwards compatible. New fields may be appended with new field numbers; existing field numbers and types never change within the same major version.
- Major releases may introduce breaking schema changes (field renumbering, type changes, removal). A major version mismatch between client and worker is treated as incompatible.
- Fields 1–4 are the envelope. The
Taskmessage reserves fields 1–4 (version,id,caller,tag) for lightweight metadata, enabling pre-deserialization extraction viaTaskEnvelope.
Implementations are responsible for enforcing version compatibility.
Release coordination
The wool and wool-protocol packages are developed in parallel but released independently: wool pins a specific wool-protocol version in its pyproject.toml, and wool's CI gates merges on the pinned version being available as a stable PyPI release. A separate non-blocking CI job tests against pre-releases for early signal.
On publish, wool-protocol dispatches a wool-protocol-released event to wool via GitHub's repository_dispatch API, triggering automatic re-runs of failing checks on open PRs that depend on the newly released version.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wool_protocol-0.1rc0.tar.gz.
File metadata
- Download URL: wool_protocol-0.1rc0.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3f921f6743f8868810e7b61318d8a806201695cee11c246cbeabe35cfb86a66
|
|
| MD5 |
e9c2f9c691707d02ead6947f536db7aa
|
|
| BLAKE2b-256 |
6d37de5aadda27148acffb5b1431a9d341d689d6dcbf29f94653e0c9196f9899
|
File details
Details for the file wool_protocol-0.1rc0-py3-none-any.whl.
File metadata
- Download URL: wool_protocol-0.1rc0-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9ede65e5fb0f2fae54dbf8d5eccabebcdda133da1530014a7728a3c2848a29a
|
|
| MD5 |
0c07d015b463e999f7a897cc4d4c5bd9
|
|
| BLAKE2b-256 |
11175694c477cdbed3c3f480c57dae918ef1287d8762e180020843613a62a147
|