
Safeagent
io.github.azender1由 GitHub 帳號 azender1 發布v0.1.22更新於 Oct 27, 2026
Exactly-once execution guard for AI agents. Prevents duplicate payments and webhooks on retry.
概覽
本機 Python 執行守衛,讓助理依穩定的 request_id 認領、結算與稽核動作,避免重試時重複執行。
- 可以做什麼
- 以穩定的 request_id 認領動作,首次回傳 PROCEED,重複呼叫回傳 SKIP
- 動作執行後結算認領,將狀態由 PENDING 推進為 COMMITTED 並保存結果
- 依代理、動作類型、狀態或時間範圍查詢認領紀錄
- 使用每個 IP 限 10 次的免費測試認領端點
- 改用內嵌 SQLite 資料表在本機執行相同的認領邏輯,不需網路呼叫
- 適用情境
- 適用於代理會重試付款、郵件、Webhook、下單或資源開通等具副作用的步驟,且重複執行代價高昂的情境。也適合希望在外部呼叫前後留下持久認領紀錄,或在 Python 代理中直接採用本機 SQLite 守衛模式的開發者。
- 執行需求
- 以本機 Python 套件形式透過 stdio 執行(pip install safeagent-exec-guard)。託管 API 需經網路存取一個公開端點;未宣告任何 API 金鑰、標頭或環境變數。README 另提供不需網路呼叫的內嵌 SQLite 方案。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Safeagent,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
SafeAgent — Execution Guard for AI Agents
POST /claim · safeagent-production.up.railway.app
Dashboard: safeagent-dashboard-2.vercel.app
Indexed on Bazaar.
Measured CrewAI retry A/B
A credential-free experiment exercises CrewAI 1.15.21's actual same-process `ToolUsage._use` retry against SafeAgent 0.1.23. Across 30 post-effect/pre-confirmation trials, the unguarded path recorded two effects per logical action; the SafeAgent path recorded one effect and retained a `PENDING` claim for reconciliation.
Scope: scripted deterministic LLM and harmless effect recorded through an out-of-process capability-separated ledger. This does not validate process death, fresh-worker recovery, a real external provider, or SafeAgent Control reconciliation.
Method, source, tests, hashes, and 180-trial evidence
SafeAgent Control founding pilots
Two bounded, read-only reconciliation pilots are open for outside operators. There is no fee unless SafeAgent Control identifies a previously unknown, reproducible discrepancy that the operator agrees is actionable.
Mycelium Trails
This implementation is a Mycelium Provider.
Each completed action submits a trail to ARGENTUM with a content-addressed action_ref
(JCS+SHA-256 over the four preimage fields). The returned mycelium_trail_id is included
in every receipt for independent verification.
Verified on Soma
SafeAgent is the first verified external integrator on Soma — the Mycelium agent catalog. Every production execution is anchored on-chain via Mycelium Trails and independently verifiable without going through the operator.
- Integrator badge — verified external client running Mycelium Trails in production
- Live trails — https://argentum-api.rgiskard.xyz/dashboard/trails?client=safeagent-prod
- Public audit — any auditor can verify SafeAgent executions independently
What it does
SafeAgent is a durable execution-claim guard. It suppresses concurrent and repeated attempts that use the same stable request_id, and preserves unresolved attempts for reconciliation instead of silently retrying them.
Every action gets a stable request_id derived from the logical action. A new key returns PROCEED; a settled key returns SKIP with its stored result. A key left PENDING after a timeout or crash remains blocked because local state alone cannot prove whether the provider accepted the action. Recover it only after checking provider evidence or using provider-native idempotency.
State machine: CLAIMABLE → PENDING → COMMITTED; later claims observe PENDING or SKIP.
Common failure modes SafeAgent prevents:
Guarantee boundary: SafeAgent proves local claim state, not the external outcome.
COMMITTEDmeans the caller settled a receipt.PENDINGmeans unresolved—not failed and not confirmed successful. End-to-end exactly-once effects require provider-native idempotency and/or reconciliation with the provider's authoritative records.
The stack
SafeAgent is the durable claim and duplicate-suppression layer in an agent execution integrity stack:
Each layer is independently authored and independently verifiable. None trusts the others.
API
POST /claim
Gate an action. Returns PROCEED on first call, SKIP on any repeat.
Request body:
request_id— stable identifier derived from what the agent is doing. Same inputs = same key.action— the action type being gated (e.g.payment.send,email,trade,order)
Response:
Retry with the same payload:
POST /settle/{request_id}
Settle a claim after the action fires. Advances status from PENDING to COMMITTED.
POST /claim/test
Free test endpoint — same logic, no payment required. Limited to 10 calls per IP total.
GET /audit
Full claim history. Filter by agent_id, action, status, or timestamp range.
Parameters: agent_id, action, status, from_ts, to_ts, limit (max 1000), offset.
Integration
Python
SaaS (Stripe / email / webhooks)
For production Stripe PaymentIntents, use the permit-gated adapter documented in SafeAgent Boundary. It keeps the Stripe credential outside the agent, passes the consumed permit ID to Stripe as the native idempotency key, persists the provider correlation, verifies webhook signatures and supports authoritative read-back. The simple claim/settle snippet below illustrates the generic API only; it is not the provider adapter.
Run the bounded test-mode example in
examples/stripe_payment_intent_guard.py.
The verification record documents the observed
end-to-end result: one successful Stripe sandbox PaymentIntent, an exact replay
blocked before provider dispatch, and authoritative reconciliation by retrieve.
Webhook deduplication — stable event IDs suppress repeated processing after a settled result; unresolved PENDING events stay blocked for investigation:
CrewAI
PR crewAIInc/crewAI#5822 adds pluggable idempotency backends. SafeAgent's SQLite schema is compatible.
WisePick
WisePick is a deterministic routing layer for agent runtimes. The integration splits capability selection from durable, idempotent execution — WisePick answers what and which provider, SafeAgent answers whether this logical work already ran.
Stack:
- Adapter:
adapters/safeagent_adapter.py - Integration docs:
docs/integrations/safeagent.md - Integration thread: SafeAgent #9
Local guard (embedded SQLite)
The same durable claim behavior without the network call. Drop this into any Python agent:
Case study: crash-retry duplicate prevention
A trading bot fires a market order to buy 6 shares of TQQQ. The broker accepts it. The bot crashes before updating state. On restart — same signal, same bar — the bot fires again. The broker fills it twice. The agent now holds 12 shares when it intended to hold 6.
This is not theoretical. It happens on any unhandled exception between order submission and state persistence.
SafeAgent derives a stable key before touching the broker:
First call: PROCEED. Side effect fires. Settle writes COMMITTED.
Crash and retry: SKIP. Broker never touched again.
Case study: live duplicate blocking — May 21, 2026
Six confirmed SKIP events from a live session on the full stack: DashClaw, SafeAgent, Mycelium Trails, Base/Arbitrum, broker Alpaca.
- 0942 ET: duplicate buy TQQQ qty=6 blocked, $452
- 0947 ET: duplicate add TQQQ qty=6 blocked, $452
- 0949 ET: duplicate sell TQQQ qty=12 on flip, $902
- 1000 ET: duplicate entry TQQQ qty=6 blocked, $454
- 1014 ET: duplicate sell TQQQ qty=18 on V20 flip, $1,350
- 1106 ET: duplicate SQQQ add during scale-in, $43
Full session data: https://gist.github.com/azender1/b9112b6519c935df4a75cb05cd250e26
Conformance
SafeAgent participates in the A2A cross-implementation conformance corpus. Byte-verified fixtures across four independent implementations:
- kenneives (agentgraph) — verifier-attestation-v0: 30/30 ✓
- evidai (LemonCake) — gated-preflight-v1: 33/33 ✓
- haroldmalikfrimpong-ops (agentid) — independent verifier ✓
- SafeAgent — claim-lifecycle conformance v1.1 ✓
A2A #1920 closed. All four implementations satisfy freshness and replay requirements.
Canonical action_ref derivation
JCS (RFC 8785), aligned with argentum-core, Nobulex, and APS:
timestamp is an RFC 3339 UTC string with exactly 3 millisecond digits. The trailing Z is mandatory.
Conformance fixtures: giskard09/argentum-core tag action-ref-v1.0
Deployment
Railway · Serverless OFF · always-on
PyPI: pip install safeagent-exec-guard
npm: npm install n8n-nodes-safeagent
MCP Registry: io.github.azender1/safeagent
Dashboard: safeagent-dashboard-2.vercel.app
License
Apache-2.0
來源:README.md,提交 2dfd694
工具
0版本歷史
1- v0.1.22最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分