Temporal Saga and Compensation Workflow Design Prompt
Design a Temporal workflow for a long-running, multi-service operation with reliable compensation (rollback) steps so partial failures never leave systems in an inconsistent state.
- Target user
- Platform and backend engineers building durable orchestration
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior platform engineer who designs durable orchestration with Temporal, including saga and compensation patterns for distributed transactions. I will provide: - The business operation and the ordered list of service calls it performs - Which steps are idempotent and which have side effects (charges, provisioning, emails) - Timeout, retry, and SLA expectations - Any steps that require human approval Your job: 1. **Model the workflow** — define the Temporal workflow and the activities, marking each activity idempotent or not and explaining how to make non-idempotent ones safe (idempotency keys, dedup tables). 2. **Design the saga** — for each side-effecting forward step, define its compensating activity, and specify the reverse-order rollback chain. 3. **Retry and timeout policy** — propose `RetryPolicy` and `StartToCloseTimeout` per activity; flag steps that must NOT auto-retry. 4. **Failure handling** — show how to catch activity failure, trigger compensations, and surface a non-retryable terminal state. 5. **Approval gates** — model human approval as a signal or update; block irreversible steps until approved. 6. **Observability** — list the search attributes, metrics, and replay-safe logging to add. 7. **Test plan** — enumerate failure-injection scenarios to validate compensation. Output as: (a) a workflow/activity diagram in text, (b) pseudo-code skeletons, (c) the compensation matrix, (d) the test matrix. Mark every compensating action that deletes, refunds, or de-provisions as requiring an explicit confirmation gate before it runs in production.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Long-Running Workflow Versioning and Safe Migration Design Prompt
Design a versioning and migration strategy for long-running orchestration workflows (Temporal, Step Functions, Cadence, Airflow) so deploying new workflow code does not break in-flight executions started under the old definition — using version gates, drain windows, or parallel definitions.
-
Workflow Orchestration with Temporal and Argo Workflows Prompt
Design durable, observable multi-step operational workflows — choosing between Temporal, Argo Workflows, and n8n — with retries, compensation, timeouts, and human-approval steps for long-running ops processes.
-
Multi-Step Ops Workflow Checkpoint Orchestration Prompt
Orchestrate a long, multi-step operational workflow (migration, rollout, recovery) so it is restartable from durable checkpoints, compensates partial progress on failure, and never leaves the system in an unknown half-applied state when a step crashes mid-flight.
-
Runbook to Temporal Workflow Conversion Prompt
Convert a manual incident runbook into a Temporal workflow with durable activities, retries, human-signal approval steps, and compensation — so the automation survives crashes and resumes where it left off.
More Automation prompts & error guides
Browse every Automation prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.