Skip to main content

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


Download files

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

Source Distribution

orch8_io_sdk-0.1.0.tar.gz (36.0 kB view details)

Uploaded Source

Built Distribution

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

orch8_io_sdk-0.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

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

Hashes for orch8_io_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f168914f27e495a13fec1a5cb3a2f702fbc7ba0975fc5b161f06bd2d4f437524
MD5 c41d521869520023140d8f0cb0706586
BLAKE2b-256 0e436a487bb04ffafc921c6062a50d91af26a1ef3897694a0440e983151171de

See more details on using hashes here.

Provenance

The following attestation bundles were made for orch8_io_sdk-0.1.0.tar.gz:

Publisher: publish.yml on orch8-io/sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for orch8_io_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 05250fa5e560cd98140bebb6d1747ec5e7ad5b47b08f98e2842f4063ed3a6f9b
MD5 ce69d8559ac9acda434fc3b8827dc164
BLAKE2b-256 bba8588ecc37d2e70be5e12da84f04398128fcc71f2498571d5439646436a312

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page