Designing a durable event record for an AI agent

← Back to Blog & Articles

Begin every effectful run by creating a durable record before asking a model to reason.

The creation transaction assigns a globally unique run identifier, records the authenticated initiator and tenant, freezes the applicable policy bundle, and writes the initial goal in a normalized form. The initial event should also identify the runtime build, model route, and tool-contract set. These details appear mundane until an incident occurs after a deployment: without them, an operator cannot tell whether a surprising proposal came from changed evidence, a changed policy, a changed tool, or a changed model adapter.

An event is a statement that the runtime observed or decided something at a particular sequence position. It is not an unrestricted log line. Give events a type, schema version, timestamp, correlation identifier, actor, redacted payload, and links to the facts that justified the transition. Avoid overwriting an old event to make a projection look cleaner. Corrections are new events that identify what was superseded and why. This preserves the distinction between current belief and historical record, which is essential when evidence later proves false or a tool operation is reconciled differently.

The state projection should be reconstructible and cheap to replace. A minimal reducer maps ordered events into fields such as phase, current proposal, granted authority, remaining budget, outstanding approval, and terminal status. Reducers must be deterministic: given the same event stream, they produce the same state. Keep expensive derived data such as search indexes and dashboard aggregates outside the authoritative projection. They can be rebuilt after a bug or schema migration without changing what the system claims happened.

Continue with the book

Explore the full treatment, worked examples, and exercises in Building Production-Grade AI Agents.


Companion article for Building Production-Grade AI Agents, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.

Scroll to Top