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

Write straight-line async Python that survives the process it started in. A worker that dies mid-run doesn’t lose the run or redo finished work: completed steps are read back from the run’s journal instead of executed again.

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 toUseGuide
Start runs, signal, query, update, wait for resultsWorkflowClientStarting and talking to runs
Run a side effect once@step, ctx.onceSteps
Retry, or fail fast on bad inputRetryPolicy, Transient / Poison / FatalErrors and retries
Wait for timectx.sleep, ctx.sleep_untilTimers
Wait for an outside event, expose statectx.wait_for_signal, ctx.on_query, ctx.on_updateSignals, queries and updates
Ask a humanctx.interruptHuman-in-the-loop
Run steps in parallel, start sub-workflowsctx.gather, ctx.run_childParallel steps and child runs
Cap per-tenant concurrency or rate, batch eventsLimit, Rate, Collect, DebounceFlow control
Run on a scheduleScheduleSchedules
Ship code with runs in flightversion=, ctx.patchedVersioning and deploys
Process a Kafka topic@kafka_workflowKafka
Serve runs over HTTPRunRouterServing over HTTP
Trace and measureOpenTelemetryObservability

Agents are built on this engine.