Skip to main content

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

  1. Before each ctx.call(), state is checkpointed
  2. If execution fails, the envelope captures the failure point
  3. On resume, execution continues from the last successful checkpoint
  4. 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

StateDescription
PENDINGWaiting to start
RUNNINGCurrently executing
PAUSEDWaiting for external event
COMPLETEDSuccessfully finished
FAILEDExecution failed

Next Steps