golem-retry-policies-moonbit

Configure composable retry policies for MoonBit Golem agents via manifest, SDK, and CLI.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Golem agents making HTTP requests, RPC calls, or database operations need controlled retry behavior for transient failures, but hand-rolling backoff logic per call is error-prone. This Skill explains Golem's semantic retry policy system so you can define, apply, and manage retries declaratively.

Core Features & Use Cases

  • Manifest-Based Policies: Define named retry policies with priorities and predicates in golem.yaml under retryPolicyDefaults, using base policies (exponential, periodic, fibonacci, immediate, never) and combinators (countBox, timeBox, clamp, jitter, andThen, union, intersect).
  • Runtime SDK Control: Build policies in MoonBit with Policy and Predicate builders, apply them to scoped code blocks with with_named_policy!, and query active policies via @api.get_retry_policies().
  • Live CLI Management: Create, update, list, and delete retry policies at runtime with golem retry-policy commands without redeploying agents.
  • Use Case: Configure an HTTP 5xx retry policy that only fires on transient server errors for HTTPS endpoints, with exponential backoff clamped to [100ms, 5s], 15% jitter, and a maximum of 3 retries.

Quick Start

Ask the AI to add a retry policy to golem.yaml that retries transient HTTPS errors with exponential backoff, jitter, and a maximum of five attempts.

Frequently Asked Questions about golem-retry-policies-moonbit

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

FAQPage Schema
How do I configure retry policies in Golem for a MoonBit agent?

Define named policies under retryPolicyDefaults in golem.yaml with a priority, predicate, and policy tree. Alternatively, build policies at runtime using the MoonBit SDK's Policy and Predicate builders and apply them with with_named_policy!.

How do I retry HTTP requests on 5xx status codes in Golem?

Create a policy whose predicate explicitly references the status-code property, such as propIn with values [500, 502, 503, 504]. Status-code retries are opt-in, so catch-all policies never trigger them.

What retry policy combinators does Golem support?

Golem supports countBox, timeBox, clamp, addDelay, jitter, filteredOn, andThen, union, and intersect combinators. These wrap base policies like exponential, periodic, fibonacci, immediate, and never to compose complex retry behavior.

Can I change Golem retry policies without redeploying my agent?

Yes, use the golem retry-policy CLI commands to create, update, get, list, and delete policies at runtime. Changes take effect immediately for running agents in the current environment.

Why is my status-code retry policy not firing for WASM traps?

The status-code property only exists in the outgoing HTTP response context, so trap-path decisions silently skip that policy. Design separate policies per context, for example a trap-type-keyed policy for guest traps.

What is the default retry policy in Golem when none is defined?

Golem activates a catch-all default policy with priority 0 and a true predicate. It allows up to 3 retries with exponential backoff at factor 3.0, delays clamped to [100ms, 1s], and 15% jitter.