saga-orchestration

Implement saga patterns for distributed transactions with compensating actions across microservices.

Updated Apr 23, 2026
One-click install
npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill saga-orchestration-sanketadlak
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: saga-orchestration
Source: https://github.com/SanketAdlak/PDMProjectDesign/tree/main/.agents/skills/saga-orchestration
Command: npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill saga-orchestration-sanketadlak

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires prometheus-client, and includes references (resource) components.

What problem does it solve? Coordinating transactions across multiple microservices without two-phase commit leaves systems vulnerable to partial failures and inconsistent state. This Skill provides orchestration and choreography saga patterns with compensating transactions, idempotency guards, and timeout handling so distributed workflows like order fulfillment and bank transfers roll back cleanly on failure. ## Core Features & Use Cases - Orchestration and Choreography Templates: Ready-to-adapt Python implementations for both coordinator-driven and event-driven saga styles, including a full abstract SagaOrchestrator base class. - Compensation and Idempotency Patterns: Reverse-order rollback logic, idempotent step guards, and DLQ recovery workers that keep compensation paths safe under retries and restarts. - Production Monitoring: Prometheus metrics, stuck-saga PromQL alerts, and per-step timeout configuration for detecting and recovering from hung workflows. - Use Case: Build an order fulfillment flow spanning inventory, payment, shipping, and notification services where a payment failure automatically releases the inventory reservation and notifies the customer. ## Quick Start Ask the AI to implement an orchestrated saga for your multi-service workflow, listing your participant services, their steps, and the compensation action for each step.

Frequently Asked Questions about saga-orchestration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a saga pattern for distributed transactions in microservices?

Define ordered steps with an action command and a compensation command for each participant service, then use an orchestrator to dispatch commands and track state. On any step failure, run compensations in reverse order for all completed steps.

Saga orchestration vs choreography: which should I choose?

Choose orchestration when you need explicit step tracking, retries, and centralized visibility since it is easier to debug. Choose choreography when you want loose coupling and independently evolving services, accepting that flows are harder to trace.

How do I make saga steps idempotent against duplicate messages?

Store an idempotency key before executing each step and check for an existing record on every command delivery. If found, return the cached result without side effects, which protects against broker replays and orchestrator restarts.

Why is my saga stuck in COMPENSATING state?

A compensation handler is throwing an unhandled exception and never publishing a completion event. Ensure every compensation publishes a result even when the resource is already rolled back, and add dead-letter queue handling to compensation consumers.

How do I handle saga step timeouts with different SLAs per service?

Configure per-step timeouts rather than a single global timeout, since steps like payment and shipping have different latency profiles. Schedule a watchdog job per step that triggers compensation only if the step is still executing when its deadline passes.