Skip to main content

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

  1. Ack — The worker accepted the task and started processing. Carries the worker's version string for observability.
  2. Nack — The worker rejected the task. The reason field describes why (e.g., major version mismatch, unparseable version). No further responses follow a Nack.
  3. Result — A cloudpickle-serialized return value. Coroutine tasks yield exactly one result; async generator tasks yield one per iteration.
  4. 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, and proxy fields are serialized with cloudpickle and stored as bytes fields. This allows arbitrary Python objects to be transmitted without schema changes.
  • Results and exceptionsResult.dump and Exception.dump are 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 Task message reserves fields 1–4 (version, id, caller, tag) for lightweight metadata, enabling pre-deserialization extraction via TaskEnvelope.

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


Download files

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

Source Distribution

wool_protocol-0.1rc0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

wool_protocol-0.1rc0-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

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

Hashes for wool_protocol-0.1rc0.tar.gz
Algorithm Hash digest
SHA256 d3f921f6743f8868810e7b61318d8a806201695cee11c246cbeabe35cfb86a66
MD5 e9c2f9c691707d02ead6947f536db7aa
BLAKE2b-256 6d37de5aadda27148acffb5b1431a9d341d689d6dcbf29f94653e0c9196f9899

See more details on using hashes here.

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

Hashes for wool_protocol-0.1rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9ede65e5fb0f2fae54dbf8d5eccabebcdda133da1530014a7728a3c2848a29a
MD5 0c07d015b463e999f7a897cc4d4c5bd9
BLAKE2b-256 11175694c477cdbed3c3f480c57dae918ef1287d8762e180020843613a62a147

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