Python SDK for Orch8 workflow engine
Project description
orch8-sdk
Python SDK for the Orch8 workflow engine.
Installation
pip install orch8-sdk
Requires Python 3.10+.
Quick Start
import asyncio
from orch8 import Orch8Client
async def main():
async with Orch8Client("https://api.orch8.io", tenant_id="my-tenant") as client:
# Create a sequence
seq = await client.create_sequence({
"name": "my-sequence",
"namespace": "default",
"blocks": [],
})
print(f"Created sequence: {seq.id}")
# Start an instance
inst = await client.create_instance({
"sequence_id": seq.id,
"context": {"user_id": "123"},
})
print(f"Started instance: {inst.id}")
asyncio.run(main())
Worker
Run a polling worker that claims and executes tasks:
import asyncio
from orch8 import Orch8Client, Orch8Worker
async def handle_email(task):
print(f"Sending email to {task.params['to']}")
return {"sent": True}
async def main():
client = Orch8Client("https://api.orch8.io", tenant_id="my-tenant")
worker = Orch8Worker(
client=client,
worker_id="worker-1",
handlers={"send-email": handle_email},
max_concurrent=10,
)
await worker.start() # blocks until worker.stop() is called
asyncio.run(main())
Error Handling
from orch8 import Orch8Error
try:
await client.get_instance("non-existent")
except Orch8Error as exc:
print(f"API error {exc.status} on {exc.path}")
Development
# Install in editable mode with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
Project details
Release history Release notifications | RSS feed
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 orch8_io_sdk-0.1.0.tar.gz.
File metadata
- Download URL: orch8_io_sdk-0.1.0.tar.gz
- Upload date:
- Size: 36.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f168914f27e495a13fec1a5cb3a2f702fbc7ba0975fc5b161f06bd2d4f437524
|
|
| MD5 |
c41d521869520023140d8f0cb0706586
|
|
| BLAKE2b-256 |
0e436a487bb04ffafc921c6062a50d91af26a1ef3897694a0440e983151171de
|
Provenance
The following attestation bundles were made for orch8_io_sdk-0.1.0.tar.gz:
Publisher:
publish.yml on orch8-io/sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
orch8_io_sdk-0.1.0.tar.gz -
Subject digest:
f168914f27e495a13fec1a5cb3a2f702fbc7ba0975fc5b161f06bd2d4f437524 - Sigstore transparency entry: 1355914791
- Sigstore integration time:
-
Permalink:
orch8-io/sdk-python@7131ea72117f152629f568f1fe271d8382c50d63 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/orch8-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7131ea72117f152629f568f1fe271d8382c50d63 -
Trigger Event:
push
-
Statement type:
File details
Details for the file orch8_io_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: orch8_io_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05250fa5e560cd98140bebb6d1747ec5e7ad5b47b08f98e2842f4063ed3a6f9b
|
|
| MD5 |
ce69d8559ac9acda434fc3b8827dc164
|
|
| BLAKE2b-256 |
bba8588ecc37d2e70be5e12da84f04398128fcc71f2498571d5439646436a312
|
Provenance
The following attestation bundles were made for orch8_io_sdk-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on orch8-io/sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
orch8_io_sdk-0.1.0-py3-none-any.whl -
Subject digest:
05250fa5e560cd98140bebb6d1747ec5e7ad5b47b08f98e2842f4063ed3a6f9b - Sigstore transparency entry: 1355914801
- Sigstore integration time:
-
Permalink:
orch8-io/sdk-python@7131ea72117f152629f568f1fe271d8382c50d63 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/orch8-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7131ea72117f152629f568f1fe271d8382c50d63 -
Trigger Event:
push
-
Statement type: