Skip to main content

cloacina-client

Python SDK for cloacina-server — a typed REST client plus WebSocket execution-event streaming, for Python 3.10+.

This is the service client. It talks to a running cloacina-server over HTTP/WebSocket. The embedded workflow runtime is the separate cloaca package — the two are deliberately distinct.

Version lockstep: cloacina-client X.Y.Z is generated from, tested against, and only supported on cloacina-server X.Y.Z.

Install

pip install cloacina-client

Quickstart

from cloacina_client import Client

client = Client("http://localhost:8080", api_key="clk_...", tenant="public")

accepted = client.execute_workflow("my_workflow", {"input": 42})
print(accepted.execution_id)

for execution in client.iterate_executions(status="Failed"):
    print(execution.id, execution.workflow_name)

Every helper raises CloacinaApiError (with .status and the server's machine-readable .code) on non-2xx responses. The generated openapi-python-client client is available as client.generated for anything the shim doesn't cover.

Async + live execution events

import asyncio
from cloacina_client import AsyncClient

async def main():
    client = AsyncClient("http://localhost:8080", api_key="clk_...")
    accepted = await client.execute_workflow("my_workflow", {"input": 42})
    # Reconnect, dedup, and acks are handled for you.
    async for event in client.follow_execution_events(accepted.execution_id):
        print(event)

asyncio.run(main())

WebSocket connections never carry the long-lived key: the SDK mints a single-use, 60-second ticket (POST /v1/auth/ws-ticket) per connection. A 4426 close (protocol version mismatch) raises ProtocolVersionError — upgrade the SDK.

Regenerating

src/cloacina_client/_generated/ is produced by a pinned generator from the committed server contract:

uvx openapi-python-client@0.29.1 generate \
  --path ../../docs/public/openapi.json \
  --config generator-config.yaml --meta none \
  --output-path src/cloacina_client/_generated --overwrite

The pin is enforced, not just documented: scripts/check_python_sdk_generated.py regenerates into a temp directory and fails CI if the committed tree differs. Change the version in that script and in the recipe above together — they are the same pin, and the script is the half that CI reads.

This gate exists because the two drifted apart once already: the committed output had been produced by a different generator build than this README named, and regenerating with the documented version rewrote ~100 files and introduced an import (typing_extensions) that was not a declared dependency.

Contract tests

tests/test_contract.py exercises every documented endpoint plus the WebSocket lifecycle against a live server:

CLOACINA_SERVER_URL=http://localhost:8080 \
CLOACINA_API_KEY=<bootstrap-key> \
uv run pytest

The full execute→event-stream flow (which needs a compiled .cloacina package) runs in the repo's angreal test sdk-contract harness.

Metadata

Release files for cloacina-client 0.12.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 cloacina-client 0.12.0
File Size Uploaded Provenance
cloacina_client-0.12.0.tar.gz 110.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cloacina-client 0.12.0
File Interpreter ABI Platform
cloacina_client-0.12.0-py3-none-any.whl Python 3 none any Details

Total release size: 324.2 kB

Release files / cloacina_client-0.12.0.tar.gz

Download URL cloacina_client-0.12.0.tar.gz
Size 110.2 kB
Tags Source
SHA-256 checksum
How to use checksums
097fff8b3ca374c4e2f732148d6f3ebca0082bcecd160c6f7921b7ca9853bbd9
BLAKE2b-256 checksum
How to use checksums
c14aa2d046ba349f2fad627e064872989cabee2bcf297ac0248e22f560f76a15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / cloacina_client-0.12.0-py3-none-any.whl

Download URL cloacina_client-0.12.0-py3-none-any.whl
Size 214.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20b2c64be40a836d1be3b6e633cf267931859e84407c032cbafd27754f3ad6cd
BLAKE2b-256 checksum
How to use checksums
40bc4eeb856f2fd8ca0ddee62bfefbe2ceef8d6e36e411cfa4402c3b426524be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for cloacina-client 0.12.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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