Skip to main content

Python SDK for the Stitch workflow execution engine

Project description

stitch-eng-sdk

Python SDK for the Stitch workflow execution engine.

Install

pip install stitch-eng-sdk

Quickstart (Embedded Zero-Config Mode)

Stitch comes with an embedded Go binary so you don't even need to start a server locally!

import threading
import stitch

@stitch.task(max_attempts=5)
def charge_payment(order_id, amount):
    return {"txn_id": "txn_123"}

@stitch.task
def send_email(email, txn_id):
    return {"sent": True}

@stitch.workflow
def process_order(inp):
    # Pass the output of one task directly to the next to create a dependency!
    payment = charge_payment(order_id=inp["order_id"], amount=inp["amount"])
    send_email(email=inp["email"], txn_id=payment["txn_id"])

# 1. Start the embedded server and client
client = stitch.Client()

# 2. Start a background worker to poll for tasks
worker = stitch.Worker(client, tasks=[charge_payment, send_email])
threading.Thread(target=worker.start, daemon=True).start()

# 3. Submit the workflow and wait for it to finish!
result = client.run(process_order, input={
    "order_id": "ORD-001",
    "amount": 9897,
    "email": "user@example.com",
}).wait()

print(result.status)  # → "completed"

worker.stop()
client.close()

Remote Servers & Async Support

If you have a remote production server, you can pass the URL and an API key:

client = stitch.Client("https://stitch.mycompany.com", api_key="sk_secret")

The SDK also provides an AsyncClient for modern asyncio applications like FastAPI:

from stitch import AsyncClient

async with AsyncClient("http://localhost:8080") as client:
    run = await client.run(process_order, input={"amount": 100})
    result = await run.wait()

Requirements

  • Python ≥ 3.9

License

MIT

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

stitch_eng_sdk-0.2.1.tar.gz (38.1 MB view details)

Uploaded Source

Built Distribution

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

stitch_eng_sdk-0.2.1-py3-none-any.whl (38.6 MB view details)

Uploaded Python 3

File details

Details for the file stitch_eng_sdk-0.2.1.tar.gz.

File metadata

  • Download URL: stitch_eng_sdk-0.2.1.tar.gz
  • Upload date:
  • Size: 38.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for stitch_eng_sdk-0.2.1.tar.gz
Algorithm Hash digest
SHA256 602327f4078785a639fabbbefcfd1f557e311a40be0c4f7db619234f7a7c2946
MD5 db05c63a8c376fd23c38079f56ec1ece
BLAKE2b-256 b18e04b5300496731a9628471f80c2ba3e572f30d94df44dc98a29915163f9ff

See more details on using hashes here.

File details

Details for the file stitch_eng_sdk-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: stitch_eng_sdk-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 38.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for stitch_eng_sdk-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b3f7d26309c79f0e153cdfb6499236cd9e8c127b3321ef4da48ffa4855df8058
MD5 a37a3a84f5ca16435d38d2e917c6f9b0
BLAKE2b-256 fb1d61f489145913aedbd3b42ad95a07327481dc4ff8455641745e550c0af47f

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