Configuring Agent Durability (Scala)
SkillAI & modelsGuides choosing between durable and ephemeral agent setups in a Scala Golem project.
Use Configuring Agent Durability (Scala) in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add Configuring Agent Durability (Scala) and connect your AI. About a minute.
Also: Claude Code · Cursor · Codex
Then ask your AI: use the Configuring Agent Durability (Scala) skill
Details
Instructions available. Your AI can read the instructions. Execution depends on the setup they require.
Account requirements not reviewed. Check the skill instructions before use; Ahel provides instructions and does not run this skill.
No other account needed.
Add Ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.
About this skill
Choosing between durable and ephemeral agents in a Scala Golem project. Use when the user asks about agent durability modes, making an agent stateless, or configuring agent persistence.
What this skill tells your AI
The instructions your AI receives, as published by golemcloud/golem in golem-skills/skills/scala/golem-configure-durability-scala/SKILL.md and read by Ahel’s review.
Durable Agents (Default)
By default, all Golem agents are durable:
- State persists across invocations, failures, and restarts
- Every side effect is recorded in an oplog (operation log)
- On failure, the agent is transparently recovered by replaying the oplog
- No special code needed — durability is automatic
You cannot opt out of oplog writes for a durable agent. The oplog is how durability works — every side effect must be recorded. If you are worried about oplog volume or replay cost (long-running agents, heartbeats, polling, recurring tasks), do not try to skip persistence. Use durable with periodic snapshots instead (see below).
A standard durable agent:
import golem.runtime.annotations.{agentDefinition, agentImplementation}
import golem.BaseAgent
import scala.concurrent.Future
@agentDefinition(mount = "/counters/{name}")
trait CounterAgent extends BaseAgent {
class Id(val name: String)
def increment(): Future[Int]
def getCount(): Future[Int]
}
@agentImplementation()
final class CounterAgentImpl(private val name: String) extends CounterAgent {
private var count: Int = 0
override def increment(): Future[Int] = Future.successful {
count += 1
count
}
override def getCount(): Future[Int] = Future.successful(count)
}
Durable with Periodic Snapshots
Same durability guarantees as the default durable mode, but recovery starts from the latest snapshot instead of replaying the full oplog from the beginning. Use this whenever the oplog grows unboundedly — long-running agents, high-frequency state changes, heartbeats, polling loops, recurring tasks.
@agentDefinition(snapshotting = "every(10)") // snapshot every 10 successful calls
trait CounterAgent extends BaseAgent { ... }
@agentDefinition(snapshotting = "periodic(30s)") // or at most once per interval
trait HeartbeatAgent extends BaseAgent { ... }
See golem-custom-snapshot-scala for snapshotting modes and Snapshotted[S] / custom binary save/load hooks.
Ephemeral Agents
Use ephemeral mode for stateless, per-invocation agents where persistence is not needed:
- State is discarded after each invocation completes
- No oplog is maintained — lower overhead
- Useful for pure functions, request handlers, or adapters
import golem.runtime.annotations.{agentDefinition, DurabilityMode}
@agentDefinition(mode = DurabilityMode.Ephemeral)
trait StatelessHandler extends BaseAgent {
def handle(input: String): Future[String]
}
When to Choose Which
| Use Case | Mode |
|---|---|
| Counter, shopping cart, workflow orchestrator | Durable (default) |
| Stateless request processor, transformer | Ephemeral |
| Long-running saga or multi-step pipeline | Durable (default) |
| Pure computation, no side effects worth persisting | Ephemeral |
| Agent that calls external APIs with at-least-once semantics | Durable (default) |
| Long-running agent with heartbeats, polling, or recurring tasks | Durable + periodic snapshots |
| Any durable agent whose oplog grows so large that replay is slow | Durable + periodic snapshots |
When in doubt, use the default (durable). Ephemeral mode is an optimization for agents that genuinely don't need persistence. Add periodic snapshots whenever recovery time matters — see golem-custom-snapshot-scala.
Signals
- GitHub stars
- 2k
- Forks
- 210
- Last commit
- Oct 2026
Advanced
- Item type
- skill
- Key
golem-configure-durability-scala- Source
- github.com/golemcloud/golem
More in AI & models
Skill · anthropics
More in AI & modelstriage
Skill · mattpocock
More in AI & modelswayfinder
Skill · mattpocock
More in AI & modelsalgorithmic-art
Skill · anthropics
More in AI & modelscode-review-and-quality
Skill · addyosmani
More in AI & modelsmarketing-psychology
Skill · coreyhaines31
More in AI & models