PATTERN Cited by 1 source
Append-only event log for agent state¶
Problem¶
An LLM agent turn is not a single request — it involves streaming tokens, calling tools, waiting for results, delegating to sub-agents, and potentially awaiting human approval. At any point the process can crash. All in-memory state (streaming connection, pending tool calls, turn progress) is lost.
Solution¶
Record every event in the agent's execution history to an append-only, immutable log. Each entry (prompt, tool response, model choice) becomes an unchangeable ledger entry. On crash, a new instance replays the log from the last entry and resumes.
Mechanism¶
[prompt] → [tool-call-1] → [tool-result-1] → [model-choice] → [tool-call-2] → ...
↓ ↓ ↓ ↓ ↓
log[0] log[1] log[2] log[3] log[4]
On recovery: new instance reads log, skips completed entries, resumes at log[N+1].
(Source: Agents platform post.)
Trade-offs¶
| Pro | Con |
|---|---|
| No lost turns; user sees continuation not spinner | Log storage grows linearly with turn length |
| Deterministic replay | Replay assumes idempotent tool calls (or deduplication) |
| Platform-independent (any storage backend) | Adds write latency per event (amortised by batching) |
Known uses¶
- systems/flue — "Durable Streams" (2026)
- concepts/distributed-log — same pattern at data-plane scale (Kafka, WAL)
Seen in¶
Related¶
- patterns/append-only-log-as-substrate — broader pattern family
- concepts/durable-streams — Flue's naming for this pattern
- concepts/durable-execution — runtime primitive that complements this