A compensating transaction is an operation designed to semantically undo the effects of a previously committed local transaction within a long-running, distributed business process, such as a Saga. Unlike a traditional database rollback, it does not revert the original operation but executes a new, inverse action to restore the business logic to a consistent state, acknowledging that some side effects may be irreversible. This pattern is fundamental to event-driven orchestration and fault tolerance in multi-agent systems.
