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, context documents, and state documents. The main document is independent of its optional read key. Command sequences and replay remain shared across protocols. Python hosts support lazy, chained compatibility adapters.

See the protocol registration and migration guide.

Docs

Download files

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

Source Distribution

statewire-0.16.2.tar.gz (109.8 kB view details)

Uploaded Source

Built Distribution

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

statewire-0.16.2-py3-none-any.whl (58.1 kB view details)

Uploaded Python 3

File details

Details for the file statewire-0.16.2.tar.gz.

File metadata

  • Download URL: statewire-0.16.2.tar.gz
  • Upload date:
  • Size: 109.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for statewire-0.16.2.tar.gz
Algorithm Hash digest
SHA256 e0dc11c8af668c3700f3cb8ffdb4f9bffe5cf3b4051cf0daf5a3baf2d8d1b294
MD5 0a88dc70f3d8cb1b81ab80fd0b783c02
BLAKE2b-256 f7f14970a512688d32d0ebff314b85e537840c06324ebd27df22d6ef64238923

See more details on using hashes here.

Provenance

The following attestation bundles were made for statewire-0.16.2.tar.gz:

Publisher: pypi-publish.yaml on assistant-ui/harness-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file statewire-0.16.2-py3-none-any.whl.

File metadata

  • Download URL: statewire-0.16.2-py3-none-any.whl
  • Upload date:
  • Size: 58.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for statewire-0.16.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5009a29b2f149930d637e64d800c58786f514fba80df43099afc1939a9b418fd
MD5 3871d2d79b8a99996671d9f46a3cd925
BLAKE2b-256 3e0bd0ced08e87a477033b4e1153c061cd6dfa013b26c2fefc971096963ed64e

See more details on using hashes here.

Provenance

The following attestation bundles were made for statewire-0.16.2-py3-none-any.whl:

Publisher: pypi-publish.yaml on assistant-ui/harness-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.16.3

2 files

This release

0.16.2 This release

2 files

0.16.1

2 files

0.16.0

2 files

0.15.0

2 files

0.14.0

2 files

0.13.0

2 files

0.12.5

2 files

0.12.4

2 files

0.12.3

2 files

0.12.2

2 files

0.12.1

2 files

0.12.0

2 files

0.11.1

2 files

0.11.0

2 files

0.10.0

2 files

0.9.2

2 files

0.9.1

2 files

0.9.0

2 files

0.8.7

2 files

0.8.6

2 files

0.8.5

2 files

0.8.4

2 files

0.8.3

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.2

2 files

0.6.1

2 files

0.6.0

2 files

0.5.0

2 files

0.4.7

2 files

0.4.6

2 files

0.4.5

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

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