Home/Architecture/State & Flow Management
Layer 7 of 20
State & Flow Management
State machines and workflow control: orchestration patterns, sagas, idempotency, and deterministic state transitions.
Responsibilities
- Provide orchestration patterns (sagas, state machines) for multi-step workflows.
- Guarantee idempotency and deterministic transitions.
- Make retries, timeouts, and compensation first-class.
Key interfaces
- Workflow definitions (states, transitions, invariants).
- Idempotency keys and deduplication.
- Compensation/rollback handlers for partial failures.
Operational signals
These are the measurements that tell you whether this layer is healthy in production.
- Workflow success rate and time-to-completion (p50/p95).
- Retry and compensation frequency.
- Dead-letter queue / stuck workflow backlog.
Failure modes
- Duplicate effects due to missing idempotency.
- Stuck workflows due to missing timeouts.
- Compensation logic that is unsafe or incomplete.
Production readiness checklist
- Require idempotency keys for all externally-triggered workflow steps.
- Add timeouts, dead-lettering, and operator tooling for stuck states.
- Test compensation paths (including partial success) regularly.