WorkflowEnvelope
The WorkflowEnvelope provides durable execution boundaries for workflows. It enables checkpoint and resume for long-running operations.
Durability Model
Each ctx.call() is a potential checkpoint:
@workflow(durable=True)
def long_workflow(self, ctx):
# Checkpoint 1
step1 = ctx.call(self.expensive_operation)
# Checkpoint 2 - if system fails here, resumes from step1
step2 = ctx.call(self.another_operation, data=step1)
# Checkpoint 3
final = ctx.call(self.finalize, data=step2)
return final
How It Works
- Before each
ctx.call(), state is checkpointed - If execution fails, the envelope captures the failure point
- On resume, execution continues from the last successful checkpoint
- Results are deterministically replayed
Configuration
from waxell_runtime import RuntimeConfig
config = RuntimeConfig.get()
config.envelope_backend = "redis" # Production
config.envelope_backend = "memory" # Development
Envelope States
| State | Description |
|---|---|
PENDING | Waiting to start |
RUNNING | Currently executing |
PAUSED | Waiting for external event |
COMPLETED | Successfully finished |
FAILED | Execution failed |
Next Steps
- Backends - Configure production backends
- Production Guide - Deploy durable workflows