Skip to main content

Anyserve Python SDK

The package uses the native Rust transport for the current execution protocol. Use the SDK and control-plane binary from the same release. Python 3.12+ is required.

Install from this checkout with pip install ./clients/python. Build and test instructions are in the contributing guide.

Client execution

ExecutionClient (also exported as AnyserveClient in Python) provides:

  • submit(interface, inputs, job_id=..., options=...): complete-input submission, durable by default. An explicit ID is idempotent for the same specification.
  • invoke(interface, inputs, options=...): ephemeral execution events.
  • invoke_stream(interface, options=...): duplex invocation; call send and finish_input, and iterate the returned execution events. Closing the context cancels unfinished execution and closes both transport directions.
  • call(interface, payload, options=...): run a bytes-in, bytes-out handler and return its single inline result; the client side of a @worker returning bytes.
  • execute(...): collect an ephemeral invocation's terminal outputs as objects.
  • get, watch, cancel and result: inspect or follow an accepted job.

Inputs are bytes or object dictionaries from inline_object / uri_object. ExecutionOptions carries required/preferred attributes, resource quantities, metadata, params, priority, timeouts and max_attempts (zero means server default). URI objects remain opaque references; the SDK does not automatically fetch them.

Pass token= or set ANYSERVE_TOKEN to a client bearer token. RpcError preserves the numeric gRPC status in status_code. result() reads the job once and, if it is still running, follows watch(job_id, after_sequence=0) until Finished. A zero cursor starts at the earliest retained event, including after recovery; expired nonzero cursors report cursor expiry. Use event streams as context managers when you may stop reading before Finished. Invoke and Watch consume gRPC trailers before returning Finished, so stopping iteration or closing at that event safely releases the completed response. Durable jobs require an enabled journal; live output history is bounded and does not survive restart.

Workers

The existing worker and submitter use the current API. @worker declares an interface, attributes, capacity, codec and concurrency; serve runs the outbound control session and bounded handler pool. Normal return values become terminal outputs; generators produce output events. pass_context=True exposes cancellation and assignment metadata. streaming_input=True supplies input fragments without waiting for InputEnd.

Use a worker-role token. Permanent connection errors (InvalidArgument, PermissionDenied, Unauthenticated) propagate to the caller. Transport failures are logged and reconnect; a server Drain stops this session's new assignments, and the worker reconnects when the session ends. It keeps in-flight handlers until completion or cancellation/fencing from the server. Python callbacks cancel cooperatively. A local interrupt stops serving. Raise WorkerError(message, retryable=True) when the backend is unreachable so the control plane can run another attempt elsewhere; any other exception fails the attempt without a retry.

The native attempt transport retries delivery with exponential backoff and jitter, bounded by four negotiated heartbeat timeouts per open/commit operation. Job deadlines are enforced by the server. Re-sending a completed result does not run the handler again or wait for input replay to finish.

Metadata

Release files for anyserve-runtime 0.5.0

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

Source distribution (sdist)

Source distribution for anyserve-runtime 0.5.0
File Size Uploaded Provenance Actions
anyserve_runtime-0.5.0.tar.gz 60.4 kB With provenance Details for anyserve_runtime-0.5.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for anyserve-runtime 0.5.0
File Actions
anyserve_runtime-0.5.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for anyserve_runtime-0.5.0-cp312-abi3-win_amd64.whl
anyserve_runtime-0.5.0-cp312-abi3-manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.28+ x86-64 Details for anyserve_runtime-0.5.0-cp312-abi3-manylinux_2_28_x86_64.whl
anyserve_runtime-0.5.0-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for anyserve_runtime-0.5.0-cp312-abi3-macosx_11_0_arm64.whl
anyserve_runtime-0.5.0-cp312-abi3-macosx_10_12_x86_64.whl CPython 3.12 abi3 macOS 10.12+ x86-64 Details for anyserve_runtime-0.5.0-cp312-abi3-macosx_10_12_x86_64.whl

Total release size: 8.4 MB

Release files / anyserve_runtime-0.5.0.tar.gz

Download URL anyserve_runtime-0.5.0.tar.gz
Size 60.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d5f286f88e583d7734fcb2ac6f108a83c335a52be4a32ba07c2228bb18df9793
BLAKE2b-256 checksum
How to use checksums
4881f1e61c0a479b7b63a1a2d19898c435788ab69da06f19f7a5490d5281660a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Release files / anyserve_runtime-0.5.0-cp312-abi3-win_amd64.whl

Download URL anyserve_runtime-0.5.0-cp312-abi3-win_amd64.whl
Size 2.0 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
71d23b0a710e3f63ff64790da53a41dea61619f57661c307f5689839e5291460
BLAKE2b-256 checksum
How to use checksums
a764926d44f336ede642f955b66b45a1b2cbffdb410d95e48239dfc380bc7e5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Release files / anyserve_runtime-0.5.0-cp312-abi3-manylinux_2_28_x86_64.whl

Download URL anyserve_runtime-0.5.0-cp312-abi3-manylinux_2_28_x86_64.whl
Size 2.1 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
42867a7225ca79da62232b6ed3d8a3cf4059206528c1a9089fb00d7f5c180001
BLAKE2b-256 checksum
How to use checksums
949218174307aeb693ec3eb690ed59f86f1d5cc714117ddb88f3bcd858231eed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Release files / anyserve_runtime-0.5.0-cp312-abi3-macosx_11_0_arm64.whl

Download URL anyserve_runtime-0.5.0-cp312-abi3-macosx_11_0_arm64.whl
Size 2.1 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
82807f07eb8e7305357db3091f0a7391d2ad84d5b6e900e97d7a3fd1e5d105ff
BLAKE2b-256 checksum
How to use checksums
ab1f5ae00704f2740ab2ec01adc74b826a2a188f291623545fb796f58a44395b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Release files / anyserve_runtime-0.5.0-cp312-abi3-macosx_10_12_x86_64.whl

Download URL anyserve_runtime-0.5.0-cp312-abi3-macosx_10_12_x86_64.whl
Size 2.1 MB
Tags CPython 3.12 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
b24154b057e6da7892193e553151afa5729f9282ef9cb6b42b627db8606d0103
BLAKE2b-256 checksum
How to use checksums
5eb512800cb2697c1d93b5d9c806da1a1a83cd9b68160de4e0abd2887ee6b393
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Security for anyserve-runtime 0.5.0

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 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for anyserve_runtime-0.5.0.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 Oct 26, 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.

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