Skip to content

Latest commit

 

History

History
152 lines (103 loc) · 3.07 KB

File metadata and controls

152 lines (103 loc) · 3.07 KB

SafeAgent

Trading Demo

Deterministic execution for real-world actions under uncertainty.


The Problem

Agents don’t fail on decisions.
They fail on uncertain completion.

submit order
timeout
retry
submit order   <-- duplicate

Real Impact

Position: 2 → 4 shares
Capital: $710.20 → $1420.40

Not bad logic.
Just no execution boundary.


The Fix

SafeAgent enforces:

  • request identity
  • execution boundary
  • deterministic retry resolution
timeout
retry
SafeAgent: returning cached result

Core Idea

Agent → SafeAgent → Real World

Retries don’t replay.
They resolve.


PeerPlay Settlement Use Case

SafeAgent is also the settlement guard for PeerPlay-style tournament payout flows.

  • tournament result verified
  • payout request sent
  • confirmation lost / timeout
  • retry fires

Without an execution boundary, the same winner can be paid twice. With SafeAgent, the retry resolves against the prior request record and returns the original result.

Start here:

  • examples/peerplay_tournament_settlement_demo.py
  • failure-cases/05_peerplay_tournament_duplicate_payout/README.md

Failure Cases

  • Trading → double position
  • Payments → duplicate charge
  • Notifications → duplicate send
  • State desync → unintended re-entry
  • PeerPlay → duplicate tournament payout

See: failure-cases/


Working Demos

  • Trading retry demo: assets/safeagent_trading_demo_v2.gif
  • Postgres runtime proof: assets/postgres_demo.gif
  • PeerPlay tournament settlement: examples/peerplay_tournament_settlement_demo.py
  • Deck: deck/SAFEAGENT_DECK_PRO_V2_FINAL.pptx

Before / After

Before After Demo

Execution Guard

Execution Guard Demo
Show Postgres runtime proof
Postgres Demo

Full Video

Download MP4


Status

Reference implementation for handling duplicate execution under uncertain completion.


Repo

github.com/azender1/SafeAgent


Need this fixed in your system?

I offer a Duplicate Execution Risk Audit.

I will:

  • Identify where retries + timeouts can cause duplicate execution (payments, trades, workflows, API calls)
  • Reproduce the failure cases
  • Provide the exact fix pattern (with SafeAgent or equivalent design)

Flat fee: $499
(includes report + concrete fix recommendations)

If you want a pilot integration or full production implementation, we can scope that after.

DM me on X (@ZGT512666) or open an issue with "AUDIT".