Skip to main content

Python SDK for Cascade workflow orchestration

Project description

Cascade SDK

PyPI version

The Cascade SDK is a standards-first Python library for workflow orchestration. It acts as a "Babel for Workflows," allowing you to define logic in Python and execute it across diverse orchestrators while maintaining strict compliance with industry standards like W3C PROV and CloudEvents.

Quick Start

Installation

pip install noirstack-cascade-sdk

1. Define Your Flow (Capture Mode)

Cascade uses Capture Mode to record workflow structures without executing them locally. Task calls are intercepted to build a serializable DAG.

In 0.1.x, data exchanged between tasks should be JSON-serializable primitives and containers (str, int, float, bool, dict, list, None). Avoid passing live runtime objects such as DB connections, open file handles, or custom class instances across task boundaries.

from cascade_sdk import task, flow

@task
def extract_metadata(file_path: str):
    return {"status": "processing", "path": file_path}

@flow
def ingestion_flow(path: str):
    return extract_metadata(path)

2. Register and Execute

from cascade_sdk import CascadeClient, wait_for_completion
from cascade_sdk.compiler import build_dag_from_flow

# Compile to a deterministic DAG
dag = build_dag_from_flow(ingestion_flow)

# Initialize the thin client
client = CascadeClient(base_url="http://localhost:3000", api_key="your_key")

# Register and trigger
flow_id = client.register_flow("data_pipeline", dag)
run_id = client.trigger_flow(flow_id, {"path": "/data/source.csv"})

# Wait for result
result = wait_for_completion(client, run_id)
print(f"Workflow Result: {result['result']}")

For asyncio environments, use wait_for_completion_async(...).

Standards and Compliance

Cascade is designed for regulated environments (financial, healthcare, federal) where auditability is non-negotiable.

  • W3C PROV: Generate structured lineage describing agents, activities, and entities.
  • CloudEvents: Interoperable event envelopes for system-wide triggers.
  • NIST SP 800-204: Security guidance profile for microservice boundaries.
  • OpenTelemetry: Native distributed tracing context propagation.

Human-in-the-Loop (HITL) Provenance

Capture manual interventions with the same rigor as automated tasks:

from cascade_sdk import build_prov_bundle

def log_approval(manager_email, run_id):
    # Generates a W3C-compliant audit trail for a manual decision
    return build_prov_bundle(
        agent={f"agent:{manager_email}": {"prov:type": "prov:Person"}},
        activity={"activity:approval": {"prov:type": "cascade:human_intervention"}},
        wasAssociatedWith={"activity:approval": f"agent:{manager_email}"}
    )

Note: build_prov_bundle() emits a minimal PROV-JSON document with the standard prov prefix. Keep prefixed keys consistent (for example prov:type) when adding domain-specific attributes.

Ecosystem Adapters

Migrate legacy workloads to Cascade without rewriting your logic. 0.1.0 supports:

  • Airflow: airflow_dag_to_dag(dag)
  • Argo: argo_workflow_to_dag(dict)
  • BPMN 2.0: bpmn_xml_to_dag(xml_str)
  • Others: Support for Kestra, Dagster, Mage, and more.

0.1.0 Considerations (Beta Status)

As an early public release, please note the following:

Known Limitation (Current)

  • The SDK currently provides synchronous polling via wait_for_completion(...); async-native polling helpers are planned for 0.2.0.

  • Synchronous Polling: wait_for_completion is currently blocking. Async support is planned for 0.2.0.

  • Serialization: All data passed between tasks must be JSON-serializable.

  • Thin Client: The SDK contains zero orchestration logic (no retries/caching); these are handled by the Cascade control plane.

  • Optional Extras: Install specific adapters using extras: pip install "noirstack-cascade-sdk[airflow,standards]".

  • HITL Resume Path: Use submit_task_output(...) to send manual task output. Endpoint contracts may vary by control-plane deployment; override with path_template when needed.

Contributing

We are actively seeking feedback on the DAG Compiler and standards integrations.

Want to influence 0.2.0? If you encounter compiler edge cases or unclear DAG build errors on valid Python constructs, open an issue with a minimal code snippet and expected DAG behavior.

API Docs

  • API_REFERENCE.md: concise reference for decorators, compiler, client methods, polling helpers, and standards utilities.

Created by Noir Stack LLC.

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

noirstack_cascade_sdk-0.1.4.tar.gz (27.3 kB view details)

Uploaded Source

Built Distribution

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

noirstack_cascade_sdk-0.1.4-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file noirstack_cascade_sdk-0.1.4.tar.gz.

File metadata

  • Download URL: noirstack_cascade_sdk-0.1.4.tar.gz
  • Upload date:
  • Size: 27.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for noirstack_cascade_sdk-0.1.4.tar.gz
Algorithm Hash digest
SHA256 1c3518ee3031df7f4f7ed477c668fd8da5bb358e6691e6c8aff75d696fc3f833
MD5 5041335d0991442e72c8b290845d79c4
BLAKE2b-256 9ef574051fe1e6c282eae4455df13b4403556ce92391f961f93f6ba5fdd59bdf

See more details on using hashes here.

File details

Details for the file noirstack_cascade_sdk-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for noirstack_cascade_sdk-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f2b9f21a8486118002dcdf44e91268714fca8b1b38c47cd97ca48b162eb68769
MD5 23a56ec7d59bca04ad2729915d0bc3b7
BLAKE2b-256 a7dd3c0a723af574c82884bd1048b7fceed7c969ab7fa907c7bf6f0453ea952e

See more details on using hashes here.

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