Idempotency & Compensating Rollback
Conversational AI, Agent Memory & Multi-Turn Testing β Day 6
Enforce per-transaction and daily financial limits, guarantee idempotent retries on tool timeouts, and trigger compensating rollbacks when downstream services fail mid-conversation.
When a conversational agent executes multi-step financial actions such as issuing a provisional dispute credit and syncing a CRM case, network retries or downstream 503 failures can cause double-credits or corrupted partial state. Today you will test idempotency keys, transaction ceilings, and saga-style compensating rollbacks.
The official reference codebase for Day 6 is hosted in the repository. Clone the repository and navigate to day-6-state-rollback/test_day6.py to run the working solution.
git clone https://github.com/777abhi/agent-memory-testing-roadmap.git
cd agent-memory-testing-roadmap/day-6-state-rollback/test_day6.pyRun Transactional Limits & Rollback Tests
Execute the Day 6 transactional conversation test suite.
npm run test:day6res = agent.issue_provisional_credit(
"idem-rollback-1", "DSP-301", 150.0, notify_downstream=broken_crm_sync
)
assert res.status == "ROLLED_BACK" and res.compensated
assert acct.balance == 750.0 # Exact pre-transaction state restored- Prevented duplicate provisional credits across repeated agent tool retries via idempotency keys.
- Enforced per-transaction and daily financial policy ceilings before mutating account state.
- Verified compensating rollbacks restore exact balance, daily usage, and open case lists when downstream tools fail.
π§ Knowledge Check
What should a transactional conversational agent do when a ledger credit succeeds but the downstream case-sync tool throws a 503 error?