Skip to content

Patterns

Best practices and design patterns for your Durable Execution SDK workflow code. For AWS Lambda service concerns like function versioning and aliases, CloudWatch logs, and X-Ray tracing, see the AWS Lambda durable functions best practices developer guide.

Best practices

Best practices for deterministic workflows.

  • Determinism and replay How replay works, which code must stay deterministic, and how to move non-determinism into steps.
  • Idempotency and retries When to use at-most-once versus at-least-once, idempotency tokens, and database patterns that tolerate retries.
  • Manage state Why checkpoint size matters, how to store references instead of payloads, and how to avoid size limits.
  • Step design Naming, granularity, decorators, error handling inside steps, and the boundary between orchestration and business logic.
  • Pause and resume Long waits, callbacks with timeouts, heartbeats, and polling external services with backoff.
  • Code organization Separating business logic from orchestration, using child contexts, and grouping configuration.