golemcloud/golem/golem-add-transactions-go
- community
Checking that the SKILL.md file is still in the repository.
Adding saga-pattern transactions with compensation to a Go Golem agent. Use when the user asks about transactions, sagas, compensation, rollback, Operation/Step, transaction.Fallible, transaction.Infallible, or multi-step operations that need undo logic in a Go Golem project.
Install
npx vskill@latest install golemcloud/golem/golem-add-transactions-goSKILL.md
Saga-Pattern Transactions (Go)
Overview
Golem supports the saga pattern for multi-step operations where each step has a compensation (undo). If a later step fails, the steps that already succeeded are compensated in reverse order. The saga helpers use ordinary guest control flow and durable host calls. They do not delete recorded history.
The Go API lives in the transaction package (github.com/golemcloud/golem/sdks/go/golem/transaction):
transaction.Operation[In, Out, E]— a compensable step, built withtransaction.NewOperation.tx.Step(op, input)— run an operation inside a transaction.transaction.Fallible[Out, E](...)— rolls back on failure and returns a
transaction.Failure[E].
transaction.Infallible[Out, E](...)— rolls back and retries the whole
transaction under the host policy, returning a Result.
Expected step failures are modeled as the error arm of a golem.Result (type E, often string). Caught panics also run compensation in reverse order. A fallible transaction re-panics with the original value only after complete rollback; partial rollback preserves both the original panic and compensation failure.
Steps
- Define each operation with
transaction.NewOperation(execute, compensate). - Choose a transaction flavor — fallible (report failure after rollback) or infallible (policy-driven retries after rollback).
- Run the steps with
tx.Step(op, input)inside the transaction body. - Handle the outcome — inspect the
golem.Resultfrom either helper.
Defining Operations
An operation pairs an execute action with the compensate that undoes it. execute is func(In) golem.Result[Out, E]; compensate receives both the original input and the output execute produced, and returns golem.Result[golem.Unit, E]. Compensation runs only if a later step fails.
Fallible Transactions
On a step failure, the completed steps are compensated (best-effort, in reverse) and a transaction.Failure[E] is returned — there is no retry. Run steps with tx.Step(op, input); return an error result from the body to trigger rollback.
transaction.Failure[E] fields:
Error E— the step failure that aborted the transaction.CompensationFailure golem.Option[E]—Some(...)if a compensation itself
failed during rollback (a partial rollback); None if every compensation succeeded.
RolledBackFully() bool— true when the rollback was complete.
Infallible Transactions
On a step failure, the completed steps are compensated in reverse and the helper starts a new guest-code attempt. Each attempt appends new durable calls and keeps the earlier attempts and compensations in history. After each completely compensated failure, resolve verb saga, noun the agent URN, with attempt/error-kind. next-retry-delay uses the existing host evaluator and opaque binary continuation; the SDK uses durable clocks and timers. No matching policy selects the agent default. Unbounded policies are rejected rather than silently capped. Count/time/never exhaustion and selector/evaluator errors return typed failures retaining the original failure. The helper returns a Result:
Use transaction.Infallible only when another policy-authorized attempt is appropriate. Compensation failure stops retries and returns a failure retaining both causes.
Not available in the Go SDK
The Rust SDK splits operations into sync_operation and operation (async), and its transactions are async and require wrapping bodies in boxed(async move { … }). The Go SDK has none of that — there is a single transaction.NewOperation, and transaction bodies are plain synchronous functions. Blocking work inside a step (HTTP, RPC, promises) suspends the fiber at its await point, so no async/boxed plumbing is needed. A step is a method on the transaction, tx.Step(op, input), so the error type comes from the transaction itself.
Guidelines
- Model expected step failures as the error arm of the step's
golem.Result;
reserve panic for unexpected failures, not business retry signals.
- Run every step with
tx.Step(op, input)— that is what records the
compensation to run on rollback.
- Keep compensation logic idempotent — it may run more than once (especially
under transaction.Infallible).
- Compensation runs in reverse order of execution.
- All steps in one transaction share the error type
E(commonlystring). - Use
transaction.Falliblewhen failure is an acceptable outcome;
transaction.Infallible when another policy-authorized attempt is appropriate.
- Host retry policies remain responsible for retryable individual calls. Reconstruction
repairs an eligible incomplete call at its own Start; it does not rerun completed steps.
Related Skills
| Skill | When to Load | |
|---|---|---|
golem-call-another-agent-go | Steps that call other agents via RPC | |
golem-make-http-request-go | Steps that call external HTTP APIs | |
golem-retry-policies-go | Tune how failing steps/operations are retried |
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinggolem-skills/skills/go/golem-add-transactions-go/SKILL.md
Popularity
- Repository stars
- 1,514
- Repository forks
- 210
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/golemcloud/golem/golem-add-transactions-go)