Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

I built an autonomous treasury agent, then let a code review bot find every way it could lose money

Description and use

Built TreasuryForge, an autonomous treasury agent with risk checks, human approval gates, and automated code review, uncovering critical bugs and enhancing security.

Problem

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.

Outcome

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.

Workflow

  • 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.

Evidence

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.

Source

A trade could double-execute on retry. execute_trade reported failure to the caller after it had already committed the write.

Source

Fixing one race condition created another. Switching some FastAPI routes from async to sync made day-start risk-baseline rollover non-atomic.

Source

  • Record date: 2026-09-05T17:30:02.692Z