Configuring Agent Durability (Effect)
SkillAI & modelsGuides your agent to set Golem agents as durable or ephemeral and control how their state is persisted.
Use Configuring Agent Durability (Effect) in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add Configuring Agent Durability (Effect) and connect your AI. About a minute.
Also: Claude Code · Cursor · Codex
Then ask your AI: use the Configuring Agent Durability (Effect) 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 durable or ephemeral agent modes and scoped persistence levels in an Effect-based Golem project. Use when changing agent persistence, making an agent ephemeral, or controlling custom durable sections.
What this skill tells your AI
The instructions your AI receives, as published by golemcloud/golem in golem-skills/skills/effect/golem-configure-durability-effect/SKILL.md and read by Ahel’s review.
Effect Golem has two related but different controls:
defineAgent({ mode: ... })declares the agent type as durable or ephemeral.- The
Durabilitynamespace controls the persistence level of a section while an agent is running.
Use the declaration mode when the request is to make an agent durable, ephemeral, persistent, or stateless. Do not replace an agent-mode change with a runtime persistence-level wrapper.
Durable Agents (Default)
Durable agents have a persistent oplog. Golem records durable side effects and recovers the agent
by replaying that oplog after a failure or restart. Omitting mode defaults to "durable", but an
explicit value is often clearest:
import { Effect, Schema } from "effect";
import { defineAgent } from "@golemcloud/effect-golem";
export const Counter = defineAgent({
name: "Counter",
mode: "durable",
id: { name: Schema.String },
methods: {},
}).implement({ init: () => Effect.void, methods: () => ({}) });
Do not try to disable oplog writes while retaining normal durable recovery. If replay becomes slow because the oplog is long, keep the agent durable and add snapshots.
Durable with Periodic Snapshots
Snapshots keep the durable agent mode but let recovery restore saved state before replaying newer oplog entries. Define snapshot state with Effect Schema and select a snapshot strategy in the agent implementation:
import { Duration, Effect, Ref, Schema } from "effect";
import { Snapshot } from "@golemcloud/effect-golem";
const CounterState = Schema.Struct({ count: Schema.Number });
const snapshot = Snapshot.define({
schema: CounterState,
policy: Snapshot.policy.everyN(10),
});
const periodicSnapshot = Snapshot.define({
schema: CounterState,
policy: Snapshot.policy.periodic(Duration.seconds(30)),
});
Set the chosen definition as the agent's top-level snapshotting field and use Snapshot.ref<Saved>()
when the runtime state is a Ref of that schema:
defineAgent({
name: "Counter",
mode: "durable",
id: { name: Schema.String },
snapshotting: snapshot,
methods: {},
}).implement({
init: () => Ref.make({ count: 0 }),
methods: (state) => ({
// Existing method handlers that use state...
}),
snapshot: Snapshot.ref<{ count: number }>(),
});
Keep the saved value schema-serializable. everyN accepts a positive
integer from 1 through 65,535. periodic accepts an Effect Duration.Input such as
Duration.seconds(30).
Ephemeral Agents
An ephemeral agent has no persistent oplog. Use it only when the work does not require durable recovery, such as stateless transformations or request adapters:
export const StatelessHandler = defineAgent({
name: "StatelessHandler",
mode: "ephemeral",
id: { name: Schema.String },
methods: {},
}).implement({ init: () => Effect.void, methods: () => ({}) });
Ephemeral agents are not addressable by agent id fields alone through the Effect SDK's
generated client: their client exposes getPhantom and newPhantom, but not get. Do not depend
on in-memory state surviving failures or restarts.
Switching an Existing Agent
Change only the top-level mode field in the existing defineAgent metadata unless the request
also requires a state redesign.
To switch to ephemeral:
mode: "ephemeral",
To switch back to durable:
mode: "durable",
The values are lowercase TypeScript string literals. Preserve the agent's name, constructor
parameters, methods, implementation registration, and snapshot definition when the task only asks
for a mode change. Run golem build after editing; do not edit generated files under golem-temp/.
Runtime Persistence Levels
Import Durability as a namespace from @golemcloud/effect-golem. It is not an Effect service tag
and must not be yielded as yield* Durability.
For specialized code implementing custom durability, temporarily select a persistence level with the scoped combinator:
import { Durability } from "@golemcloud/effect-golem";
const result = Durability.withPersistenceLevel(
Durability.PersistenceLevel.persistNothing,
customDurabilityEffect,
);
The available levels are:
| Value | Meaning |
|---|---|
Durability.PersistenceLevel.smart | Default, recommended host-managed durable behavior |
Durability.PersistenceLevel.persistRemoteSideEffects | Persist remote side effects only |
Durability.PersistenceLevel.persistNothing | Run the section without replay or restoration guarantees |
withPersistenceLevel restores the previous level when its Effect exits. For low-level integration
code, Durability.getPersistenceLevel is an Effect value and
Durability.setPersistenceLevel(level) changes the host mode directly.
persistNothing does not make the agent type ephemeral, and smart does not make an
ephemeral agent durable. Only the defineAgent mode field changes the agent type metadata shown
by golem agent-type list.
Choosing a Mode
| Use case | Choice |
|---|---|
| Counter, shopping cart, workflow, or recoverable external calls | Durable (default) |
| Stateless transformer or adapter with no recovery requirement | Ephemeral |
| Long-running durable agent with a growing oplog | Durable with snapshots |
| Custom library section that implements its own live/replay protocol | Scoped Durability.PersistenceLevel |
When in doubt, keep the agent durable. Treat ephemeral mode and persistNothing as explicit
opt-outs from different durability guarantees, not as general performance switches.
Signals
- GitHub stars
- 2k
- Forks
- 210
- Last commit
- Oct 2026
Advanced
- Item type
- skill
- Key
golem-configure-durability-effect- Source
- github.com/golemcloud/golem
Related picks
Skill · mattpocock
The pick for TypeScripttypescript-pro
Skill · jeffallan
The pick for TypeScriptskill-creator
Skill · anthropics
More in AI & modelstriage
Skill · mattpocock
More in AI & modelsalgorithmic-art
Skill · anthropics
More in AI & modelscode-review-and-quality
Skill · addyosmani
More in AI & models