A customer has Gold membership and three completed purchases. That's enough to qualify for a rewards offer.
Then one of those purchases is refunded.
The business decision has changed. But what happens to the data that powers the Rewards API—and the AI agent relying on that API?
This is a useful example of a broader data architecture challenge: How do we keep operational read models current as source data changes?
The architectural pattern
Consider a simple flow:
PostgreSQL → Change Data Capture → Incremental SQL → Maintained Eligibility View → Rewards API → AI Agent
Here's what happens:
1. The source changes. A refund is recorded in PostgreSQL, changing the business state that determines customer eligibility.
2. CDC captures the change. Rather than repeatedly reading all purchase and membership records, the system consumes changes from PostgreSQL's logical replication stream.
3. Incremental SQL maintains the result.…