golem-recurring-task-rust

Implements recurring cron-like tasks in Rust Golem agents via self-scheduled invocations.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Golem agents have no built-in cron scheduler, so developers need a durable pattern to run periodic work like polling, cleanup, and heartbeats that survives agent crashes and restarts.

Core Features & Use Cases

  • Self-Scheduling Pattern: The agent calls its generated client's schedule_ method on itself at the end of each invocation, creating a durable recurring loop.
  • Exponential Backoff: Increase delays on repeated failures and reset on success, with a configurable maximum interval cap.
  • Cancellation Support: Stop loops via schedule_cancelable_ variants returning a CancellationToken, a simple state flag, or the golem agent invocation cancel CLI command.
  • Use Case: Build an agent that polls an external API every 60 seconds for new work items, processes them, and reschedules itself — recovering automatically after a crash because the pending invocation is durable.

Quick Start

Ask the AI to implement a recurring polling task in a Rust Golem agent that reschedules itself every 60 seconds using self-scheduling.

Frequently Asked Questions about golem-recurring-task-rust

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

FAQPage Schema
How do I create a recurring task in a Golem Rust agent?

Have the agent call its generated client's schedule_ method on itself at the end of each invocation, passing a Datetime set to the desired future time. This creates a durable loop where each run schedules the next one.

How to cancel a scheduled invocation in Golem?

Use the schedule_cancelable_ variant of the generated client method, which returns a CancellationToken you can store and cancel later. Alternatively, use a boolean state flag checked at the start of the method, or run golem agent invocation cancel from the CLI with the idempotency key.

Does a scheduled Golem agent invocation survive crashes?

Yes, scheduled invocations are durable. If the agent crashes or restarts, the pending scheduled invocation still fires at the designated time and the agent recovers to execute it.

How do I add exponential backoff to a polling agent?

Track consecutive failures in agent state, then compute the delay as base interval times 2 raised to the failure count, capped at a maximum interval. Reset the counter to zero and restore the base interval on success.

Why does my recurring Golem agent recover slowly over time?

Each scheduled tick appends entries to the agent's oplog, so recovery replays the full history as it grows. Enable periodic snapshotting with the snapshotting attribute so recovery starts from the latest snapshot instead of replaying every tick.