I built an autonomous treasury agent, then let a code review bot find every way it could lose money
说明与用途
构建了 TreasuryForge,具备风险检查、人类审批门和自动代码审查的自治金库代理,发现关键错误并提升安全性。
问题
Ensuring a safe autonomous treasury agent required robust approval gates, risk checks, and automated code review to catch hidden bugs that could lead to financial loss.
结果
The project achieved a robust, human-checked autonomous treasury loop, identified and fixed critical bugs, and demonstrated the value of automated code review in financial agent development.
工作流
- 1. Agent calls get_portfolio and get_transaction_log for evidence.
- 2. Agent calls check_risk_limits for the proposed trade.
- 3. If risk breach, run a sandboxed Python script to simulate correlated shock and compute drawdown.
- 4. Agent proposes trade with reasoning; execute_trade recomputes risk server-side.
- 5. Human approves or denies via TrueForge user.tool_approval.
- 6. Sub-agent reviews last 20 decisions, backtests alternative risk thresholds in sandbox.
证据
The approval gate had a bypass. Early on, the wallet server bound to 0.0.0.0 instead of localhost, and the reset endpoint had no auth.
A trade could double-execute on retry. execute_trade reported failure to the caller after it had already committed the write.
Fixing one race condition created another. Switching some FastAPI routes from async to sync made day-start risk-baseline rollover non-atomic.
- 记录日期: 2026-09-05T17:30:02.692Z