Skip to main content

Durable variables

Why you need it

Long-running work needs typed state that survives restarts and is readable across Steps and RPCs — without inventing a side database schema for every Flow.

Code examples

Choose an SDK (preference is sticky in this browser; default Python).

status = Attribute("status", str)

def execute(self, context, input):
status.set(context, "running")
return go_to(next_step, input)

Attributes are declared on the Flow and read/written from Steps and RPCs.

How Dex implements it

Dex stores Attributes as durable Flow state (optionally indexed). Workers receive Attribute values when executing WaitFor/Execute/RPC; updates are committed with Step decisions.

Traditional workarounds

Teams typically glue Redis/SQL + optimistic locking + custom APIs, then rehydrate state on every resume.