Skip to content

State Model ​

TPF uses several state surfaces. They solve different problems and should not be treated as interchangeable storage.

SurfacePurposeUse when
PersistenceDurable business recordsAPIs, reports, UIs, audit, or queryable outputs need saved domain data
CacheReusable derived outputsExpensive deterministic work should be reused during normal execution or replay
MaterializationLarge payload claim-checksPayloads are too large or awkward to carry inline through every boundary
Execution stateRuntime progress and recoveryQUEUE_ASYNC needs leases, retry timing, terminal status, or crash recovery
Await unitsDurable external waitingA flow must pause for callbacks, approvals, provider decisions, or long-running jobs
Checkpoint handoffCross-pipeline admissionOne pipeline finishes a stable output and another pipeline owns the next flow

Decision Path ​

  1. Query business data later? Use Persistence.
  2. Want to avoid recomputing a deterministic output? Use Caching.
  3. Carrying large content across boundaries? Use Field Materialization.
  4. Should work survive crashes? Use Queue-Async Runtime.
  5. Waiting for external reality? Use Await Boundaries.
  6. Handing off stable ownership to another pipeline? Use Checkpoint Handoff.

Replay Boundary ​

Replay is easier when each state surface has a single job.

Persistence is the durable business record. Cache is an optimization and replay accelerator. Execution state is runtime bookkeeping. Await state records external waiting and completion snapshots. Checkpoint handoff records a stable boundary between two pipeline owners.

When these responsibilities are mixed in application code, retries and replay become harder to reason about. Keep them explicit.