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.0 generate \
  --path ../../docs/static/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.

Download files

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

Source Distribution

cloacina_client-0.11.0.tar.gz (88.1 kB view details)

Uploaded Source

Built Distribution

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

cloacina_client-0.11.0-py3-none-any.whl (214.8 kB view details)

Uploaded Python 3

File details

Details for the file cloacina_client-0.11.0.tar.gz.

File metadata

  • Download URL: cloacina_client-0.11.0.tar.gz
  • Upload date:
  • Size: 88.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cloacina_client-0.11.0.tar.gz
Algorithm Hash digest
SHA256 04fb44f8946238db514986875387404af8dab2ed88cc301ce0388ff85bca3f5a
MD5 d79915772d461b660e5255652944f739
BLAKE2b-256 8572794174ce763b4007acf1f75d3881cf737e0435516faf91ded2c2e6c153d0

See more details on using hashes here.

File details

Details for the file cloacina_client-0.11.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cloacina_client-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18bd556e70a1c54fdc91e4361e18e5d05af8400679a2d3e19b3a5b2c06bc38a6
MD5 203c599d3123fee88e3456a7fe3aa5f1
BLAKE2b-256 2b7470aec826b3a27a6a4d4b3d4075705030cc7e4a91c7210c92dcdde88c95e1

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.11.0 This release

2 files

0.10.0

2 files

0.9.0

2 files

0.8.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