Show HN: SafeAgent – exactly-once execution guard for AI agents

2 points by Lions2026 ↗ HN
LLM agents and tool-calling systems frequently retry or replay actions.

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

GitHub: https://github.com/azender1/SafeAgent

PyPI: https://pypi.org/project/safeagent-exec-guard/

1 comment

[ 3.2 ms ] story [ 11.4 ms ] thread
This becomes a real issue once agents start interacting with external systems. Retries are easy to miss during development, but once you add tool calls + network failures the agent loop can replay same action multiple times.

Idempotency/request IDs end up becoming pretty important for anything that touches emails, payments, tickets etc