golem-add-transactions-moonbit

Implements saga-pattern transactions with compensation logic in MoonBit Golem agents.

1.5k|212|Updated Nov 24, 2023
One-click install
npx skills add https://github.com/golemcloud/golem --skill golem-add-transactions-moonbit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golem-add-transactions-moonbit
Source: https://github.com/golemcloud/golem/tree/main/golem-skills/skills/moonbit/golem-add-transactions-moonbit
Command: npx skills add https://github.com/golemcloud/golem --skill golem-add-transactions-moonbit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Multi-step operations in distributed agents can fail partway through, leaving systems in inconsistent states. This Skill shows how to implement saga-pattern transactions in MoonBit Golem agents so that failed steps trigger compensating actions in reverse order, keeping workflows consistent.

Core Features & Use Cases

  • Manual Saga Implementation: Build execute/compensate step pairs using Golem's oplog and atomic operation APIs from @golem_sdk/api, since the MoonBit SDK lacks a high-level transaction API.
  • Fallible and Infallible Transactions: Return errors with reverse-order compensation for fallible sagas, or use set_oplog_index to rewind and retry entire transactions for infallible semantics.
  • Use Case: Imagine an order-processing agent that reserves inventory and then charges a payment. If the payment fails, the Skill's pattern automatically cancels the reservation, preventing orphaned holds.

Quick Start

Ask the AI to add a saga-pattern transaction with compensating actions to my MoonBit Golem agent for a multi-step order workflow.

Frequently Asked Questions about golem-add-transactions-moonbit

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

FAQPage Schema
How do I implement transactions in a MoonBit Golem agent?

Implement saga-pattern transactions manually using Golem's oplog APIs from @golem_sdk/api. Wrap each step in with_atomic_operation, track completed steps, and run compensating functions in reverse order when a step fails.

Does the MoonBit Golem SDK support saga transactions natively?

No, the MoonBit SDK does not yet provide high-level transaction macros like Rust's fallible_transaction or infallible_transaction. You must build sagas manually with oplog primitives, though a future SDK release may add dedicated support.

What is the difference between fallible and infallible transactions in Golem?

A fallible saga compensates completed steps and returns an error on failure. An infallible saga compensates and then calls set_oplog_index to rewind execution to a checkpoint, retrying the entire transaction automatically.

Why must compensation actions be idempotent in saga patterns?

Compensation functions may be invoked more than once during retries, so they must produce the same result on repeated calls. Non-idempotent compensations can cause duplicate refunds or inconsistent state.

How do I roll back a Golem agent to a previous state?

Save a checkpoint with get_oplog_index, then call set_oplog_index with that position to rewind execution. Golem re-executes side-effecting calls from that point, which may return different results on retry.