今日已更新 166 条资讯 | 累计 20138 条内容
关于我们

My Trading Bot Tried to Execute the Same Trade Twice. That Became SafeAgent.

Anthony Zender 2026年05月31日 11:11 4 次阅读 来源:Dev.to

This is a submission for the GitHub Finish-Up-A-Thon Challenge The Bug That Doubled Real Trades On May 21, my live trading bot generated six duplicate execution attempts in one session. SafeAgent blocked all six. Without the guard: one duplicated a $1,350 sell another doubled a TQQQ position total duplicate transaction exposure: $3,653 That session changed how I think about AI agents, retries, and execution guarantees. What I Built SafeAgent is an exactly-once execution guard for AI agents and SaaS applications. It prevents duplicate payments, emails, trades, and webhook processing when retries fire after a timeout or crash. Live endpoint: https://safeagent-production.up.railway.app GitHub: https://github.com/azender1/SafeAgent PyPI: pip install safeagent-exec-guard The Comeback Story How it actually started Six months ago I was building two things at once: PeerPlay — a patented P2P wagering exchange for skill-based video game tournaments (USPTO provisional 63/914,036) — and a live QQQ/TQQQ momentum trading bot running on Alpaca Markets. Both hit the same bug. Contest verification agent times out, retries, settlement fires twice. Bot order fills, confirmation drops, retry fires, doubled position. Same failure mode. Different domain. Different models pushed me toward very different architectures during development. Some were fast but overconfident. The most useful moments came when a model explained why an approach was broken before I implemented it. That's part of why SafeAgent sat unfinished. Not just time — wrong turns that burned momentum. Why local idempotency fails Early versions used a local SQLite guard. It worked until it didn't: workers restart and the in-memory state is gone containers reschedule and replay from the last checkpoint retries land on a different machine entirely Exactly-once semantics require a durable coordination boundary outside the worker itself. That's what the hosted /claim endpoint provides — the claim lives on the server, not in the p

本文内容来源于互联网,版权归原作者所有
查看原文