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
- Get started: https://github.com/assistant-ui/harness-sdk/blob/main/apps/docs/app/statewire/docs/get-started/statewire/page.mdx
- Guide: https://github.com/assistant-ui/harness-sdk/blob/main/apps/docs/app/statewire/docs/guides/statewire/host/page.mdx
- Reference: https://github.com/assistant-ui/harness-sdk/blob/main/apps/docs/app/statewire/docs/reference/statewire-python/page.mdx
- Spec: https://github.com/assistant-ui/harness-sdk/blob/main/apps/docs/app/statewire/docs/spec/statewire-protocol/page.mdx
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 statewire-0.16.0.tar.gz.
File metadata
- Download URL: statewire-0.16.0.tar.gz
- Upload date:
- Size: 105.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ad4f0a447fc2d4060e98ef1b4cbc63f27cff94053fc90ead5fab11548d47f7a
|
|
| MD5 |
25e75e015a8b7e7605a2c4ec0a5facf3
|
|
| BLAKE2b-256 |
4a29d7ad275f8cdfee452f258fbcda7f3055583561463f30a567f96b13918e74
|
Provenance
The following attestation bundles were made for statewire-0.16.0.tar.gz:
Publisher:
pypi-publish.yaml on assistant-ui/harness-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
statewire-0.16.0.tar.gz -
Subject digest:
9ad4f0a447fc2d4060e98ef1b4cbc63f27cff94053fc90ead5fab11548d47f7a - Sigstore transparency entry: 2754361943
- Sigstore integration time:
-
Permalink:
assistant-ui/harness-sdk@7c005c6a02aad14ea44110409c51f0efeab3cfab -
Branch / Tag:
refs/heads/main - Owner: https://github.com/assistant-ui
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yaml@7c005c6a02aad14ea44110409c51f0efeab3cfab -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file statewire-0.16.0-py3-none-any.whl.
File metadata
- Download URL: statewire-0.16.0-py3-none-any.whl
- Upload date:
- Size: 55.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4b3615c21b5ee2bf8e5e9f8ca0d26df3e584df7165142410eaf0295c5f7ac2d
|
|
| MD5 |
83dd43c7c9ddcddfef1d0caf473036f5
|
|
| BLAKE2b-256 |
a9bb29b05ff1c4899db9e7b45e93002122b118c16b4a55ff372a2cf53e24ce23
|
Provenance
The following attestation bundles were made for statewire-0.16.0-py3-none-any.whl:
Publisher:
pypi-publish.yaml on assistant-ui/harness-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
statewire-0.16.0-py3-none-any.whl -
Subject digest:
e4b3615c21b5ee2bf8e5e9f8ca0d26df3e584df7165142410eaf0295c5f7ac2d - Sigstore transparency entry: 2754361996
- Sigstore integration time:
-
Permalink:
assistant-ui/harness-sdk@7c005c6a02aad14ea44110409c51f0efeab3cfab -
Branch / Tag:
refs/heads/main - Owner: https://github.com/assistant-ui
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yaml@7c005c6a02aad14ea44110409c51f0efeab3cfab -
Trigger Event:
workflow_dispatch
-
Statement type: