Open Source · Production Ready

Workflow Orchestration Made Simple for Python

Build distributed, durable, long-running business processes with straightforward Python code. Event sourcing, automatic recovery, and horizontal scaling — all built in.

$ pip install pyworkflow-engine

Everything you need for production workflows

Built on battle-tested Celery and Redis. PyWorkflow handles the hard parts of distributed systems so you can focus on business logic.

Distributed Execution

Workflows execute across Celery workers for horizontal scaling. Start with one worker, scale to hundreds.

Event Sourcing & Durability

Every state change is recorded as an event. Workflows recover from any failure through deterministic replay.

Automatic Recovery

Configurable retry strategies with backoff. Distinguishes between transient and permanent failures automatically.

Sleep for Days

Suspend workflows for minutes, days, or months without holding connections, threads, or memory. Resume automatically.

Built-in Scheduling

Run workflows on cron, intervals, or calendar-based schedules. No external scheduler needed.

Complete Audit Trail

Append-only event log gives you full visibility into every workflow execution. Debug with ease.

Just Python. No YAML. No DSLs.

Define workflows with decorators and async functions you already know. Steps are retryable, workflows are durable, and sleeps release all resources.

  • Decorate functions as @workflow and @step
  • Await steps like regular async calls
  • Sleep for days without consuming resources
  • Automatic retry on transient failures
onboarding.py
from pyworkflow import workflow, step, start, sleep

@step()
async def send_welcome_email(user_id: str):
    print(f"Sending welcome email to {user_id}")
    return f"Email sent to {user_id}"

@step()
async def send_tips_email(user_id: str):
    print(f"Sending tips email to {user_id}")
    return f"Tips sent to {user_id}"

@workflow()
async def onboarding(user_id: str):
    await send_welcome_email(user_id)
    await sleep("1d")  # Sleeps 1 day, no resources held
    await send_tips_email(user_id)
    return "Onboarding complete"

run_id = start(onboarding, user_id="user_123")

Built for real-world use cases

From simple automations to complex multi-step business processes, PyWorkflow handles it all.

User Onboarding

Multi-step onboarding flows with timed emails, verification checks, and progressive engagement sequences.

Welcome email → wait 1 day → tips email → wait 3 days → survey

Order Processing

End-to-end order pipelines handling payment, inventory, fulfillment, and customer notifications.

Validate → charge → reserve inventory → ship → notify

ETL & Data Pipelines

Extract, transform, and load data across systems with automatic retry on transient failures.

Extract API → transform → validate → load DB → report

Approval Workflows

Human-in-the-loop workflows that pause for manual approvals via webhooks or external events.

Submit request → await approval → provision → notify

Scheduled Jobs

Recurring workflows on cron, interval, or calendar schedules with built-in scheduling.

Every Monday 9am → generate report → email team

Drip Campaigns

Multi-touch marketing sequences with precise timing, conditions, and personalization.

Sign up → wait 2h → email 1 → wait 3d → email 2

Up and running in 5 minutes

From zero to production-ready workflows in three simple steps.

1

Install & Scaffold

Install PyWorkflow with pip and scaffold your project in seconds with the CLI.

pip install pyworkflow-engine
pyworkflow quickstart
2

Define Your Workflows

Write workflows and steps using simple Python decorators and async functions.

@workflow()
async def my_flow(data):
    result = await my_step(data)
    return result
3

Run & Scale

Start the worker and run your workflows. Scale horizontally by adding more workers.

pyworkflow worker run
pyworkflow workflows run my_flow \
  --input '{"key": "value"}'

Stay in the loop

Get updates on new releases, tutorials, and tips for building better workflows. No spam, unsubscribe anytime.