Skip to content
Pavlos

Pavlos

Guardrails for AI agents that touch money.

Created on 30th August 2026

•

Pavlos

Pavlos

Guardrails for AI agents that touch money.

The problem Pavlos solves

As AI agents transition from sending emails to managing real-world financial operations—initiating payments, issuing refunds, adjusting account ledgers, waiving fees, or approving credit—they enter a domain where errors have direct economic identity and catastrophic financial risk.

Generic LLM tracing tools (like Langfuse or Phoenix) log prompts and tool calls, but fail to secure or explain financial actions:

Language is Not Authorization: Standard agents allow LLM text outputs to directly call money-moving APIs. A malicious prompt injection (e.g., the Grok–Bankrbot incident), quoted text, or compromised dashboard (e.g., AIXBT) can trick a model into transferring real money or tokens.
"Success" is Not Binary: In finance, an API timeout doesn't mean a payment failed. Retrying an ambiguous request can double-debit an account or double-refund a customer. Traditional tools collapse complex financial lifecycles into simple SUCCESS / FAILED flags, ignoring provider acknowledgments, settlement cutoffs, and reconciliation suspense.
Correct Math vs. Wrong Economics: A double-entry ledger can balance perfectly while paying the wrong beneficiary, using the wrong currency exponent, or violating customer mandates (e.g., the Citi–Revlon $894M wire error).
No Safe Environment for Failure Testing: Engineering teams cannot safely test how an agent handles edge cases (like rate limits, gas spikes, duplicate webhooks, or stale fraud lists) directly against live financial APIs without risking real money loss.

Challenges we ran into

Building Pavlos required moving beyond standard LLM testing to construct a mathematically rigorous, multi-sector financial stress laboratory:

Challenge 1: Paired Monte Carlo Simulation with Common Random Numbers (CRN)
Problem: Comparing an unguarded agent against a guarded control in separate stochastic runs introduces high variance (noise from random timing, different prompt outcomes, or network drops), making it hard to prove whether a safety policy actually prevented a failure.
Solution: We engineered a Paired Monte Carlo engine (sector_simulation.py) using Common Random Numbers (CRN). By seeding a single stress vector and replaying it twice—once inside an unguarded counterfactual and once with the deterministic Money-Movement Guard—both runs experience identical faults, network timeouts, stale state, and beneficiary identity drift. This isolates true causal impact and allows computing Wilson 95% Score Confidence Intervals for failure rates, residual ambiguity, and false holds.
Challenge 2: Decoupling MiroFish World Graphs from Financial Accounting
Problem: Agent interactions require realistic world modeling (actor memories, partial information, relationship graphs, temporal pressure), but relying on a graph or LLM memory as a ledger leads to severe balance drift.
Solution: We established a strict architectural boundary: The graph is never a ledger. We used a MiroFish-inspired world graph for actor visibility and scenario generation (worldgen.py), while keeping 100% of financial state, double-entry balance rules (Debits = Credits), and idempotency reservations inside deterministic Python code (ledger.py & guard.py).
Challenge 3: Expanding Across 5 Distinct Financial Sectors
Problem: Financial consequences differ radically across domains—a refund is compensatable/reversible, whereas an outbound treasury wire or paper stock order is irreversible.
Solution: We built 5 domain-specific World Packs (agent_catalog.py) with specialized state machines, authority envelopes, and harm oracles:
Payments: Refund & Reconciliation (Stripe, Adyen targets)
Lending: Hardship Servicing & Repayment Schedules (LoanPro, Mambu, Plaid)
Corporate Treasury: Beneficiary-Bound Outbound Wires (Modern Treasury)
Insurance: Claims Payout Execution (Guidewire ClaimCenter)
Investing: Paper Portfolio Rebalancing (Alpaca Paper, DriveWealth)
Challenge 4: Zero-Dependency Architecture & Local Security Isolation
Problem: Financial stress labs require absolute isolation so that simulation code can never accidentally hit live production bank/PSP APIs or leak API credentials.
Solution: We built Pavlos using 100% pure Python standard library with zero external pip dependencies. The system runs paper-only sandboxes, refuses live account modes, binds strictly to local loopback (127.0.0.1), and keeps LLM keys strictly in memory during optional Azure OpenAI world compilation.

Technologies used

Discussion

Builders also viewed

See more projects on Devfolio