Inspiration
Autonomous multi-agent swarms are rapidly becoming the operational backbone of modern engineering teams. However, when background agents are granted access to corporate payment rails or cloud billing accounts, catastrophic failure modes emerge: recursive reasoning loops running unchecked API calls, runaway GPU cluster provisioning, dynamic checkout markup exploitation, and flat-fee depletion on micro-transactions.
Current enterprise systems force a binary choice: either give agents unrestricted financial access or stop every micro-decision with manual human approval. We built Agentic Safe Wallet as a deterministic, zero-trust financial firewall and autonomous execution gateway that decouples spending authority from AI decision-making through an immutable propose-only contract.
What It Does
Agentic Safe Wallet acts as a zero-trust financial operating system that sits between autonomous AI agents and live payment rails:
- Strict Integer Minor-Unit Accounting: Eliminates rounding drift by computing all balances, reservations, and ledger state strictly in integer cents: $$\text{Allowance} = \text{Posted} + \text{Pending Active Holds} + \text{Remaining Spendable}$$
- Propose-Only Agent Invariant: Agents can never directly initiate fund movement. Every purchase proposal is evaluated by a 4-tier reasoning gateway (Budget Agent, Channel3 Anti-Fraud Oracle, and a Deterministic Policy Engine).
- Multi-Rail PayPal Execution:
- Direct Orders v2: Dynamic server-side order generation and smart button capture gated by expiring single-use cryptographic tokens (
tok_appr_*). - Micro-Payment Aggregator Rail: Automatically batches sub-$10 API calls into consolidated captures, reducing fixed per-transaction fees by up to 85%.
- Zero-Debit Reverse Inflow: Safely routes external API earnings and affiliate yields into spendable balance envelopes without debit risk.
- Direct Orders v2: Dynamic server-side order generation and smart button capture gated by expiring single-use cryptographic tokens (
- AG Grid Enterprise Audited Passbook: Real-time transaction ledger with live pinned summary totals, cryptographic SHA-256 block hash integrity chains, multi-column filters, and one-click CSV audit export.
- Bryntum Predictive Cashflow Runway: Interactive 30-day forward-burn timeline projecting scheduled commitments, velocity tripwires, and milestone burn curves.
- Adversarial Red-Team Arena: Built-in interactive attack suite testing 13 distinct assault vectors—from $850 rogue Lambda GPU cluster loops to network replay capture exploits.
How We Built It
- Backend: Built with FastAPI (Python 3.11) enforcing sub-5ms policy evaluation, an integer minor-unit SQLite engine, Pydantic v2 schemas, and a 10-point financial security validation suite.
- Payment Rails: Integrated with PayPal REST API v2 (Orders v2 Sandbox, Webhook HMAC signature verification, and batched micro-settlements).
- Frontend: Developed in React 18 and Vite with Tailwind CSS, Server-Sent Events (SSE) for live passbook synchronization, and an Enterprise Admin Command Center.
- Data Visualization & Timelines: Leveraged AG Grid (
ag-theme-quartz) for audited transaction records and Bryntum for interactive 30-day predictive runway projections. - API Governance: Designed and exported validated OpenAPI 3.0 contracts with APIMatic metadata and developer SDK generation.
- Agent Intelligence: Powered by Google Gemini 2.5 Flash for multi-agent financial reasoning, velocity telemetry, and catalog price-arbitrage detection.
Challenges We Ran Into
- Eliminating Currency Float Drift: Floating-point math creates fractional cent discrepancies during fee rollups and multi-currency conversions. We solved this by enforcing integer minor-units across the database, policy gateway, and PayPal payload construction.
- Preventing Replay Attacks on Captures: When network latency causes duplicate capture submissions, balances can be double-debited. We implemented atomic state locks and idempotent request fingerprinting returning HTTP 409 Conflict on duplicate attempts.
- Dynamic Price-Gouging Defense: LLMs can be manipulated into approving inflated checkout totals. We introduced the Channel3 Anti-Fraud verification layer to cross-reference proposed prices against verified catalog MSRP before issuing approval tokens.
Accomplishments That We're Proud Of
- Achieved 100% test pass rate across our 10-point financial security validation suite (
pytest tests/test_financial_security.py). - Seamlessly unified PayPal Sandbox Orders v2, AG Grid, Bryntum, and APIMatic within a single enterprise-ready workflow.
- Proved that autonomous AI swarms can safely execute high-volume API purchasing without ever holding direct payment credentials.
What We Learned
- In financial systems for autonomous agents, deterministic code must always supersede LLM reasoning. While LLMs excel at summarizing telemetry and detecting context anomalies, balance math and policy constraints must remain mathematically rigid.
- Micro-transaction fee structures can rapidly deplete a balance envelope unless batched via smart rollup queues.
What's Next for Agentic Safe Wallet
- Support for multi-currency envelope pooling across global agent clusters.
- Native decentralized agent identity (DID) verification for cross-organization agent swarms.
- Production rollout of automated webhook reconciliation with automated dispute resolution flows.
Built With
- ag-grid
- agentic-ai
- ai-agents
- apimatic
- bryntum
- cybersecurity
- fast-api
- fintech
- google-gemini
- openapi
- paypal
- python
- react
- rest-api
- sqlite
- tailwind-css
- typescript
- vite
- zero-trust