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.2.0.tar.gz (38.9 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.2.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file orch8_io_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: orch8_io_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 38.9 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.2.0.tar.gz
Algorithm Hash digest
SHA256 10f418beea260292ae5208f53599be20b641e030d145f981603d22f0ec05046a
MD5 91ececc63f139f9b090ef50d450862d9
BLAKE2b-256 5d9ac1e646e0894806eb2374e482479d5711a0e62990a34243e6d8aac308c1b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for orch8_io_sdk-0.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: orch8_io_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 245cd8c8d6c53e8f133a6bd0da3fcee1edaf20683bacb57edc09a46fce1fe0f1
MD5 fe0eb5a0eae0728c41227fc48fabab15
BLAKE2b-256 2e6573d48b3e080ca76a70285dfa4165ee1542c52caca84d881e0b4ad5982bd1

See more details on using hashes here.

Provenance

The following attestation bundles were made for orch8_io_sdk-0.2.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