Skip to main content

statewire

The Statewire protocol for Python: a Statewire host owns one JSON state dict, streams every change to attached clients as ops, and dispatches typed commands back. Part of harness-sdk, with harness-sdk and pinned.

Install

uv add statewire

Extras: uv add "statewire[langgraph]", uv add "statewire[orjson]".

Use

from fastapi import FastAPI
from pinned import PinnedHost, PinnedWorker
from statewire import Statewire, StatewireReject, command

class Counter(Statewire):
    async def lifespan(self):
        self.state = {"count": 0}
        yield

    @command
    async def increment(self):
        if self.state["count"] >= 10:
            raise StatewireReject("the counter is full (max 10)")
        self.state["count"] += 1

worker = PinnedWorker()
app = FastAPI()
app.include_router(worker)
app.include_router(PinnedHost(Counter, worker=worker, namespace="/threads"))

Protocols and documents

Connections negotiate date ranges through Statewire-Version and Statewire-Protocol. Protocols are additive and required by default. The server selects versions in syn; WebSockets use statewire.v1.

Each protocol owns its commands and its documents, and mints statement seqs in its own lane. Ephemeral subprotocols (Statewire.Subprotocol("interest", record="ephemeral")) restart their lane on every attach and carry per-attach documents mounted from handlers via ctx.attach. Python hosts support chained compatibility adapters.

See the protocol registration and migration guide.

Docs

Metadata

Release files for statewire 0.18.1

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

Source distribution (sdist)

Source distribution for statewire 0.18.1
File Size Uploaded Provenance
statewire-0.18.1.tar.gz 115.9 kB With provenance Details

Built distribution (wheel)

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

Total release size: 175.9 kB

Release files / statewire-0.18.1.tar.gz

Download URL statewire-0.18.1.tar.gz
Size 115.9 kB
Tags Source
SHA-256 checksum
How to use checksums
04c7bc23ab564c0f88d9c3bc42985cc0f688bacbc60b32798222321f3333e665
BLAKE2b-256 checksum
How to use checksums
1699c6679fb4402da46c1feda99d7a7256efb34fe4b3b72150edabf5deb2e4e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.

Transparency log

Release files / statewire-0.18.1-py3-none-any.whl

Download URL statewire-0.18.1-py3-none-any.whl
Size 60.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98b9a67fcf99f0ab543910a7c36300f4229afa97ac7812a2561ef24c6a3ff436
BLAKE2b-256 checksum
How to use checksums
1edf5478425f7cb145b457aee9e0f7f024fb566bf9824b6562bd037a84c6332c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.

Transparency log

Security for statewire 0.18.1

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for statewire-0.18.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.

Transparency log

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.18.1 This release

2 release files Full 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