What problem does it solve?
Multi-step operations in distributed agents can fail partway through, leaving systems in inconsistent states. This Skill guides you through adding saga-pattern transactions to Rust Golem agents so every step has a compensation action that automatically rolls back completed work when a failure occurs.
Core Features & Use Cases
- Operation Definition: Create operations with paired execute and compensate functions using
sync_operation for synchronous logic or operation with pinned async closures for async logic.
- Fallible Transactions: Use
fallible_transaction to compensate completed steps and return the error when a step fails.
- Infallible Transactions: Use
infallible_transaction to compensate and retry the entire transaction until it eventually succeeds.
- Use Case: Build an order-processing agent that reserves inventory and then charges payment; if the payment step fails, the inventory reservation is automatically cancelled in reverse order.
Quick Start
Add a saga transaction to my Rust Golem agent that reserves inventory and charges a payment with automatic compensation on failure.