This becomes dangerous when the action is irreversible: - sending emails - opening tickets - executing trades - triggering payouts
SafeAgent is a small Python library that enforces exactly-once execution for agent actions using request-ID deduplication.
Example:
from settlement.settlement_requests import SettlementRequestRegistry
registry = SettlementRequestRegistry()
def send_email(): print("EMAIL SENT")
registry.execute( request_id="email:user123:invoice", action="send_email", payload={"to": "user123@example.com"}, execute_fn=send_email )
If the same request_id is replayed, the action does not run again.
Instead the original execution receipt is returned.
pip install safeagent-exec-guard
stratifyintel•43m ago
Idempotency/request IDs end up becoming pretty important for anything that touches emails, payments, tickets etc