Skip to content
Pyrula
Pre-release: the packages are not on PyPI yet, so pip install does not resolve. Build from source to try it today.

Workflows

Straight-line async Python that survives crashes. Finished steps are read back from the run’s journal, not re-run.

from pyrula.workflows import step, workflow
@step
def reserve(order: str) -> None:
reserve_inventory(order)
@step
def charge(order: str) -> None:
charge_card(order)
@step
def receipt(order: str) -> dict:
return send_receipt(order)
@workflow(name="checkout")
async def checkout(ctx, order: str) -> dict:
await reserve(order)
await charge(order)
await ctx.sleep(3600) # the worker is freed while it waits
return await receipt(order)

Start with the Quickstart.

You want to Use Guide
Start runs, signal, query, update, wait for results WorkflowClient Starting and talking to runs
Run a side effect once @step, ctx.once Steps
Retry, or fail fast on bad input RetryPolicy, Transient / Poison / Fatal Errors and retries
Wait for time ctx.sleep, ctx.sleep_until Timers
Wait for an outside event, expose state ctx.wait_for_signal, ctx.on_query, ctx.on_update Timers, signals and updates
Ask a human ctx.interrupt Human-in-the-loop
Run steps in parallel, start sub-workflows ctx.gather, ctx.run_child Parallel steps and child runs
Cap per-tenant concurrency or rate, batch events Limit, Rate, Collect, Debounce Flow control
Run on a schedule Schedule Schedules
Ship code with runs in flight version=, ctx.patched Versioning and deploys
Process a Kafka topic @kafka_workflow Kafka
Serve runs over HTTP RunRouter Serving over HTTP
Trace and measure OpenTelemetry Observability

Agents are built on this engine.

View this page as Markdown