Installation
Install PyWorkflow using pip:Create a New Project
The fastest way to get started is with thequickstart command:
- Create a
workflows/directory with sample workflows - Generate
pyworkflow.config.yamlconfiguration - Optionally start Docker services (Redis + Dashboard)
Quickstart Output Example
Quickstart Output Example
Non-Interactive Mode
For CI/CD or scripting, use non-interactive mode:Manual Setup
If you prefer to set up manually or need more control:- Docker Compose (Recommended)
- Manual
Generate Docker configuration and start services:This starts Redis and the PyWorkflow Dashboard.
Your First Workflow
Create a simple onboarding workflow that sends emails with delays:What Happens Under the Hood
1
Workflow Starts
Your workflow is dispatched to an available Celery worker.
2
Welcome Email Sent
The
send_welcome_email step executes and the result is recorded.3
Workflow Suspends
When
sleep("1d") is called, the workflow suspends and the worker is freed.
Zero resources are consumed during the sleep period.4
Automatic Resumption
After 1 day, Celery Beat automatically schedules the workflow to resume.
5
Tips Email Sent
The workflow picks up where it left off, sending the tips email.
6
Workflow Completes
The final result is recorded and the workflow is marked as complete.
Key Concepts
Workflows
Top-level orchestration functions that coordinate steps and handle business logic.
Steps
Isolated, retryable units of work that run on Celery workers.
Sleep
Pause workflows for any duration without consuming resources.
Events
Event sourcing provides durability and deterministic replay.
Adding Error Handling
Make your workflows fault-tolerant with automatic retries:Running in Parallel
Execute multiple steps concurrently usingasyncio.gather():
Next Steps
Core Concepts
Learn about workflows, steps, and event sourcing in depth.
Error Handling
Build fault-tolerant workflows with retry strategies.
Testing
Write unit and integration tests for your workflows.
Deployment
Deploy to production with Docker and Kubernetes.