Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for Automation Difficulty: Advanced ClaudeChatGPT

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

More Automation prompts & error guides

Browse every Automation prompt and troubleshooting guide in one place.

Free download · 368-page PDF

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.