Show HN: SafeAgent – exactly-once execution guard for AI agent side effects
Lions2026 Sunday, March 08, 2026I built a small Python library called SafeAgent that protects real-world side effects when AI agents retry tool calls.
One issue we ran into while experimenting with agent workflows is that retries can trigger irreversible actions multiple times:
agent calls tool ↓ network timeout ↓ agent retries ↓ side effect happens twice
Examples:
• duplicate payment • duplicate email • duplicate ticket • duplicate trade
Most systems solve this ad-hoc using idempotency keys scattered around different services.
SafeAgent centralizes this into a small execution guard.
The idea is simple:
1. every tool execution gets a request_id 2. SafeAgent records the execution receipt 3. retries return the original receipt instead of running the side effect again
Example:
FIRST CALL REAL SIDE EFFECT: sending email
SECOND CALL WITH SAME request_id SafeAgent returns the original execution receipt (no second side effect)
The project is early but includes examples for:
• OpenAI tool calls • LangChain style tools • CrewAI actions
PyPI: https://pypi.org/project/safeagent-exec-guard/
GitHub: https://github.com/azender1/SafeAgent
Curious how other people are handling retry safety for agent side effects.