Blog
Why Operational AI must read from and write to the same Authoritative State
AI agents that act on stale replicas or caches repeat and compound errors. Learn how Authoritative State, consistency guarantees and atomic writes prevent it.
Blog
AI agents that act on stale replicas or caches repeat and compound errors. Learn how Authoritative State, consistency guarantees and atomic writes prevent it.
An AI agent processes a customer refund and records the transaction in the primary database. It then checks a read replica to confirm the update, but replication is still in progress. The replica shows the order as unrefunded, so the agent issues the refund again. Without an effective idempotency check, the customer receives two refunds.
Faster replication makes this less likely to happen, while an idempotency key tied to the order helps prevent a second refund. But the underlying requirement is Authoritative State: a durable, consistent data source that allows agents to observe the changes on which they base their decisions.
For Operational AI, this means each decision has to account for the consequences of earlier actions. When multiple agents read and update shared records, the system also needs to validate the conditions governing each action at commit. That matters more as agents make more decisions against the same records.
How much delay is acceptable depends on the decision based on the data. A recommendation engine produces useful suggestions with user behavior that's 10 seconds old. A business intelligence dashboard may remain useful a minute behind its source, though stale analytical data can still lead to costly mistakes.
An operational agent is part of a Continuous Operating Loop:
It reads data to assemble context
Decides what to do
Takes an action that changes the inputs that inform later decisions
If that action reserves inventory or changes a balance, the next decision has to incorporate that change. Automation turns an outdated observation into another action before it’s reviewed.
As the loop repeats, later decisions compound the original error.
An update can become unavailable to the agent at several stages of the loop:
Authoritative State: A lagging replica misses an acknowledged write. Promoting that replica during failover also eliminates the update from later reads, unless replication and failover protocols prevent it.
Relevant Context: Feature refresh schedules and cache expiration cause an agent to combine values from different times. Without a consistent snapshot, a customer profile assembled from those values may describe a state that never existed.
Decision: Separate lookups return different versions of related records. A successful response from every source doesn't mean the combined observations are consistent.
Action: Two agents read the same available balance, and both decide to spend it. A condition checked before the write leaves a race unless the system checks it atomically when applying the change.
Consequence → Updated State: Change data capture or downstream processing falls behind. The primary stores the update durably, but the next cycle reads a downstream copy before the update arrives.
AdTech, fraud detection, and payments have dealt with stale reads and concurrent updates for years. Agents bring those concerns into more workflows, including customer support, provisioning, and scheduling. A support agent checking a refund now needs the same safeguards as the payment workflow it calls.
Frequent decisions and parallel lookups also increase load on shared records. For an agent performing 50 reads per decision, a 1% chance that each read exceeds a latency threshold produces roughly a 40% chance that at least one will exceed it, assuming independent delays. Google's The Tail at Scale[1] explains why fan-out makes latency outliers harder to avoid. If the agent needs all 50 responses, one slow read delays the decision.
A fast read doesn't necessarily return the latest data. Whether it includes a recent update depends on where the read is directed and the consistency guarantees of its source. Even when a read returns the latest state, another writer can change the record before the agent acts on it.
When an agent makes decisions every few seconds, but updates take a similar amount of time to reach its read source, the agent may complete several decision cycles using outdated information. How often this happens depends on when reads occur, where they're routed, and the workload's consistency guarantees.
Caches, replicas, streams, and feature stores help systems handle more data requests, integrate data, and compute features. Asynchronous updates allow these systems to work independently, at the cost of a delay before copies agree.
An agent reading through that stack depends on each propagation or invalidation step. A backlog in a stream consumer, a missed cache invalidation, or a routing change during failover can leave it reading stale information. For decisions that depend on a recent update, the read path must provide the required visibility, or the system must validate the relevant conditions before committing the action.
Removing unnecessary copies reduces the number of places where an update falls behind, but the remaining read path still needs appropriate consistency guarantees. A synchronously maintained replica serves authoritative reads when the protocol supports them; reading from the primary alone doesn't protect against a concurrent change between observation and action.
Authoritative State can span multiple physical replicas. The database needs to preserve completed writes and serve reads with the guarantees the workflow needs.
These architectural considerations determine how well a system meets these requirements:
Durable, acknowledged writes: An acknowledged write must survive the failures the system commits to tolerate. Synchronous replication provides that protection only when the acknowledgment policy, persistence settings, replica placement, and failover protocol support it.
Consistency guarantees matched to each read: Read-your-writes lets a client see its own completed updates within the supported session scope. It doesn't impose a fixed freshness bound or guarantee visibility of another client's latest write. Real-time ordering needs linearizable operations: a read begun after a completed write must see that write or a later one. Related reads across records may still need to be combined in a transaction.
Atomic conditional writes and multi-record transactions: A conditional write can protect a condition for one record. Keeping related records consistent may require a transaction that prevents other operations from interfering with updates. The reads and writes on which that depends must be part of that transaction. External actions, such as issuing a payment, also need application safeguards against duplicate effects.
Predictable tail latency under mixed workloads: Popular campaign budgets and heavily used accounts concentrate competing reads and writes. Slow operations miss deadlines and create retries. The workflow needs to be told what to do when an operation times out and its outcome remains uncertain.
Version and timestamp metadata: A record version can support a conditional update or indicate that a value has changed since the last read. A timestamp helps determine age when its meaning and clock assumptions are known. Detecting staleness also requires a reference, such as a known version or a defined freshness bound; metadata alone cannot prove that a value is current.
Fewer asynchronous copies in the decision path: Use a cache or derived store between a write and a decision that depends on it only when you need it. In addition, the design must explain how the workflow handles delays and checks that requirements are met before taking action.
Bidding and fraud prevention show how much work shared operational state has to handle. Neither workload involves agents, but both make decisions against constantly changing records under tight time limits, the same demands agents bring to more workflows. Nativo's bidding platform, for example, serves more than 1.4 trillion bid requests per month. Nativo needed sub-millisecond reads for real-time bidding but consistently saw 3 to 4 milliseconds. After replacing its MongoDB user store and Memcached campaign cache with Aerospike, Nativo reported reads consistently under 1 millisecond, more than 70% faster than before.
Fraud scoring also depends on recent activity, including transaction counts over short windows. Forter makes decisions on more than $350 billion in transactions annually. Its migration to Aerospike helped reduce p99 latency from 13.3 milliseconds to 1.3 milliseconds and its server footprint from 178 to 50. Caulis reports that 99.9% of fraud detection requests complete in under 500 milliseconds.
Follow an update from when it's acknowledged to the next decision that relies on it. Then consider these questions, both under normal conditions and during peak loads or recovery:
For every source, track which decision uses it and what can go wrong if its data is old. Assign a freshness limit where time matters, and read-your-writes where the agent must see its own update. Identify conditions that need enforcement at commit, regardless of the read policy.
Measure propagation to the sources agents use. With decisions every 100 milliseconds and propagation taking 500 milliseconds, several cycles can occur before a copy shows the update. Compare the distribution of propagation delays with decision timing during peak writes and recovery. The p99 value describes the measured distribution; delays beyond it still need a recovery plan.
Find the operation that checks a condition and applies the change. Confirm that it protects all records involved, then trace a timeout and retry through any external service. A database transaction cannot, by itself, prevent a repeated payment request from producing a second payment.
Test whether acknowledged writes survive the failures covered by the design. See which requests the system rejects or delays and whether a promoted replica returns older state. Check how the agent resolves an uncertain outcome before retrying.
Include fallback paths used during outages. Mark synchronous and asynchronous transitions, then identify how the agent finds or tolerates lag on each path. A consistency guarantee on the normal route doesn’t help if recovery sends reads to an older copy.
Aerospike is the real-time state, context, and decision platform for Operational AI. For agents, that means keeping the records they read and update current and available, so each action's result reaches the next decision. The agent, its models, and the services that carry out actions keep their own responsibilities.
In strongly consistent namespaces, applications choose between session reads, which support read-your-writes, and linearizable reads, which reflect the latest completed writes across clients.
For workflows that need to coordinate changes across multiple records, Aerospike Database 8.0 introduced multi-record transactions. These provide strict serializability within a transaction and require a strongly consistent namespace, available in Enterprise Edition and Aerospike Cloud. Any reads that need to be part of the transaction's decisions must participate in it to receive those guarantees.
Every copy between a write and the next decision is another place an update can fall behind. Aerospike's fast point reads reduce the need for a separate cache in that path. Forter's migration consolidated its cache and database layers, simplifying the architecture while improving latency.
Aerospike also supports workloads that rely on frequently updated features. Its integration with Feast[2] lets applications serve these features through an online store, with freshness determined by how quickly updates reach Aerospike.
For applications spanning multiple geographic locations, the deployment model affects how quickly agents have access to the updated state. A multi-site cluster replicates synchronously across sites, with network distance affecting latency. By comparison, Cross Datacenter Replication replicates asynchronously between separate clusters, meaning an agent reading from a remote cluster could act on outdated information.
Operational AI brings a familiar database problem into far more applications. A delayed update, conflicting write, or uncertain transaction outcome can feed the next decision before anyone notices.
Jeffrey Dean and Luiz André Barroso. "The Tail at Scale." Communications of the ACM 56 (2013): 74-80. https://research.google/pubs/the-tail-at-scale/
Valentyn Kahamlyk and Francisco Javier Arceo. "Aerospike now available as a Feast online store." Feast Blog, July 18, 2026. https://feast.dev/blog/aerospike-feast-now-available/
For a deeper understanding and more insights, explore these additional resources.
See moreBlog
Blog
Blog
Blog