Inspiration

Autonomous AI agents are increasingly entrusted with business operations, yet giving an LLM unconstrained access to financial rails is a high-stakes liability. A hallucinated quantity, a misplaced decimal point, or an adversarial prompt injection could trigger catastrophic capital outflows or contract breaches:

$$\text{Risk}(\text{LLM Payment Execution}) \propto \frac{\text{Autonomous Spending Authority}}{\text{Deterministic Verification}}$$

Traditional enterprise procurement, on the other hand, is bogged down by multi-day approval cycles, fragmented vendor catalogs, and clunky manual reconciliations. We asked: How can we empower autonomous agents to negotiate, compare supplier quotes, and orchestrate orders at machine speed—while mathematically guaranteeing with compiler-enforced certainty that unauthorized or out-of-policy spending can never execute?

This inspired ProcureOps AI: an agentic commerce platform where AI agents parse natural-language purchasing mandates, compare quotes across multiple vendors, and stream real-time financial telemetry into an AG Grid executive treasury cockpit—guarded at compile-time by Rust's typestate pattern before executing through PayPal Orders v2 and PayPal Payouts v1 APIs.


What it does

ProcureOps AI bridges autonomous procurement with hardened financial safety rails across three integrated user flows:

  1. Autonomous Procurement Mandate: Users input a natural-language mandate (e.g., "Buy 10 units of Raspberry Pi 5 under $900 total with delivery under 4 days from an approved vendor"). The agent extracts requirements, queries live supplier catalogs (DigiKey, Mouser, SparkFun), evaluates the best compliant quote, and validates the transaction against strict corporate policy.
  2. Rust Typestate Guardrail Enforcement: Before any payment call, our Rust engine enforces hard budget limits, vendor whitelist verification, rating floors ($\ge 4.5$), and risk metrics. If compliant, it constructs a cryptographically isolated ApprovedMandate required for execution. Non-compliant attempts are rejected as BLOCKED_BY_GUARDRAIL.
  3. PayPal Orders v2 & Payouts v1 Settlement:
    • Prepares an official PayPal Order via REST API v2 (AWAITING_APPROVAL).
    • Authenticates buyer approval in the browser via PayPal JavaScript SDK v6.
    • Captures authorized transactions to COMPLETED.
    • Offers finance managers one-click automated vendor disbursement via PayPal Payouts v1 (SETTLED).
  4. Conversational Treasury Analytics ("Ask-Your-Spend"): Finance operators can query spend data in natural language (e.g., "Show blocked orders over $500"). The engine compiles the query into a typed Rust filter AST, dynamically updating the AG Grid view with zero code-injection risk.

How we built it

We built ProcureOps AI as a high-performance full-stack system:

  • Backend (Rust + Axum + Tokio):
    • Typestate Policy Pattern: Designed an unforgeable ApprovedMandate type with private fields. PayPalClient::execute_order(&self, mandate: &ApprovedMandate) can only be invoked after guardrails::validate() passes.
    • Multi-Vendor Optimization: Evaluates quotes across suppliers balancing unit prices against delivery SLA deadlines.
    • Dual Model Pipeline: An LLM client supporting OpenRouter and OpenAI with an offline deterministic regex parser fallback for bulletproof operational continuity.
  • Financial Rails (PayPal REST APIs & JS SDK v6):
    • Integrated PayPal Orders v2 for compliant order staging and capture.
    • Integrated PayPal Payouts v1 for instant batch payouts directly to vendor sandbox receivers.
    • Built an explicit dual-mode engine: fully interactive PayPal Sandbox mode with an explicit simulation fallback for offline verification.
  • Frontend Cockpit (Next.js 16 + React 19 + Tailwind CSS 4):
    • High-density enterprise dashboard powered by AG Grid React v36.
    • Custom cell renderers for real-time risk gauges, policy badge renderers, and interactive one-click PayPal Payout buttons.
    • Real-time KPI banner aggregating total spend, active orders, and blocked violation rates.

Challenges we ran into

  1. Deterministic Order Capture vs. Buyer Approval Lifecycle: We initially explored direct unattended capture upon AI policy validation. Aligning with PayPal's security architecture required redesigning the state machine to honor the explicit buyer approval lifecycle: $$\text{AWAITING_APPROVAL} \xrightarrow{\text{SDK v6 Buyer Capture}} \text{COMPLETED} \xrightarrow{\text{Payouts v1}} \text{SETTLED}$$ Ensuring idempotency across transient network dropouts and sandbox reconciliation was critical.
  2. Eliminating Injection in Conversational Analytics: Converting user queries like "Show high-risk orders from Mouser" into table filters frequently tempts developers to generate dynamic SQL or eval. To eliminate all prompt injection and arbitrary code execution vectors, we built a memory-safe Rust AST parser that translates queries into compiled iterator predicates (iter().filter(...)).
  3. Windows Native Build Quirks: Next.js Turbopack subprocess conflicts on Windows were resolved by standardizing on the webpack pipeline, localizing OFL Manrope variable typography to remove external network dependencies, and building headless Playwright browser verification suites.

Accomplishments that we're proud of

  • Zero-Bypass Typestate Security: Achieved compile-time proof that untrusted LLM outputs cannot initiate financial payment without passing deterministic validation.
  • Seamless PayPal Integration: End-to-end integration spanning order creation, PayPal JavaScript SDK v6 modal approval, server-side capture verification, and instant PayPal Payouts disbursement.
  • Wall-Street Grade AG Grid Experience: Created an information-dense, responsive cockpit that gives enterprise treasurers immediate visibility into every agentic decision, risk score, and transaction status.

What we learned

  • Rust as a Fintech Primitive: Rust's type system is uniquely suited for autonomous AI governance. Enforcing financial policies at compile time via typestates provides guarantees that conventional runtime tests cannot match.
  • Hybrid AI Architectures: Autonomous agents perform best when paired with deterministic fallbacks and rigid schemas. Unstructured reasoning handles intent extraction, while typed data structures enforce business logic.
  • Designing for Auditable AI: Finance teams embrace agentic autonomy only when accompanied by transparent, tabular audit trails like AG Grid rather than opaque chatbot dialogues.

What's next for ProcureOps AI – Autonomous Agentic B2B Procurement

  • Autonomous Multi-Agent RFQ Negotiation: Introducing counter-bidding agents that negotiate volume discount tiers directly with supplier APIs over WebSockets.
  • Automated Milestone Escrow: Connecting IoT proof-of-delivery signals to PayPal multi-party disbursement triggers.
  • Enterprise ERP Synchronization: Bidirectional sync connectors for NetSuite, SAP, and QuickBooks for instant chart-of-accounts automated ledger balancing.

Built With

Share this project:

Updates

Submission history