What problem does it solve?
Long-running Golem agents accumulate large oplogs from heartbeats, polling loops, and frequent state changes, making recovery slow because every restart replays the full history. This Skill shows how to enable snapshotting in Scala agents so recovery starts from the latest snapshot, and how to support manual snapshot-based component updates.
Core Features & Use Cases
- Automatic JSON Snapshotting: Mix
Snapshotted[S] into the agent implementation to serialize a case class state via zio-schema with no manual serialization code.
- Custom Binary Hooks: Define
saveSnapshot() and loadSnapshot() convention methods for compact binary encoding or cross-language compatibility.
- Flexible Snapshot Policies: Configure
every(N) or periodic(duration) modes in the @agentDefinition annotation to control snapshot frequency.
- Use Case: A counter agent invoked thousands of times per day enables
snapshotting = "every(10)" with Snapshotted[CounterState], so recovery replays only the entries after the latest snapshot instead of the entire oplog.
Quick Start
Add snapshot-based recovery to my Scala Golem agent by enabling snapshotting in the agent definition and mixing in Snapshotted with a case class state.