Skip to main content
Uses local.WithLocalConfig(&local.LocalConfig{Engine: engine}) instead of the SDK-built default engine. You create and own the durable-go engine — required for AES-GCM payload encryption, journal MAC, and a step-token key that survives a process restart. Same split as temporal.WithTemporalClient. Source: examples/agent_with_durable_engine/

What it demonstrates

  • durable.NewEngine with WithPayloadCodec, WithJournalMACKey, WithStepTokenKey
  • local.WithLocalConfig(&local.LocalConfig{Engine: engine}) on NewAgent
  • Caller-owned engine lifecycle (defer engine.Close() — a.Close() does not close it)

Run

From examples/ (local runtime only — no Temporal or Restate):
Optional env (hex). If unset, the example generates random keys and a temp dataDir:

Key code

For simple local dev without encryption or a stable token key, omit Engine — see In-Process runtime.

Expected output

The response is identical to the simple-agent — the difference is the journal (encrypted + MAC-signed) and caller-owned engine lifecycle.

Learn more

In-Process Runtime

SDK-built knobs vs caller-owned Engine

Temporal Client

Same ownership pattern for Temporal